CPSC 211, Sections : Data Structures and Implementations, Honors Final Exam May 4, 2001

Similar documents
CPSC 311: Analysis of Algorithms (Honors) Exam 1 October 11, 2002

CSE 332 Spring 2013: Midterm Exam (closed book, closed notes, no calculators)

Computer Science Foundation Exam

Computer Science Foundation Exam

Computer Science Foundation Exam

CS171 Midterm Exam. October 29, Name:

Introduction to Algorithms October 12, 2005 Massachusetts Institute of Technology Professors Erik D. Demaine and Charles E. Leiserson Quiz 1.

CSE 332 Spring 2014: Midterm Exam (closed book, closed notes, no calculators)

Computer Science E-22 Practice Final Exam

Faculty of Science FINAL EXAMINATION COMP-250 A Introduction to Computer Science School of Computer Science, McGill University

CS 61B Summer 2005 (Porter) Midterm 2 July 21, SOLUTIONS. Do not open until told to begin

Computer Science Foundation Exam

Instructions. Definitions. Name: CMSC 341 Fall Question Points I. /12 II. /30 III. /10 IV. /12 V. /12 VI. /12 VII.

CSE 373 Spring 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)

CS134 Spring 2005 Final Exam Mon. June. 20, 2005 Signature: Question # Out Of Marks Marker Total

CS171 Final Practice Exam

CS 2150 Final Exam, Spring 2018 Page 1 of 10 UVa userid:

CSE 332 Autumn 2013: Midterm Exam (closed book, closed notes, no calculators)

CPSC 331 Term Test #2 March 26, 2007

ECE 2035 A Programming HW/SW Systems Spring problems, 5 pages Exam Three 13 April Your Name (please print clearly)

CSE373 Fall 2013, Midterm Examination October 18, 2013

CS 216 Fall 2007 Final Exam Page 1 of 10 Name: ID:

CS171 Final Practice Exam

CSL 201 Data Structures Mid-Semester Exam minutes

2016 Spring COP 3502 Final Exam. Date: 4/28/2016. Name:

CSE373 Winter 2014, Midterm Examination January 29, 2014

CSE332 Summer 2010: Midterm Exam Sample Solutions

CS 112 Final May 8, 2008 (Lightly edited for 2012 Practice) Name: BU ID: Instructions

CSE 332 Winter 2015: Midterm Exam (closed book, closed notes, no calculators)

CSCE 2014 Final Exam Spring Version A

Computer Science Spring 2005 Final Examination, May 12, 2005

COMP 250 Midterm #2 March 11 th 2013

AP Computer Science 4325

PROBLEM 1 : (And the winner is...(12 points)) Assume you are considering the implementation of a priority queue that will always give you the smallest

University of Waterloo Department of Electrical and Computer Engineering ECE250 Algorithms and Data Structures Fall 2014

COS 226 Algorithms and Data Structures Fall Midterm

CLO Assessment CLO1 Q1(10) CLO2 Q2 (10) CLO3 Q4 (10) CLO4 Q3a (4)

Computer Science 302 Spring 2007 Practice Final Examination: Part I

University of Toronto Department of Electrical and Computer Engineering. Midterm Examination. ECE 345 Algorithms and Data Structures Fall 2012

Section 1: True / False (2 points each, 30 pts total)

MCS 360 Exam 2 11 November In order to get full credit, you need to show your work.

1. Attempt any three of the following: 15

You must include this cover sheet. Either type up the assignment using theory5.tex, or print out this PDF.

ASSIGNMENTS. Progra m Outcom e. Chapter Q. No. Outcom e (CO) I 1 If f(n) = Θ(g(n)) and g(n)= Θ(h(n)), then proof that h(n) = Θ(f(n))

Computer Science Foundation Exam

Computer Science Foundation Exam

CSE 373 Autumn 2010: Midterm #1 (closed book, closed notes, NO calculators allowed)

Final Exam in Algorithms and Data Structures 1 (1DL210)

Computer Science Foundation Exam

CSE373 Fall 2013, Final Examination December 10, 2013 Please do not turn the page until the bell rings.

CSE 332, Spring 2010, Midterm Examination 30 April 2010

~UTS UNIVERSITY OF TECHNOLOGY SYDNEY

