DSA Flashcards
Which data structures support random access?
Arrays (no order), ArrayLists (no order), ArrayLists (ordered)
Which data structures do not support random access?
LinkedLists (ordered and unordered), Stacks, Queues, Binary Trees, HashSets, Heaps
What is the BigO notation for adding items to a Binary Tree
O(logn)
Type of Ordering for an Array (no order)
None
Type of Ordering for an ArrayList (no order)
None
Type of Ordering for an ArrayList (ordered)
User Defined
Type of Ordering for a LinkedList (no order)
None
Type of Ordering for a LinkedList (ordered)
User defined
Type of Ordering for a Stack
Data Structure defined (LIFO)
Type of Ordering for a Queue
Data Structure defined (FIFO)
Type of Ordering for a Binary Tree
User defined
Type of Ordering for a HashSet
None
Type of Ordering for a Heap
User defined for the Top only
What type of search is supported for Arrays (no order? What is the BigO?
Type: Linear BigO: O(n) - iterates through every element until you find what you are looking for
What type of search is supported for ArrayLists (no order) ? What is the BigO?
Type: Linear BigO: O(n) - iterates through every element until you find what you are looking for
What type of search is supported for ArrayLists (ordered) ? What is the BigO?
Type: Binary BigO: O(logN) - it divides the search in half with each iteration
What type of search is supported for LinkedLists (no order) ? What is the BigO?
Type: Linear BigO: O(n) - iterates through every element until you find what you are looking for
What type of search is supported for LinkedLists (ordered) ? What is the BigO?
Type: Linear BigO: O(n) - iterates through every element until you find what you are looking for
What type of search is supported for Stacks ? What is the BigO?
Type: Search is not supported. You can only look at the top of the Stack.
What type of search is supported for Queues? What is the BigO?
Type: Search is not supported. You can only look at the front of the Queue.
What type of search is supported for Binary Trees? What is the BigO?
Type: Binary BigO: O(logN) - it divides the search in half with each iteration
What type of search is supported for HashSets? What is the BigO?
Type: Lookup BigO: O(1) - it goes straight to the bucket and looks only in that bucket