Algorithm Issues. Executive Summary Just because you understand the math doesn’t mean the executive wants to hear it. Just because you understand the.

Slides:



Advertisements
Similar presentations
Recursion Chapter 14. Overview Base case and general case of recursion. A recursion is a method that calls itself. That simplifies the problem. The simpler.
Advertisements

Chapter 7 Sorting Part II. 7.3 QUICK SORT Example left right pivot i j 5 > pivot and should go to the other side. 2 < pivot and should go to.
Algorithms Analysis Lecture 6 Quicksort. Quick Sort Divide and Conquer.
Practice Quiz Question
Sorting Algorithms Bryce Boe 2012/08/13 CS32, Summer 2012 B.
Quick Sort, Shell Sort, Counting Sort, Radix Sort AND Bucket Sort
SORTING ROUTINES. OBJECTIVES INTRODUCTION BUBBLE SORT SELECTION SORT INSERTION SORT QUICK SORT MERGE SORT.
David Streader Computer Science Victoria University of Wellington Copyright: David Streader, Victoria University of Wellington Recursion COMP T1.
Efficient Sorts. Divide and Conquer Divide and Conquer : chop a problem into smaller problems, solve those – Ex: binary search.
ISOM MIS 215 Module 7 – Sorting. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
Quicksort CS 3358 Data Structures. Sorting II/ Slide 2 Introduction Fastest known sorting algorithm in practice * Average case: O(N log N) * Worst case:
25 May Quick Sort (11.2) CSE 2011 Winter 2011.
Chapter 7: Sorting Algorithms
Data Structures Data Structures Topic #13. Today’s Agenda Sorting Algorithms: Recursive –mergesort –quicksort As we learn about each sorting algorithm,
Quicksort, Mergesort, and Heapsort. Quicksort Fastest known sorting algorithm in practice  Caveats: not stable  Vulnerable to certain attacks Average.
Updated QuickSort Problem From a given set of n integers, find the missing integer from 0 to n using O(n) queries of type: “what is bit[j]
Quick Sort. Quicksort Quicksort is a well-known sorting algorithm developed by C. A. R. Hoare. The quick sort is an in-place, divide- and-conquer, massively.
C Programming - Lecture 7 This lecture we will learn: –How to write documentation. Internal docs. External docs. User docs. (But not much about this).
Data Structures and Algorithms
CSE 1302 Lecture 22 Quick Sort and Merge Sort Richard Gesick.
CS 162 Intro to Programming II Quick Sort 1. Quicksort Maybe the most commonly used algorithm Quicksort is also a divide and conquer algorithm Advantage.
Chapter 11 Sorting and Searching. Copyright © 2005 Pearson Addison-Wesley. All rights reserved Chapter Objectives Examine the linear search and.
General Computer Science for Engineers CISC 106 James Atlas Computer and Information Sciences 10/23/2009.
CHAPTER 11 Sorting.
CS2420: Lecture 10 Vladimir Kulyukin Computer Science Department Utah State University.
Chapter 7 (Part 2) Sorting Algorithms Merge Sort.
Mergesort and Quicksort Chapter 8 Kruse and Ryba.
Sorting Algorithms and Analysis Robert Duncan. Refresher on Big-O  O(2^N)Exponential  O(N^2)Quadratic  O(N log N)Linear/Log  O(N)Linear  O(log N)Log.
 The Dinky Database Dantai has received an unreasonable number of complaints about the speed of their Zip Code sorting procedure  DDD has hired you.
