(the bubble footer is automatically inserted in this space)

Similar documents
(the bubble footer is automatically inserted in this space)

CS 2150 (fall 2010) Midterm 2

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted in this space)

CS 216 Fall 2007 Midterm 1 Page 1 of 10 Name: ID:

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

(the bubble footer is automatically inserted in this space)

If you are still writing when pens down is called, your exam will be ripped up and not graded sorry to have to be strict on this!

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted in this space)

(the bubble footer is automatically inserted in this space)

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

CS 2150 Exam 2, Spring 2018 Page 1 of 6 UVa userid:

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space)

(the bubble footer is automatically inserted into this space)

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

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

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

CS 251, LE 2 Fall MIDTERM 2 Tuesday, November 1, 2016 Version 00 - KEY

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

Hash table basics mod 83 ate. ate. hashcode()

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

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

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

B+ Tree Review. CSE332: Data Abstractions Lecture 10: More B Trees; Hashing. Can do a little better with insert. Adoption for insert

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

Introduction hashing: a technique used for storing and retrieving information as quickly as possible.

Computer Science Foundation Exam

CSE332 Summer 2010: Midterm Exam Sample Solutions

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

C++ to assembly to machine code

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

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

CSE 332, Spring 2010, Midterm Examination 30 April 2010

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

HASH TABLES cs2420 Introduction to Algorithms and Data Structures Spring 2015

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

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

1. AVL Trees (10 Points)

UNIVERSITY OF WATERLOO DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING ECE 250 ALGORITHMS AND DATA STRUCTURES

CS 101 Spring 2007 Midterm 2 Name: ID:

Closed Book Examination. One and a half hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Wednesday 20 th January 2010

CS 373: Combinatorial Algorithms, Spring 1999

COS 226 Algorithms and Data Structures Fall Midterm

Exam Datastrukturer. DIT960 / DIT961, VT-18 Göteborgs Universitet, CSE

CS 101 Fall 2006 Midterm 1 Name: ID:

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

Questions. 6. Suppose we were to define a hash code on strings s by:

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

CS 210 Algorithms and Data Structures College of Information Technology and Engineering Weisberg Division of Engineering and Computer Science

Implementing Hash and AVL

Algorithms and Data Structures Spring 2008

CSE 332: Data Structures & Parallelism Lecture 10:Hashing. Ruth Anderson Autumn 2018

EECS 311 Data Structures Midterm Exam Don t Panic!

Hash Open Indexing. Data Structures and Algorithms CSE 373 SP 18 - KASEY CHAMPION 1

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

ECE242 Data Structures and Algorithms Fall 2008

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

INF2220: algorithms and data structures Series 3

Final Examination CSE 100 UCSD (Practice)

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

COMP 401 COURSE OVERVIEW

Section 05: Solutions

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

General Idea. Key could be an integer, a string, etc e.g. a name or Id that is a part of a large employee structure

CS 350 : Data Structures Hash Tables

CSC2100-Data Structures

Hash Tables. Gunnar Gotshalks. Maps 1

Introduction to Hashing

HASH TABLES. Hash Tables Page 1

AAL 217: DATA STRUCTURES

Second Examination Solution

COS 226 Midterm Exam, Spring 2009

Topic 22 Hash Tables

COS 126 General Computer Science Fall Midterm 1

Exam Data structures DAT036/DAT037/DIT960

Tables. The Table ADT is used when information needs to be stored and acessed via a key usually, but not always, a string. For example: Dictionaries

CSE373: Data Structures & Algorithms Lecture 17: Hash Collisions. Kevin Quinn Fall 2015

Name Section Number. CS210 Exam #3 *** PLEASE TURN OFF ALL CELL PHONES*** Practice

Section 05: Midterm Review

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

BINARY HEAP cs2420 Introduction to Algorithms and Data Structures Spring 2015

Hash Tables. CS 311 Data Structures and Algorithms Lecture Slides. Wednesday, April 22, Glenn G. Chappell

COMP171. Hashing.

TABLES AND HASHING. Chapter 13

EECS 203 Spring 2016 Lecture 8 Page 1 of 6

UNIVERSITY OF WATERLOO DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING E&CE 250 ALGORITHMS AND DATA STRUCTURES

We don t have much time, so we don t teach them [students]; we acquaint them with things that they can learn. Charles E. Leiserson

COS 226 Midterm Exam, Spring 2011

5. Hashing. 5.1 General Idea. 5.2 Hash Function. 5.3 Separate Chaining. 5.4 Open Addressing. 5.5 Rehashing. 5.6 Extendible Hashing. 5.

CPSC 331 Term Test #2 March 26, 2007

CSE100. Advanced Data Structures. Lecture 21. (Based on Paul Kube course materials)

Part 1: Written Questions (60 marks):

Hash Tables Outline. Definition Hash functions Open hashing Closed hashing. Efficiency. collision resolution techniques. EECS 268 Programming II 1

CSC 207 (16fa) Practice Exam 2 Page 1 of 13. Practice Exam 2 (Exam 2 date: Friday 11/18) Logistics:

