Material covered. Areas/Topics covered. Logistics. What to focus on. Areas/Topics covered 5/14/2015. COS 226 Final Exam Review Spring 2015

Similar documents
Final Exam Solutions

COS 226 Algorithms and Data Structures Fall Final

COS 226 Algorithms and Data Structures Spring Final

COS 226 Algorithms and Data Structures Fall Final

COS 226 Final Exam, Spring 2009

COS 226 Algorithms and Data Structures Fall Final Exam

COS 226 Algorithms and Data Structures Spring Final Exam

COS 226 Written Exam 2 Fall 2016

Final Exam Solutions

Final Exam. COS 226 Algorithms and Data Structures Fall 2015

COS 226 Final Exam, Spring 2010

Review of course COMP-251B winter 2010

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

Princeton University Computer Science COS226: Data Structures and Algorithms. Final, Spring 2013

ECE250: Algorithms and Data Structures Final Review Course

COS 226 Algorithms and Data Structures Fall Final Solutions. 10. Remark: this is essentially the same question from the midterm.

Lecture 1: Introduction

Virtual University of Pakistan

Index. stack-based, 400 A* algorithm, 325

Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest. Introduction to Algorithms

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

COS 226 Algorithms and Data Structures Fall Midterm

COMP 251 Winter 2017 Online quizzes with answers

n 2 ( ) ( ) + n is in Θ n logn

CS521 \ Notes for the Final Exam

& ( D. " mnp ' ( ) n 3. n 2. ( ) C. " n

Algorithms: Design & Practice

CS2013 Course Syllabus Spring 2018 Lecture: Mon/Wed 2:00 P.M. 2:50 P.M. SH C259 Lab: Mon/Wed 2:50 P.M. 4:00 P.M. SH C259

Algorithms and Data Structures (INF1) Lecture 15/15 Hua Lu

COS 226 Algorithms and Data Structures Fall Midterm

COS 226 Algorithms and Data Structures Spring Second Written Exam

Design and Analysis of Algorithms. Comp 271. Mordecai Golin. Department of Computer Science, HKUST

University of Waterloo CS240R Fall 2017 Review Problems

University of Waterloo CS240R Winter 2018 Help Session Problems

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

Final Examination CSE 100 UCSD (Practice)

CSci 231 Final Review

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

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

Lecture Summary CSC 263H. August 5, 2016

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

CS323: Data Structures and Algorithms Final Exam (December 17, 2014) Name:

Spring 2018 Mentoring 13: April 25, New World Order. return a list of all the words that start with a given prefix.

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

COS 226 Midterm Exam, Spring 2009

(the bubble footer is automatically inserted into this space)

Minimum Spanning Trees

COS 226 Algorithms and Data Structures Practice Design Questions

Contents. CS 124 Final Exam Practice Problem 5/6/17. 1 Format and Logistics 2

CSC263 Week 12. Larry Zhang

Final Review Document Solution

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

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

Graph Algorithms (part 3 of CSC 282),

Prelim 2. CS 2110, 24 April 2018, 5:30 PM Total Question Name Short Heaps Tree Collections Sorting Graph

Prelim 2 Solution. CS 2110, 24 April 2018, 5:30 PM Total Question Name Short Heaps Tree Collections Sorting Graph

4/8/11. Single-Source Shortest Path. Shortest Paths. Shortest Paths. Chapter 24

CS61B Spring 2016 Guerrilla Section 6 Worksheet

Student Name and ID Number. MATH 3012, Quiz 3, April 16, 2018, WTT

University of Waterloo CS240 Spring 2018 Help Session Problems

Introduction to Algorithms Third Edition

CISC 320 Midterm Exam

Introduction to Algorithms. Lecture 11

Introduction to Algorithms April 16, 2008 Massachusetts Institute of Technology Spring 2008 Professors Srini Devadas and Erik Demaine Quiz 2

Test 1 Last 4 Digits of Mav ID # Multiple Choice. Write your answer to the LEFT of each problem. 2 points each t 1

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

Algorithms. Algorithms ALGORITHM DESIGN

SUGGESTION : read all the questions and their values before you start.

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

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

CSE332 Summer 2012 Final Exam, August 15, 2012

Computer Science E-22 Practice Final Exam

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

END-TERM EXAMINATION

) $ f ( n) " %( g( n)

( ) 1 B. 1. Suppose f x

Multiple Choice. Write your answer to the LEFT of each problem. 3 points each

Course Name: B.Tech. 3 th Sem. No of hours allotted to complete the syllabi: 44 Hours No of hours allotted per week: 3 Hours. Planned.

Quiz 2. Problem Parts Points Grade Grader. Total 120. Name: Recitation: Jayant 12 PM. Christina 10 AM. Jayant 1 PM. Jason 2 PM.

Prelim 2. CS 2110, 24 April 2018, 7:30 PM Total Question Name Short Heaps Tree Collections Sorting Graph.

University of Waterloo CS240R Fall 2017 Solutions to Review Problems

CS 125 Section #10 Midterm 2 Review 11/5/14