External Sorting Problem: Sorting data sets too large to fit into main memory. –Assume data are stored on disk drive. To sort, portions of the data must.
1 Data Structures and Algorithms Sorting. 2  Sorting is the process of arranging a list of items into a particular order  There must be some value on.
Recursion, Complexity, and Searching and Sorting By Andrew Zeng.
1 Time Analysis Analyzing an algorithm = estimating the resources it requires. Time How long will it take to execute? Impossible to find exact value Depends.
Recursion, Complexity, and Sorting By Andrew Zeng.
CSC 213 Lecture 12: Quick Sort & Radix/Bucket Sort.
CSCE 3110 Data Structures & Algorithm Analysis Sorting (I) Reading: Chap.7, Weiss.
Quicksort, Mergesort, and Heapsort. Quicksort Fastest known sorting algorithm in practice  Caveats: not stable  Vulnerable to certain attacks Average.
Order Statistics. Order statistics Given an input of n values and an integer i, we wish to find the i’th largest value. There are i-1 elements smaller.
Chapter 5 Searching and Sorting. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter Objectives Examine the linear search and binary.
Centroids part 2 Getting rid of outliers and sorting.
Fundamentals of Algorithms MCS - 2 Lecture # 15. Bubble Sort.
Sorting List is rearranged into sorted order How is the sorted order determined? – The ItemType is responsible for determining the key to be used in comparison.
New Mexico Computer Science For All Sorting Algorithms Maureen Psaila-Dombrowski.
Sorting What makes it hard? Chapter 7 in DS&AA Chapter 8 in DS&PS.
Sorting: Implementation Fundamental Data Structures and Algorithms Klaus Sutner February 24, 2004.
1 Sorting. 2 Introduction Why is it important Where to use it.
Chapter 8 Sorting and Searching Goals: 1.Java implementation of sorting algorithms 2.Selection and Insertion Sorts 3.Recursive Sorts: Mergesort and Quicksort.
Review 1 Selection Sort Selection Sort Algorithm Time Complexity Best case Average case Worst case Examples.
Quick sort, lower bound on sorting, bucket sort, radix sort, comparison of algorithms, code, … Sorting: part 2.
Quicksort Data Structures and Algorithms CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and Computer.
Sorting 1. Insertion Sort
Chapter 9 Sorting 1. The efficiency of data handling can often be increased if the data are sorted according to some criteria of order. The first step.
PREVIOUS SORTING ALGORITHMS  BUBBLE SORT –Time Complexity: O(n 2 ) For each item, make (n –1) comparisons Gives: Comparisons = (n –1) + (n – 2)
Sorting Quick, Merge & Radix Divide-and-conquer Technique subproblem 2 of size n/2 subproblem 1 of size n/2 a solution to subproblem 1 a solution to.
Search Algorithms Written by J.J. Shepherd. Sequential Search Examines each element one at a time until the item searched for is found or not found Simplest.
QuickSort. Yet another sorting algorithm! Usually faster than other algorithms on average, although worst-case is O(n 2 ) Divide-and-conquer: –Divide:
Mergesort and Quicksort Opening Discussion zWhat did we talk about last class? zDo you have any questions about assignment #4? Have you thought.
Sorting: why?  We do it A LOT!  Makes finding the largest and smallest value easier  Makes finding how many of a certain value are in a list easier.
Computer Sciences Department1. Sorting algorithm 4 Computer Sciences Department3.
CMPT 238 Data Structures More on Sorting: Merge Sort and Quicksort.
Lists and Sorting Algorithms
COMP 53 – Week Seven Big O Sorting.
Chapter 7 Sorting Spring 14
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Unit-2 Divide and Conquer
EE 312 Software Design and Implementation I
ITEC 2620M Introduction to Data Structures
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Data Structures and Algorithms CS 244
Presentation transcript:

Algorithm Issues

Executive Summary Just because you understand the math doesn’t mean the executive wants to hear it. Just because you understand the math doesn’t mean the executive wants to hear it. Talk about Talk about Results Results Benefits Benefits NOT the process NOT the process

Passive Voice Abuse It would be recommended that your sorting algorithm be switched to Quicksort. It would be recommended that your sorting algorithm be switched to Quicksort. I recommend that you switch your sorting algorithm to Quicksort. I recommend that you switch your sorting algorithm to Quicksort.

