Exam 2 Cram

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/22

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

23 Terms

1
New cards

BST add()

Average and Best: O(log n)
Worst: O(n)

2
New cards

BST remove()

Average and Best: O(log n)
Worst: O(n)

3
New cards

BST search()

Average and Best: O(log n)
Worst: O(n)

4
New cards

BST height()

Average and Best: O(log n)
Worst: O(n)

5
New cards

Heap insert()

Always O(log n)

6
New cards

Heap remove():

Always O(log n)

7
New cards

Heap heapify()

O(log n) for the first element; O(n) for the full heap

8
New cards

Heap BuildHeap():

O(n) always

9
New cards

AVL add()

O(log n) always

10
New cards

AVL Remove()

O(log n) always

11
New cards

AVL search()

O(log n) always

12
New cards

AVL rotation() and height()

O(1) always

13
New cards

AVL traversal

O(n) always

14
New cards

2-4 Tree Add()

Always O(log n)

15
New cards

2-4 Tree Remove()

Always O(log n)

16
New cards

2-4 Tree search() and height() and promote()

O(log n) always for all three

17
New cards

HashMap put()

Best and Average: O(1)
Worst: O(n)

18
New cards

HashMap get()

Best and Average O(1):
Worst: O(n)

19
New cards

HashMap remove()

Best and Average O(1):
Worst: O(n)

20
New cards

HashMap (external chain is SLL):

add(): O(1) or O(n) depending on if you need to search a list for duplicates or just add at the head
remove(): O(1) if just one element in a bucket, O(n) if more
get(): O(1) if just one element, O(n) if more

21
New cards

HashMap (external chain is BST):

add(): O(log n), unless degen then O(n)
remove(): O(log n) if balanced; O(n) if unbalanced as height is linear
get(): O(log n) if balanced; O(n) if unbalanced as height is linear

22
New cards

HashMap (external chain is AVL):

O(log n) for all cases of add, remove, and get

23
New cards

SkipList

O(log n) always for add removal and search if its a fair coin
O(n) if its not