Please enable JavaScript.
Coggle requires JavaScript to display documents.
Lists, stacks and queues - Coggle Diagram
Lists, stacks and queues
Arrays are used to store elements in sequence
Are defined by indexes
Has a predefined maximum size
Space are used by unused positions
Doesnt consume space with pointers
Linked lists are also used to store sequential elements
Are defined by pointers to elements
It could be simple lists, with one-way acess and final link to null
Can be double linked list with two-way acess
No predefined size
Doesnt consume space with unused positions
Space consumed by links
Stacks are Last-In First-Out(LIFO)
You can push on top to add a element
Or pop a element to remove it from the top
Can be used to backtrack
And recursion
Queues are First-In First-Out(FIFO)
You can enqueue to add a element to the end of the queue
Or dequeue to remove a element from the beggining of the queue