COP3502_28b_QuickSelect

COP3502_28b_QuickSelect - Quick Sort & Quick Select...

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

View Full Document Right Arrow Icon
Computer Science Department University of Central Florida COP 3502 Recitation Session
Background image of page 1

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

View Full DocumentRight Arrow Icon
page 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 set. Naïve solution - SORT! we can sort the set in O(n log n) time and then index the k-th element. Can we solve the selection problem faster? 7 4 9 6 2 2 4 6 7 9 k=3
Background image of page 2
page 3 The Selection Problem Can we solve the selection problem faster? Of course we can! We use Quick Select What is Quick Select? Concept is very similar to Quick Sort But in this case, we are not sorting We don’t care about sorting the numbers BUT, we do care about finding the specific element
Background image of page 3

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

View Full DocumentRight Arrow Icon
page 4 Quick-Select Quick-select is a randomized selection algorithm based on the prune-and-search paradigm: Prune : pick a random element
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

COP3502_28b_QuickSelect - Quick Sort & Quick Select...

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

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