Discussion 12
CS 61B
Spring 2015
1 Quicksort
(a) Sort the following unordered list using quicksort. Assume that the pivot you use is always
the rst element. Show the steps taken at each partitioning step.
34, 25, 82, 34, 28, 16, 75, 96
28 25 16 | 34 34 |
CS 61B
Discussion 13
Spring 2015
1 Graph Representations
For the graph above, draw the adjacency list and adjacency matrix representation.
2 DFS and BFS
Give the DFS Preorder, DFS Postorder, and BFS order of the graph starting from vertex A. Whenever ther
UC Berkeley Computer Science
CS61B: Data Structures
Midterm #1, Spring 2015
This test has 9 questions worth a total of 35 points. The exam is closed book, except that you are
allowed to use a one page written cheat sheet. No calculators or other electroni
CS61B Spring 2015 Guerrilla Section 1 Worksheet
SOLUTIONS
Leo Colobong, Nick Fong, Jasmine Giang, Andrew Huang, Yujie Huang, Nick Rose,
Khalid Shakur, Jason Won
15 February 2015
Directions: In groups of 4-5, work on the following exercises. Do not proceed
1. Basic Operations (6 Points).
a. To the right of the BST below, draw a BST that results if we delete 20 from the BST. You should
use the deletion procedure discussed in class (i.e. no more than 4 references should change). Either of
the two trees in red
CS61B Spring 2015 Guerrilla Section 2 Worksheet
SOLUTIONS
Akhil Batra, Leo Colobong, Nick Fong, Jasmine Giang, Laura Harker, Anusha Ramakuri,
Charles Zhang, Jason Zhang, Giulio Zhou
14 March 2015
Directions: In groups of 4-5, work on the following exercis
CS61B Spring 2015 Guerrilla Section 3 Worksheet
SOLUTIONS
Leo Colobong, Nick Fong, Jasmine Giang, Laura Harker, Yujie Huang, Anusha Ramakuri,
Nick Rose, Khalid Shakur, Jason Won, Fan Ye, Jason Zhang, Giulio Zhou
7 May 2015
Directions: In groups of 4-5, wo
Discussion 8
CS 61B
Spring 2015
1 Conceptual Check
Order the following big-O runtimes from most to least efcient:
O(n log n), O(1), O(2n ), O(n2 ), O(log n), O(n), O(n!)
O(1) O(logn) O(n) O(nlogn) O(n2 ) O(2n ) O(n!)
Are the statements in the right column
Discussion 9
CS 61B
Spring 2015
1 2-3-4 Tree Insertion and Deletion
Given the following 2-3 tree, draw what the tree would look like after inserting 18.
Original tree:
[8]
/
\
[6]
[14]
/
\
/
\
[3] [7] [10] [15, 16]
After inserting 18:
[8]
/
\
[6]
[14, 16]
Discussion 11
CS 61B
Spring 2015
1 Sorting I
Show the steps taken by each sort on the following unordered list:
106, 351, 214, 873, 615, 172, 333, 564
(a) Insertion sort. Show the sorted and unsorted portions at every step.
106
106
106
106
106
106
106
106
UNIVERSITY OF CALIFORNIA
Department of Electrical Engineering
and Computer Sciences
Computer Science Division
CS61B
Fall 2015
P. N. Hilnger
CS 61B: Introduction to Programming, Part II
General Course Information
Instructor:
Paul N. Hilnger, 787 Soda Hall,