Topics for CSCI 151 Final Exam Wednesday, May 10

Similar documents
AP Computer Science 4325

CSE 373: Practice Final

CS 151 Name Final Exam December 17, 2014

School of Computing and Information Sciences. Course Title: Data Structures Date: 3/30/2010 Course Number: COP 3530 Number of Credits: 3

SOLUTIONS. COMP103 Introduction to Data Structures and Algorithms

Sorting. Task Description. Selection Sort. Should we worry about speed?

COMP Data Structures

COT 5407: Introduction to Algorithms. Giri Narasimhan. ECS 254A; Phone: x3748

About this exam review

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING ADVANCED DATA STRUCTURES AND ALGORITHMS EXAM EXAMINATION JUNE 2014

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

Course Review for Finals. Cpt S 223 Fall 2008

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

CS 151 Name Final Exam December 17, 2014

CS 445: Data Structures Final Examination: Study Guide

DATA ABSTRACTION AND PROBLEM SOLVING WITH JAVA

The ADT priority queue Orders its items by a priority value The first item removed is the one having the highest priority value

Computer Science E-22 Practice Final Exam

CS171 Final Practice Exam

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

EXAMINATIONS 2015 COMP103 INTRODUCTION TO DATA STRUCTURES AND ALGORITHMS

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

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

CSc 225 Algorithms and Data Structures I Algorithm Analysis

Trees 1: introduction to Binary Trees & Heaps. trees 1

CS61BL. Lecture 5: Graphs Sorting

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

University of Waterloo CS240 Winter 2018 Assignment 2. Due Date: Wednesday, Jan. 31st (Part 1) resp. Feb. 7th (Part 2), at 5pm

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers?

Data Structures Question Bank Multiple Choice

Selection, Bubble, Insertion, Merge, Heap, Quick Bucket, Radix

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

Priority Queues Heaps Heapsort

Prelim 2. CS 2110, November 19, 2015, 7:30 PM Total. Sorting Invariants Max Score Grader

CSE 373 Final Exam 3/14/06 Sample Solution

Prelim 2 Solution. CS 2110, November 19, 2015, 7:30 PM Total. Sorting Invariants Max Score Grader

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

CS200 Final Exam Fall 2007

Data Structures and Algorithms 1

EXAMINATIONS 2016 TRIMESTER 2

AP Computer Science AB

CS/SE 2C03 Data Structures & Algorithms Graduate Attributes and Indicators

Data Structures and Algorithm Analysis in C++

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

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

COMP251: Background. Jérôme Waldispühl School of Computer Science McGill University

Chapter Contents. An Introduction to Sorting. Selection Sort. Selection Sort. Selection Sort. Iterative Selection Sort. Chapter 9

ECE250: Algorithms and Data Structures Final Review Course

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

CS301 - Data Structures Glossary By

CS302 Data Structures using C++

Chapter 10 Sorting and Searching Algorithms

WITH SOLUTIONS!!! WARNING: THIS COPY CONTAINS SOLUTIONS!!! COMP103 Introduction to Data Structures and Algorithms

Samples of Evidence to Satisfy the AP Computer Science AB Curricular Requirements

Q1 Q2 Q3 Q4 Q5 Q6 Total

Summer Final Exam Review Session August 5, 2009

End-Term Examination Second Semester [MCA] MAY-JUNE 2006

Prelim 2. CS 2110, 16 November 2017, 7:30 PM Total Question Name Short Heaps Tree Collections Sorting Graph

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

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

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

Introduction p. 1 Pseudocode p. 2 Algorithm Header p. 2 Purpose, Conditions, and Return p. 3 Statement Numbers p. 4 Variables p. 4 Algorithm Analysis

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

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

PROGRAMMING IN C++ (Regulation 2008) Answer ALL questions PART A (10 2 = 20 Marks) PART B (5 16 = 80 Marks) function? (8)

9. The expected time for insertion sort for n keys is in which set? (All n! input permutations are equally likely.)

Table ADT and Sorting. Algorithm topics continuing (or reviewing?) CS 24 curriculum

CSci 231 Final Review

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

Visualizing Data Structures. Dan Petrisko

COMP 250 Fall Homework #4

Real-world sorting (not on exam)

CSC 207 (17fa) Practice Final Page 1 of 19. Practice Final

Exam Data structures DAT036/DAT037/DIT960

Data Structures and Abstractions with Java

CS171 Final Practice Exam

( ). Which of ( ) ( ) " #& ( ) " # g( n) ( ) " # f ( n) Test 1

n 2 ( ) ( ) Ο f ( n) ( ) Ω B. n logn Ο

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

Course goals. exposure to another language. knowledge of specific data structures. impact of DS design & implementation on program performance