Random Good: “Pick an element from the array at random, to use as the pivot point.” Good: “Pick an element from the array at random, to use as the pivot point.” Bad: “The zip codes, currently in random order, can be sorted using…” Bad: “The zip codes, currently in random order, can be sorted using…”

Words that aren’t really words … till all the elements are sorted. … till all the elements are sorted. u look 4 u look 4

These are not the words you’re looking for. The algorithm will resort the data… The algorithm will resort the data… Deer sir, Deer sir, Zip coed Zip coed

Punting the ball Providing a list of resources, for further study? Good. Providing a list of resources, for further study? Good. Giving a URL describing recursion instead of describing it yourself? Bad. Giving a URL describing recursion instead of describing it yourself? Bad.

Are these really quotations? The “Quicksort” algorithm will be able to sort your data much faster than the “Bubblesort” algorithm. The “Quicksort” algorithm will be able to sort your data much faster than the “Bubblesort” algorithm.

On that note... quicksort, Quicksort, quick sort, Quick Sort quicksort, Quicksort, quick sort, Quick Sort mergesort, Mergesort, merge sort, Merge Sort mergesort, Mergesort, merge sort, Merge Sort bubblesort, Bubblesort, Bubble sort, Bubble Sort bubblesort, Bubblesort, Bubble sort, Bubble Sort Pick one. Stick with it. Pick one. Stick with it.

Who are you talking to? First, you take the first element in the array… First, you take the first element in the array… Then we move all the elements less than the pivot point to its left… Then we move all the elements less than the pivot point to its left… Next, move the larger elements to the right… Next, move the larger elements to the right… Finally, the function calls itself recursively. Finally, the function calls itself recursively.

Pet peeve: To Be Using Utilizing This algorithm will be using… This algorithm will be using… This algorithm will use… This algorithm will use… This algorithm will utilize… This algorithm will utilize… Again, this algorithm will use... Again, this algorithm will use...

“… will sort the zip codes in a well ordered fashion.” “… will sort the zip codes in a well ordered fashion.” No. No. It will sort them in order. It will sort them in order. Be precise. Be precise.

Beware of Superlatives Bubble sort is the simplest sorting algorithm, but it is also the slowest. Bubble sort is the simplest sorting algorithm, but it is also the slowest. Quicksort is the fastest sorting algorithm available. Quicksort is the fastest sorting algorithm available.

Substantive issues Define recursion. Define recursion. Mergesort: describe both the sorting and the merging. Merging is the more difficult part. Mergesort: describe both the sorting and the merging. Merging is the more difficult part.

Provide examples. Walk the reader through the steps, even when some of those steps are repetitive. Provide examples. Walk the reader through the steps, even when some of those steps are repetitive. Not everyone understands a concept the first time. Not everyone understands a concept the first time.

Potentially false promises “Mergesort runs 300 times faster than Bubble sort.” “Mergesort runs 300 times faster than Bubble sort.” “Quicksort takes 10 seconds to sort what would take Bubblesort 52 minutes.” “Quicksort takes 10 seconds to sort what would take Bubblesort 52 minutes.”

The path to the Dark Side “Merge sort can sort a database of 10,000 entries up to 2,500 times faster than Bubble sort.” “Merge sort can sort a database of 10,000 entries up to 2,500 times faster than Bubble sort.” An executive may not know that O(n*log(n)) time is much, much faster than O(n^2) time. An executive may not know that O(n*log(n)) time is much, much faster than O(n^2) time. But an executive will know that “up to” is potentially bullshit. But an executive will know that “up to” is potentially bullshit.

Beware of over-promising: Beware of over-promising: “Once your company switches to Mergesort, your current inefficiencies will disappear and profits will skyrocket.” “Once your company switches to Mergesort, your current inefficiencies will disappear and profits will skyrocket.” Come on, you’re just improving the sorting algorithm. Come on, you’re just improving the sorting algorithm. Don’t assume this sole issue will make or break the entire company. Don’t assume this sole issue will make or break the entire company.