1 / 34

Exam 2 Review

Exam 2 Review. Teams. Brian S, Peter T, Rex, Brian H George, Daniel S, Fritz, Kristen Gavan, Asher, Peter D, Spencer Dan M, Emma, Dillon, Emily Kaylin , Colin, Jerry, Alex S Chad, Sam, Matt B, Seth Matt M, Heather, James, Alex D. 1.

les
Download Presentation

Exam 2 Review

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Exam 2 Review

  2. Teams • Brian S, Peter T, Rex, Brian H • George, Daniel S, Fritz, Kristen • Gavan, Asher, Peter D, Spencer • Dan M, Emma, Dillon, Emily • Kaylin, Colin, Jerry, Alex S • Chad, Sam, Matt B, Seth • Matt M, Heather, James, Alex D

  3. 1. • A sort whose main operation is finding whether or not 2 elements are <, >, or = is called…

  4. 2. • A sort in which equal elements stay in their original order is called…

  5. 3. • What does it mean for a sort to be in-place?

  6. 4. • What is the worst case running time of Bucket sort? When does it happen?

  7. 5. • What is the worst-case running time for quicksort? When does that happen?

  8. 6. • What are the two schemes for storing edges?

  9. 7. • What is the running time of depth-first search?

  10. 8. • When would I prefer to use breadth-first rather than depth-first search?

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

  12. 10. • How do you perform a topological sort?

  13. 11. • How can you tell if a graph is connected?

  14. 12. • A connected, acyclic graph is called …

  15. 13. • The two algorithms that compute MSTs are

  16. 14. • When is Dijkstra’s not used for computing shortest paths?

  17. 15. • What shortest-path algorithm should be used if there are negative weights in the graph?

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

  19. 17. • What is the running time of count sort?

  20. 18. • What paradigm of problem-solving is Huffman’s encoding scheme?

  21. 19. • When would you prefer insertion sort rather than quicksort?

  22. 20. • Quicksort’s Recurrence Relation is: • T(n) = 2T(n/2) + n • Where does the n term come from?

  23. 21. • What is the running time of radix sort?

  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 makes an algorithm “greedy”? Give an example.

  27. 25. • Which sort has its best case when it is in reverse order?

  28. 26. • What is the running time of Kruskal’s?

  29. 27. • What properties of a graph are necessary for running Prim’s algorithm?

  30. 28. • You are watching a sorting animation for linear sorts. What do you look for to distinguish bucket sort from other linear sorts?

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

  32. All-Play • Use both Kruskal’s and Prim’s to calculate MSTs. Use alphabetical order for Prim’s. 3 2 1 D A B C 6 2 8 4 4 1 6 E F G H 1 1 5

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

  34. All-play • Suppose symbols a, b, c, d, and e occur with frequency 3/9, 2/9, 2/9, 1/9, 1/9. What is the huffman encoding of the symbols?

More Related