

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A practice final exam for a computer science course focusing on data structures and algorithms. The exam covers various topics including class programs, trees (avl, splay, b-trees, skip lists), hash tables (linear probing, quadratic probing, double hashing, extendible hashes), priority queues (binary heap, leftist heap, skew heap, binomial queues), sorting algorithms (shellsort, heapsort, quicksort, radix sort), and graph theory. Students are required to show the intermediate steps and results of operations for each problem.
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


ECS 60 Practice Final
insert 21 3 insert 22 insert 4 insert 0 insert 1 delete 0 insert 34 5 Priority Queues (25 points) Possible priority queues are binary heap, leftist heap, skew heap, and binomial queues. For each of the following binary heaps, show the state of heap after operation specified. Insert(20) 8 28 64 37 59 87 69 43 76 66 DeleteMin() 8 28 64 37 59 87 69 43 76 66 6 Sorting I (25 points) Possible sorts are shellsort, heapsort, quicksort, and radix sort. For Hibbard's increments of 1,3,7, …, 2k^ -1, show the state of the array during a Shellsort. Fill in the increment for each row. There may be more rows than needed.
Increment 9 18 4 83 6 59 12 22 3 35 67 16 7 44 1 7 Sorting II (25 points) QuickSort. Sort the following array using a Median of Three and a cutoff of three (series of three will just use insertion sort with no pivot). Place the pivot in the next to last position and the largest of the three in the to last position. Do not find the largest element and do not put it at then end. You may use rows for intermediate steps, but circle each pivot when it is first placed in its correct (“golden”) position. Intermediate steps will not be graded. Only those lines with new circled pivots will be graded. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5A 9 5B 4 11 8 12 7 10 13 6 1 5C 3 2 8 Graph I(25 points) There will be three graph problems. See the practice midterm for examples of all the possible formats. 9 Graph II (25 points) 10 Graph III(25 points) 11 ADT design (75 points) Please note that this problem does not reflect reality. It is just an ECS 10 problem placed within a familiar context. Pacific Bell has a huge network of wires with which to connect each phone call within the 530 area code. We are only concerned with calls between different cities within the 530 area code. For each call, the routing program has three tasks: 1) it must find an available route from the source city to the destination city; 2) it must update its data structures so that they accurately reflect assigned paths; and 3) when the call is done, the program should update its data structures so that route is now freed for other calls. Describe and justify your choices of data structure(s) and routine(s) that you would use to implement the routing program. Be sure to describe your three operations, including their time complexity. You may assume the following: There are 300 cities in the 530 area code. Each city has one central location for all its routing switches. There are never more than 1,000,000 intercity calls at one time. The first three digits of a phone number are called a prefix. Phones with same prefixes are all in the same city. A "trunk line" connects one city to exactly one other city. Each trunk line can handle 100,000 calls at a time. The trunk lines rarely reach capacity. Each city is directly connected through trunk lines to five other cities. There is one computer that determines the route for all calls. The computer has 256M of RAM. It need not determine the specific wire to use for a connection; it need only determine the route.