Midterm Flashcards

1
Q

For loop

A

O(n)

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

Addition/subtraction

A

O(1)

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

Array List

A
  • Find an element in an array - O(n)
  • Find kth element - c
  • insertion and deletion (Worst Case) - O(n)
  • repeated insertion (Worst Case) - O(n^2)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Linked List

A
  • Find an element - O(n)
  • Find kth element - O(n)
  • insertion and deletion - c
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Binary Search Tree

A
  • O(log n)
    • Find (Worst Case) - O(log N)
    • Insert and remove - O(n)
    • Worst case - O(n)
    • BST printing - O(n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

AVL Tree

A
  • Find - O(log n)
  • Insert and delete - O(log n)
  • Print - O(n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

B-Tree

A

O(log n)

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

Priority Queues

A
  • Linked Lists
    • insert in front - O(1)
    • deleteMin - O(n)
  • Sorted Linked Lists
    • insertion - o(n)
    • deleteMin - O(1)
  • BST
    • Insert/delete - O(log n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Binary Heap

A
  • O(n)
    • Worst case O(n log n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

d-Heap

A
  • insert - O(logd n)
  • deleteMin O(d logd n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Min-max Heap

A
  • Insert/delete - O(log n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Insertion Sort

A
  • Average - O(n)
  • Worst - O(n^2)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Heapsort

A
  • O(n log n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Merge Sort

A
  • O(n log n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Quick Sort

A
  • Average - O(n log n)
  • Worst - O(n^2)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Radix Sort

A
  • Best: O(n)
  • Worst O(n^2)
17
Q

Topological ordering algorithm

A

O(n^2)
O(|E| + |V|)

18
Q

Dijkstra’s Algorithm

A

O(N^2 + |E|)

19
Q

Ford-Fulkerson’s Algorithms

20
Q

Minimum spanning tree
- Kruskal’s algorithm
- Prim’s algorithm

A

O(E log V)
O(V^2)

21
Q

Breadth-First Search
Depth-First Search