Data Structures and Algorithms Dr. Manuel E. Bermudez Alter ego to Dr. Sartaj Sahni.

Slides:



Advertisements
Similar presentations
Garfield AP Computer Science
Advertisements

SORTING AND ASYMPTOTIC COMPLEXITY Lecture 12 CS2110 – Spring 2014 File searchSortAlgorithms.zip on course website (lecture notes for lectures 12, 13) contains.
Chapter 8, Sorting. Sorting, Ordering, or Sequencing “Since only two of our tape drives were in working order, I was ordered to order more tape units.
Advanced Data Structures Sartaj Sahni
1 Data Structures Performance Analysis. 2 Fundamental Concepts Some fundamental concepts that you should know: –Dynamic memory allocation. –Recursion.
Data Structures & Algorithms Richard Newman Clip Art Sources s s s s
Scott Grissom, copyright 2004 Chapter 5 Slide 1 Analysis of Algorithms (Ch 5) Chapter 5 focuses on: algorithm analysis searching algorithms sorting algorithms.
CSCE156: Introduction to Computer Science II Instructor Stephen Scott Website
Data Structures & Algorithms What The Course Is About s Data structures is concerned with the representation and manipulation of data. s All programs.
UMass Lowell Computer Science Foundations of Computer Science Prof. Karen Daniels Fall, 2009 Lecture 1 Introduction/Overview Th. 9/3/2009.
CHAPTER 11 Sorting.
Data Structures Performance Analysis.
CS101- Lecture 11 CS101 Fall 2004 Course Introduction Professor Douglas Moody –Monday – 12:00-1:40 – – –Web Site: websupport1.citytech.cuny.edu.
Midterm Exam Two Tuesday, November 25 st In class cumulative.
Time Complexity s Sorting –Insertion sorting s Time complexity.
CSC 171 – FALL 2004 COMPUTER PROGRAMMING LECTURE 0 ADMINISTRATION.
Simple Sort Algorithms Selection Sort Bubble Sort Insertion Sort.
Data Structures/ Algorithms and Generic Programming Sorting Algorithms.
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Sorting Course Lecture Slides 24 May 2010 “The real focus here is bringing.
Computer Science 102 Data Structures and Algorithms V Fall 2009 Lecture 1: administrative details Professor: Evan Korth New York University 1.
Fall 2013 Instructor: Reza Entezari-Maleki Sharif University of Technology 1 Fundamentals of Programming Session 17 These.
Seattle Preparatory School Advanced Placement Computer Science Seattle Preparatory School Advanced Placement Computer Science LESSON 62 FEBRUARY 12, 2015.
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a lgorithms.
COP 3530: Data Structures, Algorithms, & Applications Instructor: Kristian Linn Damkjer.
Data Structures, Algorithms, & Applications
Introduction to Algorithms Jiafen Liu Sept
Introduction to Computer Science A Professor Uday Reddy
Course Introduction Software Engineering
CSE 221/ICT221 Analysis and Design of Algorithms Lecture 05: Analysis of time Complexity of Sorting Algorithms Dr.Surasak Mungsing
Fall 2013 Instructor: Reza Entezari-Maleki Sharif University of Technology 1 Fundamentals of Programming Session 17 These.
CSC 171 – FALL 2001 COMPUTER PROGRAMMING LECTURE 0 ADMINISTRATION.
Computer Science 102 Data Structures and Algorithms CSCI-UA.0102 Fall 2012 Lecture 1: administrative details Professor: Evan Korth New York University.
Asymptotic Notation (O, Ω, )
MS 101: Algorithms Instructor Neelima Gupta
Sorting – Insertion and Selection. Sorting Arranging data into ascending or descending order Influences the speed and complexity of algorithms that use.
Data Structures Engr. Umbreen sabir What The Course Is About s Data structures is concerned with the representation and manipulation of data. s All programs.
Chapter 5 Algorithms (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Lecture #9: Sorting Algorithms خوارزميات الترتيب Dr. Hmood Al-Dossari King Saud University Department of Computer Science 22 April 2012.
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2003 Mr. Frey (0101 – 0104) Mr. Raouf (0201 – 0204)
Sorting and Searching. Searching  Problem definition: Given a value X, return the index of X in the array if such X exist. Otherwise, return NOT_FOUND(-1).
CSC 201 Analysis and Design of Algorithms Lecture 05: Analysis of time Complexity of Sorting Algorithms Dr.Surasak Mungsing
Data Structures, Algorithms, & Applications Instructor: Babak Alipour Slides and book: Sartaj Sahni.
CS 162 Intro to Programming II Insertion Sort 1. Assume the initial sequence a[0] a[1] … a[k] is already sorted k = 0 when the algorithm starts Insert.
Data Structures and Algorithms in Java AlaaEddin 2012.
Computer Science 1620 Sorting. cases exist where we would like our data to be in ascending (descending order) binary searching printing purposes selection.
Program Performance 황승원 Fall 2010 CSE, POSTECH. Publishing Hwang’s Algorithm Hwang’s took only 0.1 sec for DATASET1 in her PC while Dijkstra’s took 0.2.
Sorting  Selection Sort  Bubble Sort  Insertion Sort  Merge Sort (chap. 14)  Quick Sort (chap. 14)  Heap Sort (chap. 9)
Data Structures Dai Tian-Shyr
CMPT 238 Data Structures Instructor: Tina Tian. General Information Office: RLC 203A Office Hour: Tue and Fri 12:30 - 2:00PM.
Complexity of Algorithms Fundamental Data Structures and Algorithms Ananda Guna January 13, 2005.
Prof. Amr Goneid, AUC1 CSCE 210 Data Structures and Algorithms Prof. Amr Goneid AUC Part 8a. Sorting(1): Elementary Algorithms.
CSCI 6212 Design and Analysis of Algorithms Which algorithm is better ? Dr. Juman Byun The George Washington University Please drop this course if you.
Data Structures, Algorithms, & Applications
CSCE 210 Data Structures and Algorithms
Data Structures, Algorithms, & Applications
CSCE 210 Data Structures and Algorithms
CSCE 121, Sec 200 Fall 2012 Prof. Jennifer L. Welch.
COP 3503 FALL 2012 Shayan Javed Lecture 15
Chapter 2 (16M) Sorting and Searching
Chapter 7 Sorting Spring 14
Computer Science 102 Data Structures CSCI-UA
CS 583 Fall 2006 Analysis of Algorithms
Foundations II: Data Structures and Algorithms
Data Structures, Algorithms, & Applications
Data Structures: Introductory lecture
Asst. Dr.Surasak Mungsing
Data Structures, Algorithms, & Applications
Sorting Rearrange a[0], a[1], …, a[n-1] into ascending order.
CSE 373 Sorting 2: Selection, Insertion, Shell Sort
Presentation transcript:

Data Structures and Algorithms Dr. Manuel E. Bermudez Alter ego to Dr. Sartaj Sahni

Clip Art Sources s s s s

What The Course Is About s Data structures is concerned with the representation and manipulation of data. s All programs manipulate data. s So, all programs represent data in some way. s Data manipulation requires an algorithm.

What The Course Is About Algorithm design methods needed to develop programs that do the data manipulation. The study of data structures and algorithms is fundamental to Computer Science.

Prerequisites s Asymptotic Complexity  Big Oh, Theta, and Omega notations s C++ (huh ?)

Web Site s Follow link to COP s READ ALL OF IT. s Syllabus, text, source codes, exercise solutions, lectures, assignments, past exams, past exam solutions, TAs, etc.

Source Codes s Download source codes from Web site and make sure you can compile and execute at least one code. s Use the readme file to map text programs to file names. s X.cpp is C++ program; X.output is output generated by X.cpp; and X.input is the input data (if any is required).

Organization of Text s Three parts s Part I … Chapters 1-4, Background s Part 2 … Chapters 5-16, Data Structures s Part 3 … Chapters 17-21, Algorithms s Each chapter … concepts + applications

Grades s 40% for assignments (weekly) s 20% midterm 1. s 20% midterm 2. s 20% final exam.

Grades (Rough Cutoffs) NOTE: These differ from those in Dr. Sahni’s course ! GradePoints A A B B83-86 B C C73-76 C D D63-66 D E0-59

Sorting s Rearrange a[0], a[1], …, a[n-1] into ascending order. When done, a[0] <= a[1] <= … <= a[n-1] s 8, 6, 9, 4, 3 => 3, 4, 6, 8, 9

Sort Methods s Insertion Sort s Bubble Sort s Selection Sort s Count Sort s Shaker Sort s Shell Sort s Heap Sort s Merge Sort s Quick Sort

Insert An Element s Given a sorted list/sequence, insert a new element s Given 3, 6, 9, 14 s Insert 5 s Result 3, 5, 6, 9, 14

Insert an Element s 3, 6, 9, 14 insert 5 s Compare new element (5) and last one (14) s Shift 14 right to get 3, 6, 9,, 14 s Shift 9 right to get 3, 6,, 9, 14 s Shift 6 right to get 3,, 6, 9, 14 s Insert 5 to get 3, 5, 6, 9, 14

Insert An Element // insert t into a[0:i-1] int j; for (j = i - 1; j >= 0 && t < a[j]; j--) a[j + 1] = a[j]; a[j + 1] = t;

Insertion Sort s Start with a sequence of size 1 s Repeatedly insert remaining elements

Insertion Sort s Sort 7, 3, 5, 6, 1 s Start with 7 and insert 3 => 3, 7 s Insert 5 => 3, 5, 7 s Insert 6 => 3, 5, 6, 7 s Insert 1 => 1, 3, 5, 6, 7

Insertion Sort for (int i = 1; i < n; i++) {// insert a[i] into a[0:i-1] // code to insert comes here }

Insertion Sort for (int i = 1; i < n; i++) {// insert a[i] into a[0:i-1] int t = a[i]; int j; for (j = i - 1; j >= 0 && t < a[j]; j--) a[j + 1] = a[j]; a[j + 1] = t; }