CS 216 Exam 1 Fall SOLUTION

Computer Science Foundation Exam

University of Illinois at Urbana-Champaign Department of Computer Science. Final Examination

Section I B COMPUTER SCIENCE SOLUTION

UNIVERSITY REGULATIONS

CS 112 Final May 8, 2008 (Lightly edited for 2011 Practice) Name: BU ID: Instructions GOOD LUCK!

Total Score /1 /20 /41 /15 /23 Grader

INSTITUTE OF AERONAUTICAL ENGINEERING

Computer Science Foundation Exam

C0MP1921/2011/2091 SAMPLE Final Exam Data Structures and Algorithms/Data Organisation/Computing 2

CS210 (161) with Dr. Basit Qureshi Final Exam Weight 40%

Cornell University Computer Science 211 Second Preliminary Examination 18 April 2006

CSE332 Summer 2010: Final Exam

CS251-SE1. Midterm 2. Tuesday 11/1 8:00pm 9:00pm. There are 16 multiple-choice questions and 6 essay questions.

Final Examination CSE 100 UCSD (Practice)

University of Maryland College Park Dept of Computer Science

ECE242 Data Structures and Algorithms Fall 2008

CSE 373 Winter 2009: Midterm #1 (closed book, closed notes, NO calculators allowed)

ECE 2035 Programming HW/SW Systems Fall problems, 5 pages Exam Three 28 November 2012

Q1 Q2 Q3 Q4 Q5 Q6 Total

Computer Science Foundation Exam. May 6, Computer Science. Section 1A. No Calculators! KEY. Score: 50

UNIVERSITY REGULATIONS

ECE250: Algorithms and Data Structures Midterm Review

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

COS 226 Midterm Exam, Spring 2009

Exam Datenstrukturen und Algorithmen D-INFK

ECE 2035 Programming HW/SW Systems Fall problems, 5 pages Exam Three 19 November 2014

Computer Science Foundation Exam

University of Illinois at Urbana-Champaign Department of Computer Science. Final Examination

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid

CSCE 210/2201 Data Structures and Algorithms. Prof. Amr Goneid. Fall 2018

Princeton University Computer Science COS226: Data Structures and Algorithms. Midterm, Fall 2013

CSCI-1200 Data Structures Fall 2017 Lecture 7 Order Notation & Basic Recursion

Csci 102: Sample Exam

University of Washington EE 472: Microcomputer Systems Exam Autumn 2015

Computer Science 302 Spring 2017 (Practice for) Final Examination, May 10, 2017

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

CSE wi: Practice Midterm

1. [1 pt] What is the solution to the recurrence T(n) = 2T(n-1) + 1, T(1) = 1

PROBLEM 1 : (Short Answer: 13 points) Three points each, except for last two which are two points 1. Both bubble-sort and selection sort are O(n 2 ) s

COP 3502 (Computer Science I) Final Exam 12/10/2015. Last Name:, First Name:

Test #2. Login: 2 PROBLEM 1 : (Balance (6points)) Insert the following elements into an AVL tree. Make sure you show the tree before and after each ro

BRONX COMMUNITY COLLEGE of the City University of New York DEPARTMENT OF MATHEMATICS AND COMPUTER SCIENCE. Sample Final Exam

CS300 Final Review Questions 1

CSE Data Structures and Introduction to Algorithms... In Java! Instructor: Fei Wang. Mid-Term Exam. CSE2100 DS & Algorithms 1

Section 05: Midterm Review

CSE373: Data Structures & Algorithms Lecture 28: Final review and class wrap-up. Nicki Dell Spring 2014

CSE 373 Autumn 2012: Midterm #2 (closed book, closed notes, NO calculators allowed)

Transcription:

CPSC 211, Sections 201 203: Data Structures and Implementations, Honors Final Exam May 4, 2001 Name: Section: Instructions: 1. This is a closed book exam. Do not use any notes or books. Do not confer with any other student. 2. Show your work. Partial credit will be given. Grading will be based on correctness, clarity and neatness. Clearly state any assumptions you make they should be reasonable! 3. I suggest that you read the whole exam before beginning to work any problem. Budget your time wisely according to the point distribution. 4. There are 7 questions worth a total of 100 points, on 9 pages (including this page). DO NOT BEGIN THE EXAM UNTIL INSTRUCTED TO DO SO. GOOD LUCK! 1

