Please explain what is the advantage of linked list over an array. And also is there any advantage of using array compared to linked list.
Regards, Shoaib
While it has been mentioned that arrays have better performance than linked lists, I am surprised to see no mention of the word "cache" anywhere. The problem with linked lists is mainly that they pretty much guarantee that every jump from node to node will be a cache miss, which is incredibly, brutally expensive, performance-wise.
To put it crudely, if performance matters even the slightest bit in your program, you should never use a linked list. Ever. There is no excuse for it. They are far beyond "slow", they are catastrophically slow, and nothing about them can make up for that fact. Using them is like an intentional sabotage to your performance, like inserting a "wait()" function into your code for absolutely no reason.