robin Flashcards
What is a list
a linear structure that provides only sequential access to its elements
What two special named elements does a list have
A head: points to the first element
A tail: points to the last element
How do lists differ from arrays
- They do not have a fixed size
- They can only store elements of the same type (homogenous structure)
What ist he advantage of lists over array
Easy insertion and dletion when using dynamic memory allocation
What are linked lists
a better alternative to implement lists is dynamic allocation (linked lists)
what nodes do linked lists consist of
- A data member (value)
- A link member (ointed to the next node
What are the advantages of linked lists
- efficient memeory usage
- no predefined size
- insertions and deletions are cheaper
What are the disadvantages of linked lists
- more complex algorithms
- harder to read and debug
- dynamic memeory allocation intruiduces performance overhead
define a linked list
a data structure where each element points to the next and previous elements, forming a bi-directional chain
in the context of an array based implmenetation of lists what is the purpose of the ‘head’ and ‘tail’ elements
to keep track of the first and last elements of the list
where are pointers used
linked lists, not arrays
What best describes a stack
Last in first out, where the last element added is the first to be removed
What best describes a queue
first in first out
what does enqueue mean in a queue
adding an element to the rear (at the end) of the queue