Singly linked list is a type of list which uses dynamic representation rather than a much simpler and versatile static representation. Dynamic representation is something which is not even supported by most programming languages and it makes life for programmers much complicated since it requires extra knowledge to implement this in a program. But as always, there is a reason behind its excessive usage. A dynamically allocated list allocated memory at run time an not at compile time. That means it allocates a portion of memory which is going to be used for implementation, it doesn’t waste a dime of the memory.
Lets assume that we have an array of 100 elements declared. The memory will be allocated for all 100 elements at compile time. If we use only 5 elements of the array the rest of 95 elements are going to a complete waste. This kind of situation can be avoided using a dynamic representation, which allocated memory to only the elements which are required for implementation. But since memory is not an issue these days, dynamic representation is not the primary choice of a programmer. So it avoid the bottleneck that this creates static representation is always preferred.
A linked list is therefor much more efficient than an array but not as simple to implement.
This video tutorial explain the implementation of Singly Linked list in C++.
Administrador de ENGGDRCAOS. Canal dedicado especialmente a la formación del estudiante que aspira a ser ingeniero. Todos los videos son Ingles. Apasionado del universo Apple, estudiante de Ingeniería y Gamer por vocación.
