CS 1332: Exam 1 Big-O Time Complexities

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

1/33

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 9:48 PM on 8/30/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

34 Terms

1
New cards

What is the worst-case time complexity of adding to a singly-linked list backed stack without a tail pointer?

O(1)

2
New cards

What is the worst-case cost of calling addToback (data) to a singly-linked list without a tail pointer?

O(1)

3
New cards

Suppose you add n elements to an array-backed stack. What is the best-case of retrieving the first element added?

O(n)

4
New cards

What is the worst-case time complexity of clearing a singly-linked list of size n with a tail pointer by calling removeFromBack() n times?

O(n^2)

5
New cards

What is the worst-case time complexity of creating a list of data of all the elements in a binary search tree from largest to smallest element?

O(n)

6
New cards

addToBack(T element), ArrayList

O(1)

7
New cards

addToFront(T element), ArrayList

O(n)

8
New cards

addAtIndex(int index, T element), ArrayList

O(n)

9
New cards

removeFromBack(), ArrayList

O(1)

10
New cards

removeFromFront(), ArrayList

O(n)

11
New cards

removeAtIndex(int index), ArrayList

O(n)

12
New cards

get(int index), ArrayList

O(1)

13
New cards

addToBack(T element), Singly-Linked List w/o tail pointer

O(n)

14
New cards

addToFront(T element), Singly-Linked List

O(1)

15
New cards

addAtIndex(int index, T element), Singly-Linked List

O(n)

16
New cards

removeFromBack(), Singly-Linked List w/ tail pointer

O(n)

17
New cards

removeFromFront(), Singly-Linked List

O(1)

18
New cards

removeAtIndex(int index), Singly-Linked List

O(n)

19
New cards

get(int index), Singly-Linked List

O(n)

20
New cards

addToBack(T element), Singly-Linked List w/ tail pointer

O(1)

21
New cards

What is the time complexity of removing the first element of an array-backed deque?

O(n)

22
New cards

What is the time complexity of computing the height of a binary search tree?

O(n)

23
New cards

What is the time complexity of accessing the largest element in a binary search tree?

O(n)

24
New cards

What is the time complexity of removing the third element from a linked-list backed stack?

O(1)

25
New cards

What is the time complexity of removing an element from a linked list-backed Queue and adding it to an array-backed Stack?

O(n)

26
New cards

What is the time complexity for buildHeap?

O(n)

27
New cards

What is the time complexity of removing a data value from a binary tree?

O(log n)

28
New cards

What is the time complexity of accessing a heap?

O(1)

29
New cards

What is the worst-case time complexity of searching an element in a Full BST?

O(n)

30
New cards

What is the worst-case time complexity of searching a complete BST?

O(log n)

31
New cards

What is the worst-case time complexity of transforming a linked list into a BST?

O(n^2)

32
New cards

What is the time complexity of preorder, postorder, inorder, and levelorder transversals?

O(n)

33
New cards

What is the time complexity to enqueue data into a full queue?

O(n)

34
New cards

What is the time complexity to enqueue data into a queue that is not full?

O(1)