News for hackers. Stuff that matters.
Re:In Defense of Linked Lists by DeathArrow on Saturday November 05, 2022 @01:17AM (#33478208)
While there's a certain use for linked lists - in operating systems kernels for example and as a programmer you absolutely have to know how linked lists work, there are other linear data structures which are more suited for general programming.

To give a C# example, arrays, lists and dictionaries (hash tables) implement iterators so you can always know what the next element in collection is. Elements can be accessed by key or index in O(1),elements can be added in O(1). The case in which you absolutely have to insert an element in a particular position is rare so linked lists are seldom used.

The same case is for C++, there is a vector class in STL but no linked list class. Same for Java.

Re:In Defense of Linked Lists by selimco on Saturday November 05, 2022 @01:36AM (#33478295)
> The same case is for C++, there is a vector class in STL but no linked list class. Same for Java.

Java does have a linked list in the standard library: https://docs.oracle.com/en/java/javase/17/docs/api/java.base...

Re:In Defense of Linked Lists by cyber_kinetist on Saturday November 05, 2022 @01:42AM (#33478334)
> The same case is for C++, there is a vector class in STL but no linked list class.

No, there is std::list.

https://en.cppreference.com/w/cpp/container/list

> Same for Java.

Also no, LinkedList exists.

https://docs.oracle.com/javase/7/docs/api/java/util/LinkedLi...