For Monday Read Weiss, chapter 7, sections 4-6 Homework: - - PowerPoint PPT Presentation

for monday
SMART_READER_LITE
LIVE PREVIEW

For Monday Read Weiss, chapter 7, sections 4-6 Homework: - - PowerPoint PPT Presentation

For Monday Read Weiss, chapter 7, sections 4-6 Homework: Elementary sorting homework described on Blackboard in Notes and Homework Programming Assignment 1 Any questions? Instructor vs. Book Bubble Sort Concept is to bubble


slide-1
SLIDE 1

For Monday

  • Read Weiss, chapter 7, sections 4-6
  • Homework:

– Elementary sorting homework described on Blackboard in Notes and Homework

slide-2
SLIDE 2

Programming Assignment 1

  • Any questions?
slide-3
SLIDE 3

Instructor vs. Book

slide-4
SLIDE 4

Bubble Sort

  • Concept is to bubble the largest to the top

(or the smallest to the bottom)

  • Also called exchange sort.
  • Naïve vs. improved bubble sort.
slide-5
SLIDE 5

Selection Sort

  • Basic concept to the find the smallest (or

largest) remaining element and put it in place.

slide-6
SLIDE 6

Insertion Sort

  • Basic concept:

– Conceptually split the list to be sorted into two parts: one that is sorted and one that is not – Repeatedly insert the first element from the unsorted part into the sorted part.

slide-7
SLIDE 7

Performance of Sorting

  • What is the performance?
  • Each sort would be the best choice (of the

simple sorts, at least) in certain situations— what situations?

  • What’s the space cost of these sorting

algorithms?

slide-8
SLIDE 8

Shellsort

  • What’s the concept?
  • h-sorting
  • increment sequence
  • Shell’s sequence {1, 2, 4, 8, …}
  • Hibbard’s sequence {1, 3, 7, 15, …}
  • best sequence known { 1, 5, 19, 41, 109,

…}

slide-9
SLIDE 9

Performance of Shellsort

slide-10
SLIDE 10

Heapsort

  • What’s the concept?
slide-11
SLIDE 11

Heapsort

  • Use max heaps instead of min heaps
  • Use BuildHeap to turn the array into a heap
  • Use deleteMax to remove items from the

beginning of the array, continually moving them to the end of the tree

slide-12
SLIDE 12

Performance of Heapsort