Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 6 pages
Exam (elaborations)

CS 160 MIDTERM 2 EXAM |COMPLETE QUESTIONS WITH 100% RATED EXPERT SOLUTIONS |2026 LATEST UPDATED

Document preview thumbnail
Preview 2 out of 6 pages

CS 160 MIDTERM 2 EXAM |COMPLETE QUESTIONS WITH 100% RATED EXPERT SOLUTIONS |2026 LATEST UPDATED

Content preview

CS 160 MIDTERM 2 EXAM |COMPLETE QUESTIONS WITH 100% RATED EXPERT

SOLUTIONS |2026 LATEST UPDATED



1. The worst-case runtime of an algorithm is _____ number of steps taken to execute a program.: maximum

2. What is the merge sort algorithm's runtime?: O(N·logN)

3. The best case runtime complexity of an algorithm that searches an array of size N is _____.: O(1)

4. he following algorithm is an example of _____. (Hint: at each level we have two recursive calls. Each recursive

call makes two additional recursive calls. Hence, the number of recursive method calls doubles at each level).


def MyMath(num) if num

<= 1 return num

return MyMath(num - 2) + MyMath(num - 1): an exponential runtime complexity

5. The Big O notation of the algorithm 7+12N+3N2 is _____.: N2

6. Given a doubly-linked list (2, 3, 4, 5, 6, 7), node 2's pointer(s) point(s) to _____.: node 3 and null

7. Replace XXX in the following function header for a doubly-linked list: ListInsertAfter(listName, currentNode,

XXX): newNode

8. A recursive algorithm is based on _____ application(s) of the same algorithm on smaller problems.: repeated

9. comparable object: capable of comparing itself with another object

10. comparator: external to the element type we are comparing and is a separate class

11. arrayList class: a resizable array which can be found in the java.util package

12. built-in array: size of array can(not) be modified: cannot

13. arrayList class: size of array can(not) be modified: can

1/6

, 14. syntax to create an ArrayList object: ArrayList<String> cars = new ArrayList<String>();

15. linkedList is ______________ to arrayList: identical

16. a stack: LIFO

17. LIFO: objects can be inserted at any time, but only the last (the most-recently inserted) object can be removed

18. pushing is synonymous with: inserting

19. popping is synonymous with: removing 20. queue: FIFO

21 FIFO: elements may be inserted at any time, but only the element which has been in the queue the longest may be

removed

22. where are elements inserted and removed in queue: inserted at the rear (enqueued)

and removed from the front (dequeued)

23. the java deque interface represents: a double ended queue 24. push(stack, x): inserts x on top of

stack.

25. Pop(stack): returns and removes item at top of stack

26. Peek(stack): returns but does not remove item at top of stack

27. Enqueue(queue, x): inserts x at the end of the queue

28. Dequeue(queue): returns and removes item at front of queue

29. Peek(queue): returns but does not remove item at the front of the queue

30. PushFront(deque, x): inserts x at the front of the deque

31. PushBack(deque, x): inserts x at the back of the deque

32. PopFront(deque): returns and removes item at front of deque

33. PopBack(deque): returns and removes item at back of deque

2/6

Document information

Uploaded on
July 18, 2026
Number of pages
6
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$22.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Henlens
5.0
(501)
Sold
2187
Followers
1
Items
507
Last sold
2 hours ago

Reviews from verified buyers



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions