I wanted to know the applications of linked lists in real-world applications. Are there any alternatives to Linked lists ?
Thanks so much ^_^
Jump to Post
Linked lists end up in a huge range of different application - anywhere you need to store a large number of objects, but don't know exactly how many items you need - as such, you can't really use an array. C# has a List<T> class which allows you to build …
Linked lists end up in a huge range of different application - anywhere you need to store a large number of objects, but don't know exactly how many items you need - as such, you can't really use an array. C# has a List<T> class which allows you to build lists of any type. As far as I know this uses a linked list implementation. I use List<T> all the time, as do a number of people I know.
As a general rule, you won't need to code your own linked list - most languages have it implemented. But it is very useful in more applications than I could possibly name.
Data structures have several properties that are important:
Linked lists come in two flavors: Singly linked list and doubly linked lists.
For simple singly linked lists:
For doubly linked lists
Lists are very useful for holding data that is always accessed 'in order' rather than needing to look for a particular item.
Lists are very useful for holding many items where you need to add or remove items during the course of the program.
Lists are not best for random access (choose arrays or vectors) or access by key (choose a dictionary or map).
If you know the number of items, lists are more expensive in both time and space than an array or vector.
If you only ever need to access items from front to back, and if you never need to delete any item except the front one, singly linked lists beat doubly linked lists.
If you ever need to 'go backward' from an item, or if you need to delete "here" in the middle of a list, then doubly linked lists beat singly linked lists.
Real world applications abound. For instance:
a list of the lines in a file
a list of the options in a menu (particularly if you can drag menu items around)
a list in the GPS of the turns along your route
There are many alternatives to lists. Search for 'Data Structures' online, or read any good programming book. Briefly (and, I'm sure, incompletely) here are some well known, often used data structures
We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.