Technology Questions Flashcards
binary tree
structure where each node has 2 subnodes
Linked list
Each link has a value and a pointer to the next thing in the list. Generally bad to have cycles. O(n) time to find stuff.
Stack
Data is pushed to the top of the stack and popped off the stack.
LIFO - last in first out
Inserting and removing is (1)
Queue
Opposite of stack
LIFO - Last in first out
Inserting and removing is O(1)
Merge Sort
Splits array into 2 smaller arrays, then when it gets to the leaf of a binary tree, sorts leaves. Then recursively floats the solution to the top
It’s O(n log(n)) in average and worst case
Quick sort
With array, pick random pivot number. Move things lower than pivot to the left and things more than pivot to the right. Recursively do the same to each subset group.
Binary search
For sorted arrays, finding a particular value. Looks at midpoint, then midpoint of left or right, etc
Takes O(log n) time
Graph search
depth first - Searches branches 100% before backing out and taking another path
Bredth first search - Go wide before going deep
Need to be careful of cycles and unconnected graphs