Time Complexities

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/12

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:38 AM on 4/21/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

13 Terms

1
New cards

worst; logn; logn; best; 1; 1

When removing from heaps, the ________ case is O(______). This is where, after removing the root, the last element is put at the root and must bubble down ________ levels. The ________ case is O(________). This is where we only have to downheap ______ level after swapping the last element to the root

2
New cards

worst; logn; logn; worst; n; best; 1

When adding to heaps, the _________ case is O(_________)*. This is when adding a new element, it bubbles up to the root through _________ levels. The _______ case (unamortized) is O(_____). This is where we have to resize and must copy all the data to a new larger array. The _______ case is O(______). This is where the newly added data belongs in the leaf and doesn’t have to bubble up

3
New cards

n; all; nlogn; n

When performing buildHeap, the run time is O(_____) for ______ cases. Without buildHeap, the runtime is O(______) because the elements would be added one by one (which is using add() for ____ elements)

4
New cards

logn; all

When removing from an AVL, the run time is O(_________) for _______ cases

5
New cards

logn; all

When adding to an AVL, the run time is O(__________) for _______ cases

6
New cards

logn; 1; root

When searching an AVL, the average and worst cases are O(____________). The best case is O(_____) because the target value is at the _______

7
New cards

1

The run time to calculate the height of an AVL is O(________)

8
New cards

n

When doing traversals on an AVL, the run time is always O(______)

9
New cards

1

When doing rotations on an AVL, the run time is always O(________)

10
New cards

logn; all

When adding to a 2-4 Tree, the runtime is O(_______) for ______ cases

11
New cards

logn; all

When removing from a 2-4 Tree, the runtime is O(________) for _____ cases

12
New cards

logn; 1; root

When removing from a 2-4 Tree, the average and worst cases are O(________), and the best case is O(______) because the element exists in the _______ of the tree

13
New cards

logn; all

When calculating the height of a 2-4 Tree, the runtime is O(________) for ____ cases