Lesson Plan 2 Bubble Sort Quick Sort Contents Evocation Objective Introduction Bubble Sort Bubble Sort Algorithm Quick Sort Quick Sort Algorithm Mind Map Summary Evocation Objective To study the basic knowledge of bubble sort algorithm ID: 277140
Download Presentation The PPT/PDF document "Exchange Sorts" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Exchange Sorts
Lesson Plan - 2: Bubble Sort, Quick SortSlide2
Contents
Evocation
Objective
Introduction
Bubble Sort
Bubble Sort Algorithm
Quick Sort
Quick Sort Algorithm
Mind Map
SummarySlide3
EvocationSlide4
Objective
To study the basic knowledge of bubble sort algorithm
To learn about the basic concept of quick sort algorithm Slide5
Introduction-Exchange Sort
Exchange the elements that are out of order until the entire list is sorted
Bubble Sort
List at any movement is divided into two sublists: Sorted and Unsorted
Smallest element is bubbled from unsorted sublist and moved to sorted sublist
Given a list of n elements, bubble sort requires n-1 passes to sort dataSlide6
Bubble Sort ExamplesSlide7
Bubble Sort AlgorithmSlide8
EvocationSlide9
Quick Sort
Quick sort is an exchange sort in which a pivot key is placed in its correct position in the array while rearranging other elements widely discussed across the list
Each iteration of quick sort selects an element known as pivot
Divide the lists into three groups
Partition of elements whose keys are less than pivots key
Pivot element is placed in correct location in list
Partition of elements greater than or equal to pivots key
Quick sorting left partition followed by sorting right partition Slide10
Quick Sort
Hoare’s Algorithm
Select pivot key as first element in list
Singleton Algorithm
Select pivot key as median value of three elements left, right and element in middle of list
Once median value is determined it is exchanged with left elementSlide11
Quick Sort PartitionsSlide12
Quick Sort AlgorithmSlide13Slide14Slide15Slide16Slide17Slide18Slide19Slide20
Hidden picture puzzle EasterSlide21
Quick Sort Algorithm
To determine correct position of pivot element
Start from two ends of array towards middle
Use median value of three elements
Before exchange starts, median element in middle position and smallest of three element used to determine median in right location
After median left algorithm, median is in left position and smallest in middle location
Pivot key is moved to hold area to facilitate processingSlide22
Mind Map
Exchange Sort
Bubble Sort
Quick Sort
Algorithm
Examples
Quick Sort
Partitions
Quick Sort
Algorithms
Straight Insertion Module
Determine
median
of three
Quick Sort AlgorithmSlide23
Summary
Exchange sort systematically exchange elements that are out of order until list is sorted
Two methods of exchange sorts are bubble sort and quick sort
In bubble sort, list at any movement is divided into two sublists: Sorted and Unsorted
In each pass the smallest element is bubbled from unsorted sublist and moved to sorted sublist
In quick sort, list is continuously divided into smaller sublists and exchanging takes place between elements that are out of orderSlide24
Summary
Each pass of quick sort selects a pivot and divides the list into three groups
Partition of elements whose key is less than pivots key
Pivot element is placed in correct location in list
Partition of elements greater than or equal to pivots key
Quick sorting left partition followed by sorting right partition
Quick sort algorithm is mainly based on three steps straight insertion module, determine median of three and quick sort