Originally Posted by
jps
and after this, you finish connecting the other node in both cases. When you break the "chain" to delete or add a "link" there are two open ends of the chain that must connect to each other or to the inserted node (unless the insert is an append)
Would it be a bad idea to paint the second half of your car the wrong color, or just stop now and paint the whole car one color one time? This is something you try to determine before you write code, during the planning. Many people skip the planning (not saying that you did or did not) but for all readers, this is one example to consider when planning.
I agree. All that reading and writing involved. I like the idea of pointers too.
Yeah, I wasn't explaining the whole process in the post but I understand I need to make sure both ends are pointing to the right places. I am a first year CS student and finished a intro to data structures class last semester. This project was in the first chapter (I'm just going through the book again over the summer to reinforce topics and practice) and was basically step by step and originally wanted me to use arrays (linked lists and different data types aren't covered for a few more chapters). As I was getting farther into the program it hit me that I might be able to use some of the ADTs that I learned. So I didn't really plan it out, just followed the book. I'll start looking farther ahead.
Originally Posted by
helloworld922
Look into how vectors (a.k.a. ArrayList) track "dynamic arrays". They don't always create a new array storage area every time the size of the list is modified.
I would suggest looking into set and map data structures as these will likely perform much better than list data structures in this scenario (see if you can't figure out why).
I'll look into the map a little more, we didn't cover it in the intro class but it is looking like a nice alternative. Thanks for the suggestions guys!