Algorithms_and_Data_Structures_06

Algorithms_and_Data_ - Lecture 6 Computer Science Algorithms and Data Structures Prof Dr Andreas Nchter Research I Room 105 Jacobs University

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Computer Science Algorithms and Data Structures Prof. Dr. Andreas Nüchter Research I, Room 105 Jacobs University Bremen http://www.nuechti.de [email protected] Lecture 6
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Algorithms and Data Structures Dr. Andreas Nüchter September 22, 2009 157 Last Lecture – Introduction To Sorting The sorting problem: Given : keys Wanted : Find a permutation of such that We may only use key comparisons of the form with the semantic:
Background image of page 2
Algorithms and Data Structures Dr. Andreas Nüchter September 22, 2009 158 Last Lecture – Basic Sorting Methods Sorting by Selection Idea : Bring in every step the smallest element of the sequence to the first position. Position Keys Final result
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Algorithms and Data Structures Dr. Andreas Nüchter September 22, 2009 159 Last Lecture – Sorting by Selection Animation (wikipedia) ( Animation ) The Sort Algorithm Animator V1.0 (c) 2000 Erhard Ploedereder, University of Stuttgart
Background image of page 4
Algorithms and Data Structures Dr. Andreas Nüchter September 22, 2009 160 Last Lecture – Basic Sorting Methods Sorting by Insertion Idea : Assumption : are already sorted.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Algorithms and Data Structures Dr. Andreas Nüchter September 22, 2009 161 Last Lecture – Basic Sorting Methods Insertion of is done by comparing with , Example : denotes the insertion position How many comparisons are needed? Position Keys Final result
Background image of page 6
Algorithms and Data Structures Dr. Andreas Nüchter September 22, 2009 162 Last Lecture – Basic Sorting Methods Shell sort See upcoming assignment sheet 4 ( Animation ) The Sort Algorithm Animator V1.0 (c) 2000 Erhard Ploedereder, University of Stuttgart
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Algorithms and Data Structures Dr. Andreas Nüchter September 22, 2009 163 Last Lecture – Basic Sorting Methods Bubble sort The basic idea is to compare two neighboring objects, and to swap them if necessary Positions 1. Run
Background image of page 8
Algorithms and Data Structures Dr. Andreas Nüchter September 22, 2009 164 Merge Sort Merge sort is based on the divide and conquer technique. Idea : Divide the keys which have to be sorted into two halves of equal size ( divide step ): Sort the two halves recursively and exploit in the merging step that the two halves are sorted. The merging step can be performed in linear time ( conquer step ).
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/04/2010 for the course CS 320251 taught by Professor Nuechter during the Fall '09 term at Jacobs University Bremen.

Page1 / 34

Algorithms_and_Data_ - Lecture 6 Computer Science Algorithms and Data Structures Prof Dr Andreas Nchter Research I Room 105 Jacobs University

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online