That Stuff Flashcards

1
Q

Binary trees
BST
AVL

A

- 2 children
- Left < x < Right
- Height Limit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Depth

A

Top down

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Height

A

Bottom up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Single Rotation

A

Move subtree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Double rotation

A
  • X and grandchild
  • X and child
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

B Trees

A

- Path is like streets to data
- Data is in leaves
- O(N log N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Load Factor

A

- # of Items / Table Size
- O(N/M)
- Rehash if λ >= 3/4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Binary Heap / Priority Queue

A

- A full binary tree
- [2i] - [i/2] - [2i+1]
-perlocateDown

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

d Heaps

A

-Heap with d children
- Insert O(log_d N)
- Delete d-1 comparions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Merge Heaps Types

A

Leftist < Skew < Binomial

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Insertion Sort

A

- O(N) to O(N^2)
- Read i, insert, read i,…
- N < 20

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Shell Sort

A

- Long one
- Distance = Lenght/2
- O(N^3/2) to O(N^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Merge Sort

A

- Split, Combine
- O(N log N)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Quick Sort

A

- Pivot = 3 median
- Smaller < x < Larger
- O(N logN) to O(N^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Partitioning

A

Compare two outer pivots and move inwards

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Connected Graph

A

All nodes have an edge

17
Q

Adjacent Matrix

A

A[i][j]
i is adj to j
Dense graphs
Ω(V^2)

18
Q

Complete Graph

A

Every node is linked

19
Q

Vertex count

A

Directed 0 < E < V(V-1)
Undirected 0 < E < (V(V-1)) / 2
Sparse E = V
Dense E = V^2

20
Q

Adjecent List

A

Like Heap
Store undirected nodes twice
Sparse graphs
Ω(V + E)

21
Q

Topological Sort

A

- Find vertex with indegree = 0
- Print v
- Delete v + edges
- Queue children if indegree = 0

22
Q

Hamiltonian Cycle

A

Visits every vertex once

23
Q

Path Runtime

A

+ O(E logV)
- O(EV)

24
Q

P Complexity

A

Easy to solve and confirm

25
Q

NP Complexity

A

Difficult to solve, easy to confirm

26
Q

EXP Complexity

A

Difficult to solve and confirm

27
Q

B Trees
d Heaps

A

- O(N logN)
- O(log_d N)

28
Q

Insert Sort
Merge Sort
Shell Sort
Quick Sort

A

- O(N) to O(N^2)
- O(N logN)
- O(N^3/2) to O(N^2)
- O(N logN) to O(N^2)

29
Q

Adj Matrix
Adj List

A

- Ω(V^2)
- Ω(V + E)

30
Q

Path Runtime

A

+ O(E logV)
- O(EV)