CSE 373 Sample Midterm #2 (closed book, closed notes, calculators o.k.)

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

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

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

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

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

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

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

Chapter 6 Heaps. Introduction. Heap Model. Heap Implementation

CSE332 Summer 2010: Midterm Exam Sample Solutions

Heap Model. specialized queue required heap (priority queue) provides at least

CSE 332, Spring 2010, Midterm Examination 30 April 2010

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

Final Examination CSE 100 UCSD (Practice)

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

Cpt S 223 Fall Cpt S 223. School of EECS, WSU

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

Course Review. Cpt S 223 Fall 2010

CSE373 Fall 2013, Second Midterm Examination November 15, 2013

CSCE 2014 Final Exam Spring Version A

CSE100 Practice Final Exam Section C Fall 2015: Dec 10 th, Problem Topic Points Possible Points Earned Grader

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

Programming Abstractions

Course Review for Finals. Cpt S 223 Fall 2008

Recall: Properties of B-Trees

Binary heaps (chapters ) Leftist heaps

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

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

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

CS 3343 (Spring 2013) Exam 2

Course Review. Cpt S 223 Fall 2009

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

Solutions to Exam Data structures (X and NV)

CS171 Final Practice Exam

UNIT III BALANCED SEARCH TREES AND INDEXING

COMP 250 Midterm #2 March 11 th 2013

Practice Midterm Exam Solutions

Implementations. Priority Queues. Heaps and Heap Order. The Insert Operation CS206 CS206

Section 1: True / False (1 point each, 15 pts total)

Homework 3. Theory (50 points) Data Structures and Algorithms in JAVA Shlomo Hershkop Department of Computer Science Columbia University Summer 2002

Module Contact: Dr Geoff McKeown, CMP Copyright of the University of East Anglia Version 1

Second Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms...

1. AVL Trees (10 Points)

CS171 Final Practice Exam

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

CPSC 331 Term Test #2 March 26, 2007

COS 226 Midterm Exam, Spring 2009

Quiz 1 Practice Problems

CSL 201 Data Structures Mid-Semester Exam minutes

APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY THIRD SEMESTER B.TECH DEGREE EXAMINATION, JULY 2017 CS205: DATA STRUCTURES (CS, IT)

CSE 5311 Notes 4a: Priority Queues

Examination Questions Midterm 2

CSE373: Data Structures & Algorithms Lecture 9: Priority Queues. Aaron Bauer Winter 2014

Leftist Heaps and Skew Heaps. (Leftist Heaps and Skew Heaps) Data Structures and Programming Spring / 41

The questions will be short answer, similar to the problems you have done on the homework

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

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

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

University of Toronto Mississauga. Flip to the back cover and write down your name and student number.

Draw the resulting binary search tree. Be sure to show intermediate steps for partial credit (in case your final tree is incorrect).

York University AK/ITEC INTRODUCTION TO DATA STRUCTURES. Final Sample II. Examiner: S. Chen Duration: Three hours

Quiz 1 Practice Problems

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

Section 05: Solutions

CSE373 Fall 2013, Midterm Examination October 18, 2013

R16 SET - 1 '' ''' '' ''' Code No: R

Data Structures and Algorithm Analysis in C++

Lecture 4: Advanced Data Structures

CSE373 Winter 2014, Midterm Examination January 29, 2014

Module 2: Classical Algorithm Design Techniques

EECS 311 Data Structures Midterm Exam Don t Panic!

BINARY HEAP cs2420 Introduction to Algorithms and Data Structures Spring 2015

ECE250: Algorithms and Data Structures Midterm Review

CSCI2100B Data Structures Heaps

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

Cpt S 223 Course Overview. Cpt S 223, Fall 2007 Copyright: Washington State University

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

ECE242 Data Structures and Algorithms Fall 2008

6.006 Final Exam Name 2. Problem 1. True or False [30 points] (10 parts) For each of the following questions, circle either True, False or Unknown.

1 Format. 2 Topics Covered. 2.1 Minimal Spanning Trees. 2.2 Union Find. 2.3 Greedy. CS 124 Quiz 2 Review 3/25/18

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

Chapter 1 Introduction

CSE wi: Practice Midterm

Adam Blank Lecture 3 Winter 2017 CSE 332. Data Structures and Parallelism

Priority Queues Heaps Heapsort

CSCI-1200 Data Structures Fall 2018 Lecture 23 Priority Queues II

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Part 1: Multiple Choice Circle only ONE answer. Each multiple choice question is worth 3.5 marks.

CS 170, Spring 2000 Midterm #1 Professor M. Clancy

Second Examination Solution

CSE332 Summer 2010: Final Exam

CMSC 341 Lecture 15 Leftist Heaps

Outline Purpose Disjoint Sets Maze Generation. Disjoint Sets. Seth Long. March 24, 2010