logn D. Θ C. Θ n 2 ( ) ( ) f n B. nlogn Ο n2 n 2 D. Ο & % ( C. Θ # ( D. Θ n ( ) Ω f ( n)

x-fast and y-fast Tries

CS61B, Fall 2002 Discussion #15 Amir Kamil UC Berkeley 12/5/02

d. Solution coming soon. 6. Directed Graphs

EECS 281 Homework 3 KEY Fall 2004

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018

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

Table of Contents. Chapter 1: Introduction to Data Structures... 1

1 Shortest Paths. 1.1 Breadth First Search (BFS) CS 124 Section #3 Shortest Paths and MSTs 2/13/2018

( ) + n. ( ) = n "1) + n. ( ) = T n 2. ( ) = 2T n 2. ( ) = T( n 2 ) +1

Algorithms. Algorithms 4.4 SHORTEST PATHS. APIs properties Bellman Ford algorithm Dijkstra s algorithm ROBERT SEDGEWICK KEVIN WAYNE

Course Review for Finals. Cpt S 223 Fall 2008

Shortest path problems

Minimum Spanning Trees

Graph Algorithms (part 3 of CSC 282),

Analysis of Algorithms

COS 226 Algorithms and Data Structures Spring Midterm Exam

( ) n 3. n 2 ( ) D. Ο

Transcription:

COS 226 Final Exam Review Spring 2015 Ananda Gunawardena (guna) guna@cs.princeton.edu guna@princeton.edu Material covered The exam willstressmaterial covered since the midterm, including the following components. Lectures 13 23. Algorithms in Java, 4th edition, Chapters 4 6. Exercises 12 22. Programming assignments 6 8 Wordnet, seam-carving, burrows-wheeler COS 226 Spring 2015 - Princeton University Logistics Areas/Topics covered The final exam time and location The final exam is from 9am to 12noon on Saturday, May 16 in McCosh 28 or McCosh 50. McCosh 28: Last name begins with A F. McCosh 50: Last name begins with G Z. The exam will start and end promptly, so please do arrive on time. Alternate time and place Monday May 18 th at 1:30PM in Friend 008 Exam Format Closed book, closed note. You may bring one 8.5-by-11 sheet (both sides) with notes in your own handwriting to the exam. No electronic devices (e.g., calculators, laptops, and cell phones). Data Compression LZW, Huffman, run Length Encoding String Sorts MSD, LSD, 3-way radix quicksort Graphs - Traversals/order BFS, DFS, Topological sort DFS - preorder, postorder String Search KMP, Boyer-Moore, Graphs - Shortest Path BFS. Dijkstra s, Bellman-Ford, DAGs Graphs - MST Kruskals, Prims COS 226 Spring 2015 - Princeton University What to focus on focus on understanding basic issues, not memorizing details For each algorithm understand how it works on typical input Why do we care about this algorithm? How is it different from other algorithms for the same problem? When is it effective? For each data structure invariants Operations and complexity applications When is it effective to use a specific data structure? Areas/Topics covered Maxflow / Mincut Augmenting paths, Ford-Fulkerson DFA / NFA Regular Expressions Algorithm Analysis Big O, order of growth, Tilde Reductions X linear time reduces to Y Tries R-way, TST Memory Analysis primitive types, objects, arrays, nested classes 1

Algorithm Analysis Challenge Questions Consider each statement and state TRUE, FALSE, UNKNOWN An algorithm for sorting n comparable keys in linear time or less has not been invented yet There exist an algorithm where duplicity of elements in a set can be determined in sub-linear time The convex hull problem (i.e. finding a set of points that encloses a given set of n points) can be solved in linearithmic time It is possible to insert n comparable keys into a BST in time proportional to n Experimental to Predictive Graph Algorithms Order of growth 3. Graph Search Identify one situation where you would need to use BFS instead of DFS. Identify one situation where you would need to use DFS instead of BFS. Find a topological sort of the vertices (if possible) 2

5. MST How does KruskalsDiffer from Prims? 8. Dijkstra s algorithm What data structure is useful when running kruskals on a graph? What data structure is useful when running Prim s algorithm on a graph Can minimum spanning tree algorithm be used to find the maximum spanning tree of a graph? How many edges does a MST contains (in terms of number of vertices) Give an example where Dijkstra s fail when there is a negative edge. What algorithm can be applied to find the shortest path when there is a negative edge? Is it always possible to find the shortest path when there are negative edges in the graph? 6. MST Algorithm Design 1. State the algorithm 1. Explain why your algorithm takes O(V) time Challenge problems Answer each question as possible, impossible or unknown Find the strong components in a digraph in linear time Construct a binary heap in linear time Find the maximum spanning tree in time proportional to E+V 7. Match Algorithms Strings 3

9. TST 13. KMP Table 1. List the words in alphabetical order (black nodes denote the end of a word) 2. Insert aacato TST 3. Why and when would you use a TST instead of a R-way trie? Construct the KMP table for the search string 0 1 2 3 4 5 6 7 a b c COS 226 - Fall 2013 - Princeton University 10. String Sorting Compression 12. Regular Expression to NFA 1. Compressing 14. LZW compression A B A B A A B A A A A B B (A=41, B=42, next code= 81) 2. Expanding 4

15. MaxFlow-MinCut 21. counting memory standard data types object overhead 16 bytes array overhead 24 bytes references 8 bytes Inner class reference 8 bytes Find max-flow and then min-cut How much memory is needed for a 2-3 tree that holds N nodes? 17. Algorithm Design 22. String Sorting List key invariants for each algorithm 1. MSD 2. LSD 3. 3-way radix quicksort 1. Design an efficient algorithm to determine if a set of binary code words is prefix-free 1. What is the order of growth of the worst-case running time of your algorithm as a function of N and W, where N is the number of binary code words and W is the total number of bits in the input? 1. What is the order of growth of the memory usage of your algorithm? 19. Burrows-Wheeler KMP Table Identify the string using the partially completed DFA Complete the DFA 5

23. Reductions 6