2.Linkedlist
This section explains the concept, its importance, and when to use it.
2.Linkedlist
LINKED LISTS
Each node is composed of a data and a reference/link to the next node in the sequence
Linked lists are dynamic data structures (arrays are not !!!)
Waste memory because of the references
Linked list operations insertion
Linked list operations remove
Problems with linked lists
Linked lists VS arrays
Search operation yields the same result for both data structure
Deletion: LinkedList remove operation takes O(1) time if we remove items from the beginning and usually this is the case
Arrays do not need any extra memory
ARRAY
Arrays are data structures in order to store items of the same type
We can use random access because of the keys: getItem(int index) will return the value with the given key very fast // O(1)
We have to know the size of the array at compile-time: so it is not so dynamic data structure