CS 315 Data Structures Spring 2012 Final examination Total Points: 80

Elementary Data Structures 2

Heaps with merging. We can implement the other priority queue operations in terms of merging!

Binary Heaps. CSE 373 Data Structures Lecture 11

Chapter 12: Query Processing

Chapter 12: Query Processing. Chapter 12: Query Processing

CS 222/122C Fall 2016, Midterm Exam

Transcription:

Name: Email address: CSE 373 Sample Midterm #2 (closed book, closed notes, calculators o.k.) Instructions Read the directions for each question carefully before answering. We will give partial credit based on the work you write down, so show your work! Use only the data structures and algorithms we have discussed in class or which were mentioned in the book so far. Note: For questions where you are drawing pictures, please circle your final answer for any credit. There is one extra page at the end of the exam that you may use for extra space on any problem. If you detach this page it must still be turned in with your exam when you leave. Advice You have 50 minutes, do the easy questions first, and work quickly! Page 1 of 10

1) True/False. Circle True or False below. You do not need to justify your answers. a Linear probing is equivalent to double hashing with a secondary hash function of h 2 (k) = 1. True False b. If T1(N) = O(f(n)) and T2(N) = O(f(n)), then T1(N) = O(T2(N)). True False c. Building a heap from an array of N items requires Ω(N log N) time. d. Merging heaps is faster with binary heaps than with leftist or skew heaps, because we only need to concatenate the heap arrays and then run BuildHeap on the result. 2) Short Answer Problems: Be sure to answer all parts of the question!! True True False False a) Which ADT do binomial queues implement? If we forget simplicity of implementation, are they better than binary heaps? Are they better than leftist heaps? Justify your answer. b) For node i in a ThreeHeap, give formulas that calculate each of the following: (1) Node i s parent (2) Node i s three children Page 2 of 10

c) What is the main advantage that open addressing hashing techniques have over separate chaining? d) Fill in the blank in the following text to make the statement true. In the union/find data structure of N items, if we use union-by-size without path compression, then any combination of M union and/or find operations takes at most time. Page 3 of 10

3) Disjoint Sets: Consider the set of initially unrelated elements 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12. a.) Draw the final forest of up-trees that results from the following sequence of operations using on union-by-size. Break ties by keeping the first argument as the root. Union(0,2), Union(3,4), Union(9,7), Union(9,3), Union (6,8), Union(6,0), Union(12,6), Union(1,11), Union(9,6). b.) Draw the new forest of up-trees that results from doing a Find(4) with path compression on your forest of up-trees from (a). Page 4 of 10

4) Heaps a) Draw the leftist heap that results from inserting: 77, 22, 9, 68, 16, 34, 13, 8 in that order into an initially empty leftist heap. You do not need to show the array representation of the heap. You are only required to show the final heap, although if you draw intermediate heaps, please circle your final result for ANY credit. Page 5 of 10

4 (cont.) Heaps: b) Draw the leftist heap that results from doing 2 deletemins on the heap you created in part a). You are only required to show the final heap, although if you draw intermediate heaps please circle your final result for ANY credit. c) What is the null path length of the root node in the last heap you drew in part b) above? d) List 2 good reasons why you might choose to use a skew heap rather than a leftist heap. Page 6 of 10

5) Binomial Queues a) What is the minimum and maximum number of nodes in a Binomial Tree of height h? b) What is the minimum and maximum number of nodes in a Binomial Queue whose tallest tree is of height h? c) Briefly describe how Findmin() is implemented for Binomial Queues. Page 7 of 10

6) Draw the contents of the hash table in the boxes below given the following conditions: The size of the hash table is 12. Open addressing and double hashing is used to resolve collisions. The hash function used is H(k) = k mod 12 The second hash function is: H2(k) = 7 (k mod 7) What values will be in the hash table after the following sequence of insertions? Draw the values in the boxes below, and show your work for partial credit. 33, 10, 9, 13, 12, 45, 26, 17 0 1 2 3 4 5 6 7 8 9 10 11 Page 8 of 10

7) Memory a) Define spatial locality. b) Give an example of spatial locality when accessing instructions in your program. Give a short example (using code) and indicate what will have spatial locality and why. c) Define temporal locality. d) Give an example of temporal locality when accessing instructions in your program. Give a short example (using code) and indicate what will have temporal locality and why. Page 9 of 10

8) B-trees a) Given the following parameters: Disk access time = 1milli-sec per byte 1 Page on disk = 1024 bytes Key = 16 bytes Pointer = 4 bytes Data = 128 bytes per record (includes key) What are the best values for: M = L = b) Insert the values 1, 2, 5, 4, 6, 3, 7, 8, 9 in that order into a B tree with L=2 and M=3. Page 10 of 10