Download presentation
Presentation is loading. Please wait.
Published byGarey Cole Modified over 9 years ago
1
l Please get a complete set (brown, green, red and yellow) of colored paper from the front.
2
CS 61BL Final Review Data Structures Colleen Lewis, Kaushik Iyer, Jonathan Kotker, David Zeng, George Wang
3
Topics of Emphasis (not exhaustive) Java Public Private Pass by Value / Class Encap Overriding Iterator Inheritance Wrapper Exceptions Commenting Testing Recusion / Iteration
4
Topics of Emphasis (not exhaustive) Data Structures Hash Tables Array / Linked List Destructive / Non-Destructive Graphs List/Matrix Priority Queue / Heap Bottom Up Heap Stack Queues Trees BST AVLTree
5
Topics of Emphasis (not exhaustive) Sorting / Algorithms Dijkstras Topological Sort Binary Search Bubble Insert Selection Merge Quick
6
How long does it take to determine if an undirected graph contains a vertex that is connected to no other vertices if you use an adjacency matrix? Option A: V+E Option B: V^2 Option C: VE Option D: V
7
How long does it take to determine if an undirected graph contains a vertex that is connected to no other vertices if you use an adjacency matrix? Option A: V+E Option B: V^2 Option C: VE Option D: V
8
How long does it take to determine if an undirected graph contains a vertex that is connected to no other vertices if you use an adjacency LIST? Option A: V+E Option B: V^2 Option C: VE Option D: V
9
How long does it take to determine if an undirected graph contains a vertex that is connected to no other vertices if you use an adjacency LIST? Option A: V+E Option B: V^2 Option C: VE Option D: V
10
What is the Topological Sort? Option A: B E A C D Option B: B A E C D Option C: B A C E D Option D: Other
11
What is the Topological Sort? Option A: B E A C D Option B: B A E C D Option C: B A C E D Option D: Other
12
What is the Dijkstra’s order it visits nodes, and distances from B? Option A: BADCE Option B: BDACE Option C: BEACD Option D: BACDE
13
What is the Dijkstra’s order it visits nodes, and distances from B? Option A: BADCE Option B: BDACE Option C: BEACD Option D: BACDE
14
Apply the Radix sort algorithm on the following list of English words: COW, DOG, SEA, RUG, ROW, MOB, BOX, TAB, BAR, EAR, TAR, DIG, BIG, TEA, NOW, FOX. Show the following in Order Option A: COW, DOG, SEA, RUG, ROW, MOB, BOX, TAB, BAR, EAR, TAR, DIG, BIG, TEA, NOW, FOX Option B: SEA TEA MOB TAB DOG RUG DIG BIG BAR EAR TAR COW ROW NOW BOX FOX Option C: TAB BAR EAR TAR TEA SEA BIG DIG MOB DOG COW ROW NOW BOX FOX RUG Option D: BAR BIG BOX COW DIG DOG EAR FOX MOB NOW ROW RUG SEA TAB TAR TEA
15
Apply the Radix sort algorithm on the following list of English words: COW, DOG, SEA, RUG, ROW, MOB, BOX, TAB, BAR, EAR, TAR, DIG, BIG, TEA, NOW, FOX. Show the following in Order: ABCD Option A: COW, DOG, SEA, RUG, ROW, MOB, BOX, TAB, BAR, EAR, TAR, DIG, BIG, TEA, NOW, FOX Option B: SEA TEA MOB TAB DOG RUG DIG BIG BAR EAR TAR COW ROW NOW BOX FOX Option C: TAB BAR EAR TAR TEA SEA BIG DIG MOB DOG COW ROW NOW BOX FOX RUG Option D: BAR BIG BOX COW DIG DOG EAR FOX MOB NOW ROW RUG SEA TAB TAR TEA
16
After a few iterations of some sort, this is what we have so far. Which? 123657984 Option A: Insertion Sort / Selection Option B: Quick Sort Option C: Merge Sort Option D: Heap Sort
17
After a few iterations of some sort, this is what we have so far. Which? 123657984 Option A: Insertion Sort / Selection Option B: Quick Sort Option C: Merge Sort Option D: Heap Sort
18
After a few iterations of some sort, this is what we have so far. Which? 278913568 Option A: Insertion Sort / Selection Option B: Quick Sort Option C: Merge Sort Option D: Heap Sort
19
After a few iterations of some sort, this is what we have so far. Which? 278913568 Option A: Insertion Sort / Selection Option B: Quick Sort Option C: Merge Sort Option D: Heap Sort
20
After a few iterations of some sort, this is what we have so far. Which? 531268789 Option A: Insertion Sort / Selection Option B: Quick Sort Option C: Merge Sort Option D: Heap Sort
21
After a few iterations of some sort, this is what we have so far. Which? 278913568 Option A: Insertion Sort / Selection Option B: Quick Sort Option C: Merge Sort Option D: Heap Sort
22
After a few iterations of some sort, this is what we have so far. Which? 531268789 Option A: Insertion Sort / Selection Option B: Quick Sort Option C: Merge Sort Option D: Heap Sort
23
After a few iterations of some sort, this is what we have so far. Which? 278913568 Option A: Insertion Sort / Selection Option B: Quick Sort Option C: Merge Sort Option D: Heap Sort
24
An undirected graph contains a "cycle" (i.e., loop) if there are two different simple paths by which we can get from one vertex to another. Using your favorite graph traversal algorithm, how can we tell if an undirected graph contains a cycle?
25
For the following list of numbers, run the following sorting algorithms: 6 5 4 2 8 3 1 0 9 7 As an example, here’s Selection Sort: 6 5 4 2 8 3 1 0 7 9 6 5 4 2 3 1 0 7 8 9 5 4 2 3 1 0 6 7 8 9 4 2 3 1 0 5 6 7 8 9 2 3 1 0 4 5 6 7 8 9 2 1 0 3 4 5 6 7 8 9 1 0 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 Radix Heap Sort Quick Sort (Pick a random pivot) Merge Sort Insertion Sort
26
Recall that an undirected graph is "connected" if there is a path from any vertex to any other vertex. If an undirected graph is not connected, it has multiple connected components. A connected component" consists of all the vertices reachable from a given vertex, and the edges incident on those vertices. Suggest an algorithm based on DFS (possibly multiple invocations of DFS) that counts the number of connected components in a graph.
27
Code a ‘contains’ method for a Priority Queue implemented as a MinHeap that requires the fewest number of comparisons possible. We don’t mean asymptotically, we mean the absolute fewest comparisons possible. For sake of simplicity, assume the array-based implementation of minHeap, where the first element occurs at index 1. Assume it is represented as the following: int[] heap = new int[n]; //n is the size of the heap
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.