Array Flashcards
What is an Array
An array is a linear data structure that has a fixed size and has elements stored in it.
What are the pros of an array?
- Random index access in constant time
What are the cons of an array?
- Fixed size
- Search, Insertion and Deletion are in linear time
What is a Linked List
A linked list are nodes, that contain a piece of data, that reference to the next node on the list
What are the pros of a linked list?
- Insertion and Deletion are in constant time
- Dynamic Size
- No limit to size of linked list
What are the cons of a linked list?
- Search in linked list are in linear time
- Additional memory for pointer.
What is a stack?
A stack is a linear data structure that is optimized for LIFO (Last In, First Out)
What are the pros of stack?
- Insertion and Deletion are in constant time
What are the cons of stack?
- Search in linear time
- If you needed to get the first item, then don’t use this.
What is queue?
A queue is a linear data structure that is optimized for FIFO (First In, First Out)
What are the pros of queue?
- Insertion and Deletion are in constant time.
- Search is in Linear time