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

Similar documents
Course Review. Cpt S 223 Fall 2009

Course Review for Finals. Cpt S 223 Fall 2008

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

Course Review. Cpt S 223 Fall 2010

DESIGN AND ANALYSIS OF ALGORITHMS

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

Data Structures and Algorithm Analysis in C++

Union-Find: A Data Structure for Disjoint Set Operations

Thus, it is reasonable to compare binary search trees and binary heaps as is shown in Table 1.

CS521 \ Notes for the Final Exam

CSci 231 Final Review

Treaps. 1 Binary Search Trees (BSTs) CSE341T/CSE549T 11/05/2014. Lecture 19

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

CS 445: Data Structures Final Examination: Study Guide

Recall: Properties of B-Trees

Lecture Summary CSC 263H. August 5, 2016

Midterm solutions. n f 3 (n) = 3

Plotting run-time graphically. Plotting run-time graphically. CS241 Algorithmics - week 1 review. Prefix Averages - Algorithm #1

Priority Queues Heaps Heapsort

CSE 100 Advanced Data Structures

AP Computer Science 4325

Your favorite blog : (popularly known as VIJAY JOTANI S BLOG..now in facebook.join ON FB VIJAY

CSCE 321/3201 Analysis and Design of Algorithms. Prof. Amr Goneid. Fall 2016

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

Chapter 1 Introduction

EST Solutions. Ans 1(a): KMP Algorithm for Preprocessing: KMP Algorithm for Searching:

Priority Queues. 04/10/03 Lecture 22 1

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

Advanced Set Representation Methods

Analysis of Algorithms

Solutions to Exam Data structures (X and NV)

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;

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

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

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

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

CSE 100: GRAPH ALGORITHMS

Merge Sort fi fi fi 4 9. Merge Sort Goodrich, Tamassia

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

Union-Find: A Data Structure for Disjoint Set Operations

Trees. Reading: Weiss, Chapter 4. Cpt S 223, Fall 2007 Copyright: Washington State University

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

Union-find algorithms. (1) How do you determine whether a vertex x is connected to a vertex y in a graph?

Introduction to Algorithms Third Edition

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

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

INSTITUTE OF AERONAUTICAL ENGINEERING

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

Sorted Arrays. Operation Access Search Selection Predecessor Successor Output (print) Insert Delete Extract-Min

Data Structures Question Bank Multiple Choice

17 February Given an algorithm, compute its running time in terms of O, Ω, and Θ (if any). Usually the big-oh running time is enough.

END-TERM EXAMINATION

Review of course COMP-251B winter 2010

Contents. 1 Introduction. 2 Searching and Traversal Techniques. Preface... (vii) Acknowledgements... (ix)

CMSC 341 Lecture 15 Leftist Heaps

Algorithm Analysis. (Algorithm Analysis ) Data Structures and Programming Spring / 48

Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment

Merge Sort Goodrich, Tamassia Merge Sort 1

Representations of Weighted Graphs (as Matrices) Algorithms and Data Structures: Minimum Spanning Trees. Weighted Graphs

Pseudo code of algorithms are to be read by.

Chapter 2: Complexity Analysis

Solutions. (a) Claim: A d-ary tree of height h has at most 1 + d +...

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

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

Friday Four Square! 4:15PM, Outside Gates

CMSC 341 Lecture 15 Leftist Heaps

INDEX. Cambridge University Press How to Think About Algorithms Jeff Edmonds Index More information

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

Binary Heaps. COL 106 Shweta Agrawal and Amit Kumar

l Heaps very popular abstract data structure, where each object has a key value (the priority), and the operations are:

CISC 621 Algorithms, Midterm exam March 24, 2016

CSE 332, Spring 2010, Midterm Examination 30 April 2010

: Fundamental Data Structures and Algorithms. June 06, 2011 SOLUTIONS

COMP 251 Winter 2017 Online quizzes with answers

COP 4531 Complexity & Analysis of Data Structures & Algorithms

CSE373 Fall 2013, Midterm Examination October 18, 2013

Sorting and Selection

l So unlike the search trees, there are neither arbitrary find operations nor arbitrary delete operations possible.

CLASS: II YEAR / IV SEMESTER CSE CS 6402-DESIGN AND ANALYSIS OF ALGORITHM UNIT I INTRODUCTION

PROGRAM EFFICIENCY & COMPLEXITY ANALYSIS

Analysis of Algorithms

CMSC 341 Lecture 14: Priority Queues, Heaps

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

Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015

CMSC 341 Leftist Heaps

CIS 121 Data Structures and Algorithms with Java Spring Code Snippets and Recurrences Monday, January 29/Tuesday, January 30

Solved by: Syed Zain Ali Bukhari (BSCS)

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

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

CSE 5311 Notes 4a: Priority Queues

W4231: Analysis of Algorithms

CS-301 Data Structure. Tariq Hanif

CS6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK UNIT I

COMP251: Algorithms and Data Structures. Jérôme Waldispühl School of Computer Science McGill University

Practice Midterm Exam Solutions

Overview of Sorting Algorithms

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

Greedy Algorithms Part Three

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

CMSC 341 Priority Queues & Heaps. Based on slides from previous iterations of this course

Transcription:

Cpt S 223 Course Overview 1

Course Goals Learn about new/advanced data structures Be able to make design choices on the suitable data structure for different application/problem needs Analyze (objectively) the run-time and memory complexity of algorithms and problem properties Design algorithms for problems, and iteratively improve on the efficiency Express algorithmic language in pseudo-codes (prog language independent) 2

Basic Math Background Summation/Series Geometric, arithmetic, sum of squares, sum of first n ints Proving Techniques By Counterexample By contradiction By contra-positive Induction Recursion Tower of Hanoi Recursive formula from pseudo-codes Tail recursion 3

Algorithmic Notation & Analysis Big-O O() Omega Ω() small-o o() small-omega w() Theta () Worst-case Average-case Best-case Algorithms Lower-bound Upper-bound Tight-bound Optimality 4

Factors for Algorithmic Design Consideration Run-time Space/memory Computational model Suitability to the problem s application domain (contextual relevance) Scalability Guaranteeing correctness Deterministic vs. randomized System considerations: cache, disk, network speeds, etc. 5

Algorithmic Design: An Example The Maximum Subsequence Sum Problem Input: An array A[1..n] of integers Output: Find a stretch with the largest non-negative sum, if one exists O(n 3 ) ==> O(n 2 ) ==> O(n lg n) ==> O(n) 6

Trees Trees Representation Time-efficient Space-efficient Access patterns Depth-first Breadth-first Top-down Bottom-up Traversals Pre-order Post-order In-order Eulerian 7

Search Trees BST AVL Worstcase Avg-case Worst-case Insert O(n) O(lg n) O(lg n) Delete O(n) O(lg n) O(lg n) Find O(n) O(lg n) O(lg n) Height O(n) O(lg n) O(lg n) 8

Search Trees for Disks/Secondary Storage B+ trees Index to the Data Each internal node = 1 disk block Root Internal nodes Leaves Data items stored at leaves Each leaf = 1 disk block M=5 (order of the B+ tree) L=5 (#data items bound for leaves) 9

Priority Queues - Heaps Insert (x) x = DeleteMin() Return the next minimum entry in the queue Alternative: x = DeleteMax() Return the next maximum entry in the queue 10

Heap Main Properties Structure property Heap order property Binary Heap Binomial Heap 11

Binary Heap 12

Binomial Heap B 4 B 3 B 2 B 1 B 0 n = 31 = (1 1 1 1 1) 2 B 3 B 2 13

(Amortized) Run-time Per Operation Insert DeleteMin Merge Binary heap O(lg n) or O(1) O(log n) O(n) Leftist Heap O(log n) O(log n) O(log n) Skew Heap O(log n) O(log n) O(log n) Binomial Heap O(1) O(log n) O(log n) 14

Union-Find Data Structure Disjoint Set operations Two basic operations Find (x) Union (x, y) 15

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

Algorithm Design Techniques Divide and Conquer Greedy Dynamic Programming 17

Class Reminders COURSE EVALUATIONS Very Important It does matter! By Sunday 12/16 FINALS 8-10 am, Friday, 12/14 18

Thank You!!! 19