CS 101 Fall 2005 Midterm 2 Name: ID:

Computer Science E-22 Practice Final Exam

Transcription:

Page 1 of 8 Name: Email ID: CS 216 Midterm 2 You MUST write your name and e mail ID on EACH page and bubble in your userid at the bottom of EACH page including this page. If you do not do this, you will receive a zero for that page! (Or a grade penalty if you leave out the bubble form for this page) If you are still writing when pens down is called, your exam will be ripped up and not graded even if you are still writing to fill in the bubble forms. So please do that first. Sorry to have to be strict on this Other than bubbling in your userid at the bottom, please do not write in the footer section of each page. There are 8 pages to this exam once the exam starts, please make sure you have all 8 pages. There are three types of questions: short, medium, and long answer. You can tell the difference because the short answer have a quarter page to answer, the medium have half a page to answer, and the long have a full page to answer the question. The short answer questions should not take more than a line or two to answer, and are worth 4 points each. Your answer should not exceed about 20 words. The medium answer questions are worth 6 points each, and the long answer questions are worth 12 points each. There are 100 points of questions and 105 minutes (1 hour 45 minutes) to take the exam, which means you should spend about 1 minute per question point; the extra 5 minutes are for bubbling in the exam footer. This exam is CLOSED text book, closed notes, closed calculator, closed cell phone, closed computer, closed neighbor, etc. Questions are worth different amounts, so be sure to look over all the questions and plan your time accordingly. Please sign the honor pledge here: There are 10 types of people in the world those that understand binary and those that don t.

Page 2 of 8 Name: Email ID: Arrays/Big Oh 1. [4 points] What does big Omega mean? Big Theta? 2. [4 points] What does little Oh mean? Little Omega? Little Theta? 3. [4 points] Given f O (h) and g O (h) is the following statement true? Why or why not? For all positive integers m, f (m) < g (m). 4. [4 points] Given f O (h) and g O (h) is the following statement true? Why or why not? For some positive integers m, f (m) < g (m).

Page 3 of 8 Name: Email ID: Trees, page 1 5. [4 points] List a situation when AVL trees are preferred over red black trees, and a situation when redblack trees are preferred over AVL trees. 6. [4 points] What are the 5 properties of red black trees? List as many as you can you can get a good amount of partial credit for this question. 7. [4 points] What is the big Oh running time of a splay tree s four operations: find, insert, remove, and printall? 8. [4 points] In a splay tree, the first operation for any of the three main operations (find, insert, remove) is to splay on the value to find/insert/remove. What happens if the value is not found in the tree?

Page 4 of 8 Name: Email ID: Trees, page 2 9. [12 points] Write an AVL tree that is in need of a double rotation to be properly balanced. Show the resulting tree both before and after said double rotation, as well as the intermediate step (i.e. between the two single rotations of the double rotation).

Page 5 of 8 Name: Email ID: Hashes, page 1 10. [4 points] What are the desired properties of a good hashing function? 11. [4 points] List two reasons why the size of a hash table should be a prime number. 12. [4 points] What special considerations have to be taken into account if you allow deletes from your hash table that uses a probing strategies for collision resolution? 13. [4 points] For each of the probing strategies for collision resolution (linear, quadratic, and double), where does the data structure try to fit the collided key?

Page 6 of 8 Name: Email ID: Hashes, page 2 14. [4 points] What problems are encountered with linear probing (ignoring deletes)? 15. [4 points] The Object class in Java contains a hashcode() method that returns an integer to be used as a key into a hash table (it must be modded by the hash table size, of course). The Object class does not know the type of the object that will call this (as it will be called by its subclasses). Keeping this in mind, how might this hash function work? We re looking for an English description here, not code. 16. [6 points] What is the running time for a hash table s operations (insert, find, printall)? Why? If it differs for each of the collision resolution strategies, then explain for each strategy.

Page 7 of 8 Name: Email ID: IBCM, page 1 (and some C++) 17. [4 points] What limits exist with IBCM programming? In other words, what can you not write in IBCM? Why? 18. [4 points] What are the four instruction types in IBCM? Hint: the first type is the halt instruction. What are the other three? 19. [6 points] Given the C++ code: int x[3][2] = { {1,2}, {3,4}, {5,6} }, draw a diagram showing how this array is stored in memory.

Page 8 of 8 Name: Email ID: IBCM, page 2 20. [12 points] Write a subroutine in IBCM that will read in two values from the input, subtract them, and leave the result in the accumulator (we ll assume that the result should be first input number minus the second input number). Since this is a subroutine, it will be called with the BRL instruction, and you will need to return to the appropriate address. For extra credit, write it without using the SUB instruction (but make sure you get it right if you don t get the rest of the subroutine correct, the extra credit won t help much). The IBCM opcodes are listed to the right. IBCM 0 halt 1 I/O 2 shifts 3 load 4 store 5 add 6 sub 7 and 8 or 9 xor A not B nop C jmp D jmpe E jmpl F brl