COP3502_28b_QuickSelect

# COP3502_28b_QuickSelect - Quick Sort Quick Select Computer...

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

Computer Science Department University of Central Florida COP 3502 Recitation Session

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

View Full Document
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
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

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

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

{[ snackBarMessage ]}

### Page1 / 10

COP3502_28b_QuickSelect - Quick Sort Quick Select Computer...

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

View Full Document
Ask a homework question - tutors are online