1. (16 pts total) Short answer. (a) (2 pts) What is the asymptotic (big-oh notation) worst-case time complexity of the mergesort algorithm? (b) (2 pts) What is the asymptotic (big-oh notation) worst-case time complexity of the sorting problem? (c) (2 pts) Name two benefits of object-oriented software engineering. (d) (2 pts) How does iterative prototyping contribute to developing good software? (e) (2 pts) When using depth-first search to search the state space of a production system, how is the decision made as to where to continue the search? (f) (2 pts) What is serializability for database management systems? (g) (2 pts) What is the purpose of the two-phase locking algorithm in a DBMS and what is one of its drawbacks? (h) (2 pts) True or False: Every mathematical function from the natural numbers (0, 1, 2,... ) to the natural numbers can be computed with a Java program. 2

2. (10 pts total) Draw the memory diagram (stack and heap) after the following C code fragment executes: typedef enum {FALSE, TRUE} Bool; typedef struct { int location; Bool visited[10]; Bool counting; int count; } Token; Token maintoken; Token* backuptokens = (Token*) malloc(sizeof(token)*4); maintoken.location = 0; maintoken.visited[0] = TRUE; maintoken.counting = FALSE; maintoken.count = 0; backuptokens[0] = maintoken; backuptokens[1].location = 8; backuptokens[1].visited[1] = TRUE; backuptokens[1].counting = FALSE; backuptokens[1].count = 0; 3

3. (14 pts total) Suppose you have a linked list in which each list node contains an integer and a link to the next node. refers to the first node, or is null if there isn t one. Write a recursive method (or methods) to calculate the sum of the integers in the top level call. You may use either Java or C.. Be sure to indicate 4

4. (20 pts total) Draw the result of inserting the following sequence of numbers into the following data structures: 20, 30, 10, 15, 25, 35, 19, 18, 22, 33. (a) (3 pts) binary min heap (b) (3 pts) binary search tree (c) (3 pts) hash table of size with chaining, where the hash function is (d) (3 pts) hash table of size with double hashing, where and 5

(e) (2 pts) What is the worst-case running time for insert in a binary min heap containing big-oh notation. Explain your answer. keys? Use (f) (2 pts) What is the worst-case running time for insert in a binary search tree containing big-oh notation. Explain your answer. keys? Use (g) (2 pts) What is the average-case running time for insert in a hash table of size containing keys, when collisions are resolved with chaining? Use big-oh notation. Explain your answer. (h) (2 pts) Under what circumstances is the running time from part (g) constant? 6

5. (16 pts total) Deletions. (a) (4 pts) Draw the result of doing five deletes from this binary min heap: (b) (4 pts) Draw the result of deleting the following sequence of keys from this binary search tree: 8, 4, 12, 11, 5 (c) (4 pts) What is the worst-case running time for delete in a binary min heap containing big-oh notation. Explain your answer. keys? Use (d) (4 pts) What is the worst-case running time for delete in a binary search tree containing Use big-oh notation. Explain your answer. keys? 7

6. (12 pts total) ADTs. (a) (4 pts) Explain how you could implement the Stack ADT (with push and pop operations) with one (or more) binary search trees (with the usual operations, including insert and delete). (b) (4 pts) What are the asymptotic worst-case running times for your push and pop operations, when there are keys in the stack? (c) (4 pts) What are the advantages and disadvantages of implementing a stack this way? Is it a good idea overall? 8

7. (12 pts total) You are to design a software system to support a hospital emergency room. When a patient comes to the emergency room, a nurse assigns a priority number to the patient, depending on how sick s/he is. Patients are seen by doctors in order of priority (sickest first). The software is used to enter information about each new patient and to decide who is the next patient to be seen by a doctor. (a) (6 pts) What data structure would you suggest using to store the information about the patients in the waiting room? Explain your answer and include time performance considerations in your answer. (b) (6 pts) Now suppose that the software should also be able to list all the waiting patients in order of their priorities. Does this change your answer from part (a), and if so how? Explain your answer. 9