Course Review for Finals. Cpt S 223 Fall 2008

Similar documents
Course Review. Cpt S 223 Fall 2009

Course Review. Cpt S 223 Fall 2010

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

Course Review for. Cpt S 223 Fall Cpt S 223. School of EECS, WSU

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

Data Structures and Algorithm Analysis in C++

Chapter 1 Introduction

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

Data Structures Question Bank Multiple Choice

CSci 231 Final Review

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

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

COMP 251 Winter 2017 Online quizzes with answers

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

( ) ( ) C. " 1 n. ( ) $ f n. ( ) B. " log( n! ) ( ) and that you already know ( ) ( ) " % g( n) ( ) " #&

E.G.S. PILLAY ENGINEERING COLLEGE (An Autonomous Institution, Affiliated to Anna University, Chennai) Nagore Post, Nagapattinam , Tamilnadu.

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

CS301 - Data Structures Glossary By

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC)

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

AP Computer Science 4325

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

D. Θ nlogn ( ) D. Ο. ). Which of the following is not necessarily true? . Which of the following cannot be shown as an improvement? D.

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

( ) D. Θ ( ) ( ) Ο f ( n) ( ) Ω. C. T n C. Θ. B. n logn Ο

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

Solutions to Exam Data structures (X and NV)

Topics. Trees Vojislav Kecman. Which graphs are trees? Terminology. Terminology Trees as Models Some Tree Theorems Applications of Trees CMSC 302

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

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

Direct Addressing Hash table: Collision resolution how handle collisions Hash Functions:

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

Lecture Summary CSC 263H. August 5, 2016

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?

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

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

