×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

## Algorithms Design And Analysis

by: Kavon Reynolds

34

0

1

# Algorithms Design And Analysis CS 422

Marketplace > Northern Michigan University > ComputerScienence > CS 422 > Algorithms Design And Analysis
Kavon Reynolds
NMU
GPA 3.72

Michael Kowalczyk

These notes were just uploaded, and will be ready to view shortly.

Either way, we'll remind you when they're ready :)

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

COURSE
PROF.
Michael Kowalczyk
TYPE
Class Notes
PAGES
1
WORDS
KARMA
25 ?

## Popular in ComputerScienence

This 1 page Class Notes was uploaded by Kavon Reynolds on Thursday October 15, 2015. The Class Notes belongs to CS 422 at Northern Michigan University taught by Michael Kowalczyk in Fall. Since its upload, it has received 34 views. For similar materials see /class/224055/cs-422-northern-michigan-university in ComputerScienence at Northern Michigan University.

×

## Reviews for Algorithms Design And Analysis

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/15/15
Algorithm Design and Analysis 2252008 Lecture 19 Linear time selection Instructor Mike Kowalczyk 1 Linear time selection 11 De ne the problem First let s de ne the problem carefully Selection problem lnput Array of n elements and index 0 g k g n 7 1 Output Returns AM where A is the sorted version of A Note that our problem de nition doesn t necessarily say that we actually sort the array it s just a way of specifying the output 12 Divide and conquer algorithm Our idea starts with grouping the n elements in sets of 5 each Then sort each group of 5 take the median of each of group of 5 and recursively nd the median of those medians of 5 Now we know that the median of medians is going to be greater than approximately 37110 elements Similarly it s less than 37110 elements so the median of medians is somewhere from the 310 mark to the 710 mark Because of this we can use the median of medians as a pivot and split up the remaining work just like Quicksort The fact that the pivot is roughly in the middle means that it should be fast but we ll prove this to make sure selectionarray A index k Group A into sets of 5 elements each Sort each set of 5 Let M be the set of medians of those sets of 5 if M is size 1 return MO p selectionM Mlength 2 finds the median of M Use the pivot p to split A into arrays S and B Let S the elements of A that are smaller than p Let B the elements of A that are bigger than p if ISI k ISI denotes the number of elements in S return p else if k lt Isl return selectionS k else k gt ISI

×

×

### BOOM! Enjoy Your Free Notes!

×

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Bentley McCaw University of Florida

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Janice Dongeun University of Washington

#### "I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Jim McGreen Ohio University

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Parker Thompson 500 Startups

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com