Data Structures and Algorithms

Slides:



Advertisements
Similar presentations
Dana Shapira Hash Tables
Advertisements

Algorithms Analysis Lecture 6 Quicksort. Quick Sort Divide and Conquer.
Data Structures Data Structures Topic #13. Today’s Agenda Sorting Algorithms: Recursive –mergesort –quicksort As we learn about each sorting algorithm,
Updated QuickSort Problem From a given set of n integers, find the missing integer from 0 to n using O(n) queries of type: “what is bit[j]
CSE332: Data Abstractions Lecture 12: Introduction to Sorting Tyler Robison Summer
Introduction to Analysis of Algorithms
© 2004 Goodrich, Tamassia Selection1. © 2004 Goodrich, Tamassia Selection2 The Selection Problem Given an integer k and n elements x 1, x 2, …, x n, taken.
1 TCSS 342, Winter 2005 Lecture Notes Course Overview, Review of Math Concepts, Algorithm Analysis and Big-Oh Notation Weiss book, Chapter 5, pp
Selection1. 2 The Selection Problem Given an integer k and n elements x 1, x 2, …, x n, taken from a total order, find the k-th smallest element in this.
DATA STRUCTURE Subject Code -14B11CI211.
TCSS 342 Lecture Notes Course Overview, Review of Math Concepts,
ALGORITHMS.
Fall 2015, Kevin Quinn CSE373: Data Structures & Algorithms Lecture 25: Problem Solving CSE373: Data Structures and algorithms1.
CS321 Spring 2016 Lecture 3 Jan Admin A1 Due this Friday – 11:00PM Thursday = Recurrence Equations – Important. Everyone Should be added to class.
Course Introductions.  Introduction to java  Basics of Java  Classes & Objects  Java Collections and APIs  Algorithms and their analysis  Recursion.
1 Merge Sort 7 2  9 4   2  2 79  4   72  29  94  4.
Sorting Lower Bounds n Beating Them. Recap Divide and Conquer –Know how to break a problem into smaller problems, such that –Given a solution to the smaller.
TCSS 342 Autumn 2004 Version TCSS 342 Data Structures & Algorithms Autumn 2004 Ed Hong.
1 The Role of Algorithms in Computing. 2 Computational problems A computational problem specifies an input-output relationship  What does the.
1 i206: Lecture 17: Exam 2 Prep ; Intro to Regular Expressions Marti Hearst Spring 2012.
Mohammed I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Algorithm Design Techniques, Greedy Method – Knapsack Problem, Job Sequencing, Divide and Conquer Method – Quick Sort, Finding Maximum and Minimum, Dynamic.
Introduction toData structures and Algorithms
CMPT 438 Algorithms.
Sorting Chapter 14.
Quick-Sort 2/18/2018 3:56 AM Selection Selection.
Sort & Search Algorithms
CSC317 Selection problem q p r Randomized‐Select(A,p,r,i)
Course Developer/Writer: A. J. Ikuomola
October 2nd – Dictionary ADT
The Design and Analysis of Algorithms
IGCSE 6 Cambridge Effectiveness of algorithms Computer Science
CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis
Scientific Method The scientific method is a guide to problem solving. It involves asking questions, making observations, and trying to figure out things.
3.1 Algorithms (and real programming examples).
CSE332: Data Abstractions Lecture 12: Introduction to Sorting
Cse 373 May 15th – Iterators.
CS302 Data Structures Fall 2012.
Analysis and design of algorithm
Data Structures (CS212D) Overview & Review.
Introduction to Algorithms
Growth Functions Algorithms Lecture 8
Algorithms + Data Structures = Programs -Niklaus Wirth
Quick Sort (11.2) CSE 2011 Winter November 2018.
TCSS 342, Winter 2006 Lecture Notes
Data Structures: Introductory lecture
Algorithms + Data Structures = Programs -Niklaus Wirth
CSE 214 – Computer Science II B-Trees
Week # 1: Overview & Review
Data Structures (CS212D) Overview & Review.
Quickselect Prof. Noah Snavely CS1114
CSE 2010: Algorithms and Data Structures Algorithms
Lecture 27 CSE 331 Oct 31, 2014.
Introduction to Data Structures
CSE 373 Data Structures and Algorithms
Insertion Sort Demo Sorting problem:
CS 1114: Sorting and selection (part two)
Copyright © Aiman Hanna All rights reserved
Divide & Conquer Sorting
COP3530- Data Structures Introduction
slides created by Ethan Apter
Quick-Sort 5/7/2019 6:43 PM Selection Selection.
The Selection Problem.
Quick-Sort 5/25/2019 6:16 PM Selection Selection.
Design and Analysis of Algorithms
CSE 373: Data Structures and Algorithms
Quicksort and selection
Algorithms CSCI 235, Spring 2019 Lecture 36 P vs
Algorithms and templates
Chapter 11 Sets, and Selection
Presentation transcript:

Data Structures and Algorithms What This Course Is About Data structures – how data is organized Algorithms – unambiguous sequence of steps to compute something Data Structures + Algorithms = Programs Algorithm analysis – determining how long an algorithm will take to solve a problem Who cares? Aren’t computers fast enough and getting faster? Oct 1, 2001 CSE 373

An Example Given an array of 1,000,000 integers, … find the maximum integer in the array. Now suppose we are asked to find the kth largest element. (The Selection Problem) … 1 2 999,999 Oct 1, 2001 CSE 373

Candidate Solutions + Candidate solution 1 Sort the entire array (from small to large), using insertion sort. Pick out the (1,000,000 – k)th element. + Candidate solution 2 Sort the first k elements. For each of the remaining (1,000,000 – k) elements, keep the k smallest in an array. Pick out the smallest of the k survivors. Oct 1, 2001 CSE 373

Is either solution good? Is there a better solution? How would you go about determining the answer to these questions? Oct 1, 2001 CSE 373

Method 1 Code each algorithm and run them to see how long they take. Problem: How will you know if there is a better program or whether there is no better program? What will happen when the number of inputs is twice as many? Three? A hundred? Oct 1, 2001 CSE 373

Method 2 Develop a model of the way computers work and compare how the algorithms behave in the model. Goal: To be able to predict performance at a coarse level. That is, to be able to distinguish between good and bad algorithms. Another benefit: when assumptions change, we can predict the effects of those changes. Oct 1, 2001 CSE 373

Why algorithm analysis? As computers get faster and problem sizes get bigger, analysis will become more important. Why? The difference between good and bad algorithms will get bigger. Oct 1, 2001 CSE 373

Why data structures? When programming, you are an engineer. Engineers have a bag of tools and tricks – and the knowledge of which tool is the right one for a given problem. Arrays, lists, stacks, queues, trees, hash tables, graphs. Oct 1, 2001 CSE 373