Sorry for posting this, it appears that HN is not the place to post content if your only goal is to help people to learn. The hacker ethic is dead I guess, Richard Stallman really was the last man standing then. Remind me to come and post something when I decide to make some silly iPhone / android app when I want to make money rather than sharing knowledge. Thanks.
Linked lists in C, with open source ADT
21–30 of 43 posts
Re: Linked lists in C, with open source ADT
#22Earlier quoted context omitted.
It really does depend on what you need to be doing in order to make the assumption of what data structure is needed. A vector is all well and good for certain tasks, but sometimes, a list is what you need. I will cover vectors too, but for now I am focused on C. not C++. Thanks though.
You need a list when you have routine insertions somewhere besides the front or the back of the container, and you don't have routine random-access reads. The vector covers more cases and is generally more performant. Use whatever you like, though.
Re: Linked lists in C, with open source ADT
#23Earlier quoted context omitted.
You need a list when you have routine insertions somewhere besides the front or the back of the container, and you don't have routine random-access reads. The vector covers more cases and is generally more performant. Use whatever you like, though.
i disagree.
Re: Linked lists in C, with open source ADT
#24Re: Linked lists in C, with open source ADT
#25Earlier quoted context omitted.
... do go on.
see my post below your second highest voted comment on this thread.
"This result should not surprise any experienced programmers, but unfortunately it does many of us."
whistles
Re: Linked lists in C, with open source ADT
#26This is week-one stuff of a CS degree or on the job training. If you don't know this you shouldn't be programming.
Re: Linked lists in C, with open source ADT
#27Re: Linked lists in C, with open source ADT
#28Earlier quoted context omitted.
... do go on.
see my post below your second highest voted comment on this thread.
1. for that workload the result should not really surprise anyone.
2. you are pointing to one pathological workload to make a point that vector performance is always better than lists?
Re: Linked lists in C, with open source ADT
#29This is week-one stuff of a CS degree or on the job training. If you don't know this you shouldn't be programming.
Re: Linked lists in C, with open source ADT
#30The book _C Interfaces and Implementation_ is nothing but library interfaces like this and their implementations. You are, for whatever it's worth, better off defaulting to a variable-length array than to a linked list.
"insertions to the end of a variable-length array are very fast" really tptacek? its O(1) ammortized over time, and when N grows it becomes really slow because it involves reallocation and a linear copy of all elements.