Presentation is loading. Please wait.

Presentation is loading. Please wait.

Exam 2 Review. Teams David P, Sebastian, Nathan P, Harrison Scott, Josh, Patrick, Peter Michael, Alexia, Betsey, Keith Ty, Casey, Jesi, Lexa Maddie, Nathan.

Similar presentations


Presentation on theme: "Exam 2 Review. Teams David P, Sebastian, Nathan P, Harrison Scott, Josh, Patrick, Peter Michael, Alexia, Betsey, Keith Ty, Casey, Jesi, Lexa Maddie, Nathan."— Presentation transcript:

1 Exam 2 Review

2 Teams David P, Sebastian, Nathan P, Harrison Scott, Josh, Patrick, Peter Michael, Alexia, Betsey, Keith Ty, Casey, Jesi, Lexa Maddie, Nathan Y, Jen, Andrew Tanner, Sean, Ben, Eric, John, Zach, Alex M, Jake Elena, Brandon, Haris, David H

3 1. Suppose a heap has 6 nodes. What is the height of the heap? (Remember the root is at height 0).

4 2. Suppose you have a binary search tree with 6 nodes. What is the range of what the height of the tree may be?

5 3. Suppose that a hash table has 50 keys and only 10 slots. What type of hash table must it be?

6 4. Give one pro of an array over a linked list and vice versa.

7 5. When would you prefer to use a binary search tree rather than a heap?

8 6. What data structure is implemented using a heap?

9 7. What is the main operation supported by a heap?

10 8. What sort is best on small data sets?

11 9. Could this be a heap? Why or why not? 18 3 3 8 8 9 9 10 12

12 10. I’m going to empty a binary search tree by successively finding the smallest element, printing it, and then deleting it until the tree is empty. What’s the best case running time?

13 11. What are the two schemes for storing edges?

14 12. What is the running time of depth-first search?

15 13. When would I prefer to use breadth-first rather than depth-first search?

16 14. Dijkstra’s algorithm is O((V+E)(lgV)). Where does the lgV term come from?

17 15. How do you perform a topological sort?

18 16. How can you tell if an undirected graph is connected?

19 17. A connected, acyclic graph is called …

20 18. What is the running time of Count sort?

21 19. When is Dijkstra’s not used for computing shortest paths?

22 20. What does “linear probing” refer to?

23 21. Consider the adjacency matrix: Is the graph directed? Weighted? Dense or sparse? 14 3 8 3 6 3 23 0 2 4 13 21 3 5 0 14 3 8 3 6 3 23 0 2 4 13 21 3 5 0

24 22. When would you prefer to use an adjacency list rather than an adjacency matrix?

25 23. What properties of a graph are necessary for a topological sort?

26 24. What does it mean for a sort to be stable?

27 25. What does it mean for a sort to be in-place?

28 26. What is the worst case running time for Quicksort and when does it happen?

29 27. What operations should be supported by a hash table?

30 28. What is the running time for inserting or deleting from a hash table if there is a good hash function?

31 29. What is the best case running time for bubble sort? When does it happen?

32 30. When would you prefer to use a chaining table rather than an open-address table?

33 31. Which sort has its best case when it is in reverse order?

34 32. What algorithm do I use? I’m trying to quickly sort 2 million 10-digit numbers. I have plenty of space but want to save time.

35 All-Play Run Depth-First on the following graph and classify each edge: B B E E G G H H C C F F D D A A

36 All-Play Use Dijkstra’s to compute shortest paths from A. A A E E F F B B G G C C H H D D 1 1 8 6 62 1 4 4 3 2 5 1

37 Explore tells if an undirected graph is connected. Create and analyze an algorithm to tell if a directed graph is connected. boolean IS-CONNECTED(G):

38 Write and analyze an algorithm that decreases the value of an element in a heap. Use known heap functions. What is the running time? DECREASE_KEY(Heap H, KeyIndex K, Integer Amt):

39 Write and analyze an algorithm that computes the height of a BST rooted at N left(N) gives the left node of N and right(N) gives the right. int HEIGHT(BST N):


Download ppt "Exam 2 Review. Teams David P, Sebastian, Nathan P, Harrison Scott, Josh, Patrick, Peter Michael, Alexia, Betsey, Keith Ty, Casey, Jesi, Lexa Maddie, Nathan."

Similar presentations


Ads by Google