Intro to Data Structures Flashcards
Arrays
A basic data structure with homogeneous data types referenced by index, contiguous locations
Arrays; Ordering:
sequential
Array: Big O notation
O(1) for accessing
O(n) for searching
O(n) for insertion and deletion
O(log n) for binary searching
Linked-List: Single-Linked List
each node points to the next node. Tail points to null
Linked-List: Double-Linked List
Each node points to the next and previous node. Head points to null and next, Tail points to previous and null.
Linked-List: Circle-Linked List
The tail points to the head, closes the loop
Linked-List Big O notation
O(n) for accessing
O(n) for searching
O(1) for insertion
O(1) for deletion
Stack:
Containers of “objects” that are inserted and removed according to LIFO
Stack Operations
Pull= inserting object to the top of the stack
Pop= remove from the stack and return the top object to the stack
empty()= returns true if empty
peek()= returns element on top of stack without removing it
search()= searches for elements in the stack
Stack Big O notation
O(n) for accessing
O(n) for search
O(1) for insertion
O(1) for deletion
Queues
Cousins of Stacks
Containers of “objects” that are inserted and deleted according to FIFO
Queues: Operations
poll() remove() peek() element() offer()
Queues: Big O notation
O(n) for accessing
O(n) for searching
O(1) for insertion
O(1) for deletion
Tree
A non-linear data structure where the objects are organised in terms of hierarchical relationships