How much space does this routine use in the worst case for a given n? public static void use_space(int n) { int b; int [] A;

CmpSci 187: Programming with Data Structures Spring 2015

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

****** NOTE!! THIS CONTAINS SOLUTIONS ***** TRIMESTER 2

ADT Priority Queue. Heaps. A Heap Implementation of the ADT Priority Queue. Heapsort

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

CompSci 201 Tree Traversals & Heaps

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

Topics Recursive Sorting Algorithms Divide and Conquer technique An O(NlogN) Sorting Alg. using a Heap making use of the heap properties STL Sorting F

CSE 373: Data Structures and Algorithms

Total Score /15 /20 /30 /10 /5 /20 Grader

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Data Structures and Algorithms. Final Examination T09:00

1. Attempt any three of the following: 15

CMSC132, Practice Questions

CS II: Data Structures Discussion worksheet: Week 15

Faculty of Science FINAL EXAMINATION

Prelim 2 SOLUTION. CS 2110, 16 November 2017, 7:30 PM Total Question Name Short Heaps Tree Collections Sorting Graph

Prelim 2 Solution. CS 2110, November 19, 2015, 5:30 PM Total. Sorting Invariants Max Score Grader

Priority Queues and Heaps. Heaps of fun, for everyone!

CS 61BL Data Structures & Programming Methodology

Transcription:

Topics for CSCI 151 Final Exam Wednesday, May 10

Java and Programming Techniques Types Inheritance Generics Abstract classes and interfaces Exceptions Recursion Writing recursive methods Dynamic Programming

B. Data Structures ArrayLists Linked Structures, especially singly and doubly linked lists Stacks Queues Binary Search Trees AVL trees Heaps and Priority Queues Hashing, Hash Tables, and Hash Maps Tries Graphs

Algorithms Big-Oh etc. notation Upper bounds and lower bounds Algorithm analysis BubbleSort, SelectionSort, InsertionSort Lower bound for sorting MergeSort, QuickSort, HeapSort Insert, Search, and Remove algorithms for each of our data structures Shortest Path algorithms for a directed graph Topological Sort for a directed graph Minimum Spanning Tree for an undirected graph Disjoint sets and Clustering

For each data structure you should know how it is implemented, how it works, what it is good for, and a Big-O estimate of its running time. There will not be any LONG programs to write, but you could be asked to write short pieces of code. There is likely to be at least one recursive function to write. It is VERY likely that there will be a question asking you to insert values into an AVL tree too many people got that wrong on Exam 2. In general I am more interested in whether you know how our data structures work and how they can be used than whether you can code their methods during the exam.

Here are some typical questions: 1. Java has an AbstractList class and a Comparable interface. Why is one an abstract class and the other an interface?

2. Give an algorithm for deleting a node in a binary search tree.

3. I have a large collection of n data items already stored in an AVL tree. I want to use this tree as a Priority Queue. How long will each of these queue operations take? Peek (i.e., find the maximum element) Poll (find, remove and return the maxiumum element) Offer (x) (insert x into the queue)

4. A grocery store hires you to maintain their inventory in a database. You need to use as keys the Universal Product Code stored in the barcode. The UPC consists of 12 numeric decimal digits, such as the following one for Kellogg s Raisin Bran: 038000596636. The value corresponding to each key is the number of items of this product that you have on hand. Here are some options: You could store the counts in an array indexed by the UPC; for example, if the store has 20 boxes of Kellogg s Raisin Bran the entry at index 38000596636 would be 20. You could make an array of base type Entry, which has a UCP-count pair, with an entry for each of the 10,000 products stocked in the store. You could make a HashMap where the keys are UPC s and the values are Integer counts. You could make a TreeMap where the keys are UPCs and the values are Integer counts. You could make a trie out of the UPC codes. Which would you use, and why?

5. Here is a Node type for a binary search tree that holds integer data: class Node { int data; Node leftchild, rightchild; } Give a definition of a recursive function Node insert( int x, Node p) that inserts value x into the tree rooted at p.

6. I have a large collection of n data items already stored in an AVL tree. I want to use this tree as a Priority Queue. How long will each of these queue operations take? Peek (i.e., find the maximum element) Poll (find, remove and return the maximum element) Offer (x) (insert x into the queue)

7. Here is a recursive function: int f(int n) { If (n == 0) return 1; else if (n == 1) return 3; else return 2*f(n-1) - 3*f(n-2) + 5; } Give a dynamic programming version of f.

8. Your boss gives you a dataset of 1,000,000 items. He wants you to find the 100 largest values in this dataset as quickly as you can. If your program runs quickly enough you get promoted and get to take that dream vacation to Fiji. If your program runs too slowly you get fired and go to work at MacDonalds. What technique will you use to find the 100 largest values? What is your estimate of its running time in terms of the number of items in the dataset?

9. Here is an algorithm for finding the kth smallest element in an unsorted array of values. It works much like Quicksort we choose a pivot value and rearrange the data so that all of the values less than the pivot are to its left and all of the values greater than the pivot are to its right: If the index of the pivot > k recurse on the portion of the array between index 0 and the index of the pivor. If the index of the pivot < k look for the k- index(pivot) smallest value in the portion of the array to the right of k. Of course, if index(pivot) == k you are done. What is the big-oh worst-case running time of this on an array of size n/ What is the average case running time on an array of size n? Give an argument that your answer for (ii) is correct.

10.I have a tree based on the Node class class Node { int data; Node leftchild, rightchild; } Give a procedure void Print( Node p) that prints a "breadth-first" traversal of this tree. For the tree It prints 1 5 3 4 9 8 7 6