( D. Θ n. ( ) f n ( ) D. Ο%

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

Analysis of Algorithms

Midterm solutions. n f 3 (n) = 3

List of Transparencies

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

ECE250: Algorithms and Data Structures Midterm Review

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

CS8391-DATA STRUCTURES

CS 8391 DATA STRUCTURES

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

Basic Data Structures (Version 7) Name:

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

Binary Trees, Binary Search Trees

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

DATA STRUCTURES AND ALGORITHMS

Final Examination CSE 100 UCSD (Practice)

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

CS8391-DATA STRUCTURES QUESTION BANK UNIT I

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.

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

INSTITUTE OF AERONAUTICAL ENGINEERING

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

CS521 \ Notes for the Final Exam

Review of course COMP-251B winter 2010

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

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

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

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

Analysis of Algorithms

( ) 1 B. 1. Suppose f x

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

Introduction to Algorithms Third Edition

Union-Find: A Data Structure for Disjoint Set Operations

Union-Find: A Data Structure for Disjoint Set Operations

Algorithm Design (8) Graph Algorithms 1/2

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

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

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

Lecture 6: Analysis of Algorithms (CS )

Advanced Set Representation Methods

CSE 5311 Notes 4a: Priority Queues

Trees. CSE 373 Data Structures

Data Structures Brett Bernstein

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

Summer Final Exam Review Session August 5, 2009

Recitation 9. Prelim Review

Final Exam. EECS 2011 Prof. J. Elder - 1 -

Trees. (Trees) Data Structures and Programming Spring / 28

ROOT: A node which doesn't have a parent. In the above tree. The Root is A.

Data Structure. IBPS SO (IT- Officer) Exam 2017

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

Computer Science Spring 2005 Final Examination, May 12, 2005

Review for Midterm Exam

Department of Computer Science and Technology

COP 4531 Complexity & Analysis of Data Structures & Algorithms

Design and Analysis of Algorithms

VALLIAMMAI ENGINEERING COLLEGE

QUESTION BANK. Prepared by,mrs.d.maladhy AP/IT,RGCET. Page 1

Recursive Data Structures and Grammars

CSE 100: GRAPH ALGORITHMS

UNIT III BALANCED SEARCH TREES AND INDEXING

Lec 17 April 8. Topics: binary Trees expression trees. (Chapter 5 of text)

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

Transcription:

Course Review for Finals Cpt S 223 Fall 2008 1

Course Overview Introduction to advanced data structures Algorithmic asymptotic analysis Programming data structures Program design based on performance i.e., space and time efficiency 2

Math Review Floors, ceilings, exponents and logarithms: Definitions and manipulations Series: Definitions, manipulations, arithmetic and geometric series closed form Proofs: Know definition, components, and how to use the following Proof by induction Proof by counterexample Proof by contradiction Recursion Know definition and rules Analyze running time of recursive algorithm Tail recursion removal 3

C++ Review Know definitions and how to use the following Class, method, encapsulation Constructor, destructor, accessor, mutator Reference variable (&x) and call by reference Copy constructor, operator overloading, operator= Templates STL for different data structures 4

Algorithmic Analysis Why analyze an algorithm? What do we measure and how do we measure it? Line-by-line analysis Best-case, worst-case and average-case analysis Rate of growth: Definitions and notation (O, Ω, Θ, o, w) 5

Abstract Data Types Lists Operations: Insert, Delete, Search Implementations: vectors, singly-linked lists, double-linked lists, sentinels Analysis of operations for each implementation Stacks (LIFO) Operations: Push, Pop, Top Implementations: linked-list, vector Analysis of operations for each implementation Queues (FIFO) Operations: Enqueue, dequeue Implementations: linked-list, vector Analysis of operations for each implementation Standard Template Library (STL) Use of vector, list, stack and queue template classes Use of iterators Know all the tradeoffs (in time & space) between all these data structures 6

Trees (in memory) Definitions: root, leaf, child, parent, ancestor, descendant, path, height, depth Binary tree: Definition, traversals Storing/representation: 1. All children: use array or list 2. Store pointers to only Leftmost child and right sibling Tree traversals Inorder, postorder and preorder 7

Search Trees Binary search tree (BST) Definition Operations: Insert, Delete, Search, FindMin, FindMax, traversals Know how to perform these on a BST and show resulting BST Know worst-case and average-case analysis of performance Balanced BST (AVL trees) Definition Operations: Rotations & Cases, Insert, Lazy Delete, Search, FindMin, FindMax Know how to perform these on an AVL tree and show resulting AVL tree Know worst-case performance STL set and map classes Differences How to use them 8

Disk-based Search Trees B-trees Definition and properties Input parameters: B, D, K M and L, and how to choose them Operations: Insert, Delete, Search Know how to perform these on a B-tree and show resulting B-tree Know worst-case performance Know how to calculate height of a B-tree 9

Priority Queues Binary heap, Binomial heaps Definitions: Binary heap Structure property: complete binary tree except the last level (filled breadth-first left to right) Heap order property Min heap : each node s value is less than or equal to its children Binomial heap Structure property: A forest of binomial trees (similar to binary representation) Heap order property: Min heap: within each binomial tree, same heap order like in binary heap 10

Implementation Binary heap Tree structure can be implemented as an array Where nodes are stored in breadth-first order Children of node at A[i] are at: A[2i] and A[2i+1] Binomial heap Array of pointers to each binomial tree log n binomial tree pointers 11

Run-times for each heap operation Two main techniques: percolateup and percolatedown Insert DeleteMin Merge Binary heap Binomial Heap O(1) - amortized O(1) O(log n) O(log n) Other operations: deletemax() decreasekey(p,v), increasekey(p,v) remove(p) O(n) O(log n) 12

Union-Find data structure Purpose: Compute equivalence class Equivalence class: Maximal subsets defined by equivalence relation Disjoint subsets Union-find Supports two operations on disjoint sets: Union(a,b) Find(a) Array implementation 13

Steps in the Union (x, y) 1. EqClass x = Find (x) 2. EqClass y = Find (y) 3. EqClass xy = EqClass 1 U EqClass 1 Initially, put each element in a set of its own FOR EACH element pair (a,b): Check [a R b = true] IF a R b THEN Union(a,b) 14

Heuristics & their Gains Arbitrary Union, Simple Find Union-by-size, Simple Find Union-by-rank, Simple Find Arbitrary Union, Path compression Find Union-by-rank, Path compression Find Worst-case run-time for m operations O(m n) O(m log n) O(m log n) O(m log n) Extremely slow Growing function O(m Inv.Ackermann(m,n)) = O(m log*n) 15

Hashing Hash functions (purpose: string to integer) Choice of a good hash functions Reduce chance of collision Relatively smaller key value Does not need huge hash table size Hash table size should be a prime Load factor Know algorithms & analysis for the following Collision resolution by chaining Collision resolution by open-addressing Linear probing, quadratic probing Double hashing Rehashing Extensible hashing 16

Sorting Know algorithms & analysis of all sort methods mentioned below Insertion sort Merge sort Heap sort Quick sort Lower bound for sorting Counting sort Bucket sort 17

Comparison Sorting Sort Worst Case Average Case Best Case Comments InsertionSort Θ(N 2 ) Θ(N 2 ) Θ(N) Fast for small N MergeSort Θ(N log N) Θ(N log N) Θ(N log N) Requires memory HeapSort Θ(N log N) Θ(N log N) Θ(N log N) Large constants QuickSort Θ(N 2 ) Θ(N log N) Θ(N log N) Small constants 18 18

Graphs Definitions Simple graph, directed graph, weighted graph Path, cycle Representation as adjacency matrix and adjacency list Topological sort: Algorithm and running time 19

Graphs Shortest paths Problem definition Single-source Negative weights and negative-weight cycles Know running times for different graph cases: weighted vs. unweighted, directed vs. undirected Unweighted shortest path Dijkstra s algorithm, and why it works Graphs with negative edge costs Acyclic graphs and critical path analysis 20

Graphs Minimum spanning trees Problem definition Prim s algorithm (know algorithm and running time) Kruskal s algorithm (know algorithm and running time) Applications 21

Specialized Data Structures Spatial data structures Quad-tree for 2D Oct-tree for 3D Uncompressed vs. compressed (same as compacted ) Know how to draw compacted trees for 2D input String data structures Lookup table (exponential space) PATRICIA tree (linear space) Suffix tree (linear space) Know how to draw a suffix tree for a given input Know algorithm and complexity for pattern matching (find P in T) 22

Final Exam Tuesday 8am -10am In class Closed book, closed notes Comprehensive 23

Thank You & Good Luck! COURSE EVALUATIONS!! 24