16 Pages

week14

Course: CPS 006, Fall 2009
School: Duke
Rating:
 
 
 
 
 

Word Count: 1163

Document Preview

Revolution: Genome COMPSCI 006G 14.1 From practice to theory and back again In theory there is no difference between theory and practice, but not in practice How do we search an array or an ArrayList for a value? I'm thinking of a number from 1 to 100 What if I tell you: low, high, correct? What if I tell you: yes or no? Two kinds of array search Binary search, like dictionary lookup, requires sorted list...

Register Now

Unformatted Document Excerpt

Coursehero >> North Carolina >> Duke >> CPS 006

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Revolution: Genome COMPSCI 006G 14.1 From practice to theory and back again In theory there is no difference between theory and practice, but not in practice How do we search an array or an ArrayList for a value? I'm thinking of a number from 1 to 100 What if I tell you: low, high, correct? What if I tell you: yes or no? Two kinds of array search Binary search, like dictionary lookup, requires sorted list Sequential search, old-fashioned phone book search for number Which algorithm is better? Slower ones are often "good enough" simple to implement Some fast algorithms are better than others Genome Revolution: COMPSCI 006G 14.2 Tools for algorithms and programs We can time different methods, but how to compare timings? Different on different machines, what about "workload"? Mathematical tools can help analyze/discuss algorithms We often want to sort by different criteria Sort CDs by artist, title, genre, length, ... Sort directories/files by size, alphabetically, or by date Object-oriented concepts can help in implementing sorts We often want to sort different kinds of arrays: String and int Don't want to duplicate the code, that leads to errors Generic programming helps, new in Java 5, now Objects Genome Revolution: COMPSCI 006G 14.3 To code or not to code, that is the ... Should you call an existing sorting routine or write your own? If you can, don't rewrite code written and accessible Sometimes you don't know what to call Sometimes you can't call the existing library routine In Java there are standard sort functions that can be used with built-in arrays and with ArrayLists Accessible via java.util.Arrays/Collectoins These are robust and fast and code is readable Also code for searching and min/max finding Divided between Arrays and Collections Genome Revolution: COMPSCI 006G 14.4 From practical to theoretical We want a notation for discussing differences between algorithms, avoid empirical details at first Empirical studies needed in addition to theoretical studies As we'll see, theory hides some details, but still works Binary search : roughly 10 entries in a 1,000 element vector What is exact relationship? How to capture "roughly"? Compared to sequential/linear search? We use O-notation, big-Oh, to capture properties but avoid details N2 is the same as 13N2 is the same as 13N2 + 23N O(N2), in the limit everything is the same Genome Revolution: COMPSCI 006G 14.5 Running times @ 106 instructions/sec N O(log N) O(N) O(N log N) 0.000033 0.000664 0.010000 0.132900 1.661000 19.9 18.3 hr O(N2) 0.0001 0.1000 1.0 1.7 min 2.78 hr 11.6 day 318 centuries 10 0.000003 0.00001 100 0.000007 0.00010 1,000 0.000010 0.00100 10,000 0.000013 0.01000 100,000 0.000017 0.10000 1,000,000 0.000020 1.0 1,000,000,000 0.000030 16.7 min Genome Revolution: COMPSCI 006G 14.6 What does table show? Hide? Can we sort a million element array with selection sort? How can we do this, what's missing in the table? What are hidden constants, low-order terms? Can we sort a billion-element array? Are there other sorts? We'll see quicksort, an efficient (most of the time) method O(N log N), what does this mean? Sorting code for different algorithms java.util Collections and Object arrays use same algorithm/code Primitive types: int, double, ... use different algorithm Genome Revolution: COMPSCI 006G 14.7 Who is Alan Perlis? It is easier to write an incorrect program than to understand a correct one Simplicity does not precede complexity, but follows it If you have a procedure with ten parameters you probably missed some If a listener nods his head when you're explaining your program, wake him up Programming is an unnatural act Won first Turing award http://www.cs.yale.edu/homes/perlis-alan/quotes.html Genome Revolution: COMPSCI 006G 14.8 Selection sort: summary Simple to code n2 sort: n2 comparisons, n swaps selectSort(String[] void a) { for(int k=0; k < a.length; k++){ int minIndex = findMin(a,k); swap(a,k,minIndex); } } # comparisons: k = 1 + 2 + ... + n = n(n+1)/2 = O(n2) k=1 Swaps? Sorted, won't move ????? Invariant: final position Genome Revolution: COMPSCI 006G 14.9 n From smarter code to algorithm We've seen selection sort, other O(N2) sorts include Insertion sort: better on nearly sorted data, fewer comparisons, potentially more data movements (selection) Bubble sort: dog, dog, dog, don't use it Efficient sorts are trickier to code, but not too complicated Often recursive as we'll see, use divide and conquer Quicksort and Mergesort are two standard examples Mergesort divide and conquer Divide vector in two, sort both halfs, merge together Merging is easier because sub-arrays sorted, why? Genome Revolution: COMPSCI 006G 14.10 Quicksort, an efficient sorting algorithm Step one, partition the vector, moving smaller elements left, larger elements right Formally: choose a pivot element, all elements less than pivot moved to the left (of pivot), greater moved right After partition/pivot, sort left half and sort right half original partition on 14 partition on 10 14 12 15 6 3 10 17 12 6 10 3 14 15 17 3 6 10 12 14 15 17 Genome Revolution: COMPSCI 006G 14.11 Quicksort details void quick(String[] a,int first,int last) // pre: first <= last // piv: a[first] <= ... <= a[list] { int piv; if (first < last) { piv = pivot(a,first,last); quick(a,first,piv-1); quick(a,piv+1,last); } } // original call is Quick(a,0,a.length-1); How do we make progress towards base case? What's a good pivot versus a bad pivot? What changes? What about the code for pivot? What about other types of arrays? Genome Revolution: COMPSCI 006G 14.12 What is complexity? We've used O-notation, (big-Oh) to describe algorithms Binary search is O(log n) Sequential search is O(n) Selection sort is O(n2) Quicksort is O(n log n) What do these measures tell us about "real" performance? When is selection sort better than quicksort? What are the advantages of sequential search? Describing the complexity of algorithms rather than implementations is important and essential Empirical validation of theory is important too Genome Revolution: COMPSCI 006G 14.13 Do it fast, do it slow, can we do it at all? So...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Duke - CPS - 006
What is Information? http:/dictionary.com1. 2. 3. 4.5. 6. 7.Knowledge derived from study, experience, or instruction. Knowledge of specific events or situations that has been gathered or received by communication; intelligence or news. A collection of
Duke - CPS - 006
Interfaces: improving ShotgunWe don't want to use a String to represent a DNA strand/sequence Probably not efficient for merging two strands Strands can't have annotations: names, features,. Doesn't mirror what's done in BioJava library We want to use a
Duke - CPS - 006
From Interfaces to IteratorsWe want to look at all the elements in an ArrayList We want to look at all the genomic sequences in a FASTA file We want to read all the words in a file We want to read all the lines in a file We want to iterate over a collect
Duke - CPS - 006
What is the Object Concept?Ask not what you can do to an object, ask what an object can do to itself Object has internal state, data Operations on the object affect the internal state Can expose state to client programs Can change state in some waysAn
Duke - CPS - 006
Refactoring, what, when,how?Programs are hard to get right the first time Similar to an essay paper? Rewrite? Code isn't fast enough, but it works Code isn't general enough, but it solves the problem Code passes initial tests, then becomes problematic R
Duke - CPS - 006
FOCUS COMPSCI 006G Genome RevolutionOwen Astrachan http:/www.cs.duke.edu/courses/cps006g/fall04 http:/www.cs.duke.edu/~olaGenome Revolution: COMPSCI 006G1.1Where are we going?What is computer science? What is biology? What is computational biology? W
Duke - CPS - 006
How to design/write programsStart with a small, working program Don't write 10's, 100's, 1000's of lines before compiling Compile, test, implement, repeat Add features to an already working program A program designed to do nothing is a known entity No re
Duke - CPS - 130
Meeting 26December 1, 2004Approximation Algorithms(read Section 35 on Approximation Algorithms in C ORMEN , L EISERSON , R IVEST, S TEIN)98 UQT q8eddD( q 55 63 4(1 Vertex Cover. The rst problem we consider is nding the minimum set of vertices in
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Helvetica Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radi
Duke - CPS - 130
Meeting 25November 29, 2004NP-Complete Problems(read Section 34 on NP-Completeness in C ORMEN , L EISERSON , R IVEST, S TEIN)Step 2. Convert each clause into disjunctive normal form. The most mechanical way uses the truth table for each clause, as ill
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Helvetica Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radi
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Helvetica Times-Bold Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.c
Duke - CPS - 130
Meeting 24November 22, 2004Easy and Hard Problems(read Section 34 on NP-Completeness in C ORMEN , L EISERSON , R IVEST, S TEIN)P92 B5 1 i`@47dX h$#8g7 X `V7A2X 7 B5 1 B 5 1 8 fe@47dX cb7 #Ua`YX B5 1 W2VA7 7 R $#UTSQAs an example consider the shorte
Duke - CPS - 130
Meeting 23November 17, 2004Pattern MatchingThis material is not covered in our textbook but you can read about pattern matching in Chapter I.3 of Algorithms on Strings, Trees, and Sequences by G USFIELD.the sequence starts with a non-empty sequence of
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 23November 15, 2004Searching with StringsThis material is not covered in our textbook but you can read about keyword trees and sufx trees in Chapters I and II of Algorithms on Strings, Trees, and Sequences by G USFIELD.o1p1t a2 3 1 1 2t
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 21November 10, 2004String Matching(read Section 32 on String Matching in C ORMEN , L EISERSON , R IVEST, S TEIN)HOCUSPOCUSABRA BRACADABRA. ABRA ABR AB A CADABRA ACADABRA RACADABRA BRACADABRAThe straightforward approach to solving this problem
Duke - CPS - 130
Meeting 20November 8, 2004Union-Find(read Section 21 on Data Structures for Disjoint Sets in C ORMEN , L EISERSON , R IVEST, S TEIN)This section presents two data structures for the disjoint set system problem we encountered in the implementation of K
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Italic Times-Bold Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 4 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 19November 3, 2004Minimum Spanning Trees(read Sections 23 on Minimum Spanning Trees in C ORMEN , L EISERSON , R IVEST, S TEIN)aepdg hi; while is not a spanning tree do find a safe edge ; endwhile. There are safe edges as long as is a p
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 18November 1, 2004Shortest Paths(read Sections 24 and 25 on Shortest Paths in C ORMEN , L EISERSON , R IVEST, S TEIN)One of the most common operations in graphs is nding shortest paths between vertices. This section discusses three algorithms:
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 17October 27, 2004Graph Search(read Section 22 on Elementary Graph Algorithms in C ORMEN , L EISERSON , R IVEST, S TEIN)2 1 0 )( ' % &quot; &amp;$#! which is symmetric. Often the number of edges is quite3 40 1 2 3 4VFigure 83: A sample graph with
Duke - CPS - 130
Meeting 16October 25, 2004Splay Trees, IIThis material is not covered in our textbook. You can read about splay trees in Section 7.3 of Data Structures and Their Algorithms by L EWIS , D ENENBERG and about optimum weighted binary search trees in Sectio
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 15October 20, 2004Splay Trees, IThis material is not covered in our textbook but you can read about splay trees in Section 7.3 of Data Structures and Their Algorithms by L EWIS , D ENENBERG.Node Z IG Z IG Node return Z IG Z IG . 4 3 2 1 1 2
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 14October 18, 2004Fibonacci Heaps, II(read Section 20 on Fibonacci Heaps in C ORMEN , L EISERSON , R IVEST, S TEIN)We still need to discuss the D ECREASE K EY and the D ELETE operations for Fibonacci heaps. Both change the structure of the hea
Duke - CPS - 130
Meeting 13October 13, 2004Fibonacci Heaps, I(read Section 19 on Binomial Heaps and Section 20 on Fibonacci Heaps in C ORMEN , L EISERSON , R IVEST, S TEIN)4 9 10 11 87 95 94 10 11 8 15+15=12 15 13 9Figure 63: Binomial trees of heights 0, 1, 2,
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Midterm ExamOctober 4, 2004Midterm(75 minutes open book exam)(b) There are 14 different parenthesizations, and they are 23723('&amp;$2&amp;$&quot; ) #) # #&quot; #&quot; # 21343('1&amp;'&amp;$&quot; ) #) # #&quot; #&quot; # 213('635$1%$&quot; ) # #&quot; ) # #&quot; # 2110($&amp;'&amp;$%$&quot; ) # #&quot; #&quot; #&quot; #endwhile; unt
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 2 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 12October 4, 2004Amortized Analysis(read Section 18 on Amortized Analysis in C ORMEN , L EISERSON , R IVEST, S TEIN)Amortization is an analysis technique that can inuence the design of algorithms in a profound way. Later, we will see a few dat
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 11September 29, 2004Solving Recurrence Relations(read Section 4 on Recurrences in C ORMEN , L EISERSON , R IVEST, S TEIN)Recurrence relations are perhaps the most important tool in the analysis of algorithms. We have encountered several method
Duke - CPS - 130
Meeting 10September 27, 2004Greedy Algorithms(read Section 16 on Greedy Algorithms in C ORMEN , L EISERSON , R IVEST, S TEIN)A scheduling problem. Consider a set of activities, . Activity has start time and nish time . Two activities and overlap if .
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 9September 22, 2004Dynamic Programming(read Section 15 on Dynamic Programming in C ORMEN , L EISERSON , R IVEST, S TEIN)Figure 41: The rst parenthesization takes elementary multiplications. second takes34t xw0 0s ivh0Although the resulting
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSComma
Duke - CPS - 130
Meeting 8September 20, 2004Hash Tables(read Section 11 on Hash Tables in C ORMEN , L EISERSON , R IVEST, S TEIN).0T0.x x.m 1Figure 38: Each table element is a pointer to a linked list.Hashing. In hashing we store at a location , where is a fu
Duke - CPS - 130
Meeting 7September 18, 2004Skip ListsThis material is not covered in our textbook but you can read about skip-lists in Section 6.3 of Ordered Lists in Data Structures and Their Algorithms by L EWIS , D ENENBERG.In searching it is important that the da
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 4 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Italic Times-Bold %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPS
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 6September 13, 2004Red-Black Trees(read Section 13 on Red-Black Trees in C ORMEN , L EISERSON , R IVEST, S TEIN)Binary search trees are an elegant implementation of the dictionary data type, which requires support for item S EARCH (item), void
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 4 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Italic Courier Times-Bold %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 5September 8, 2004Binary Search Trees(read Section 12 on Binary Search Trees in C ORMEN , L EISERSON , R IVEST, S TEIN)ancestors rootBinary trees. We have used binary trees repeatedly and now return to a more formal and systematic introductio
Duke - CPS - 130
Meeting 4September 6, 2004Selection(read Section 9 on Medians and Order Statistics in C ORMEN , L EISERSON , R IVEST, S TEIN)Deterministic Selection. The randomized selection algorithm takes time proportional to in the worst case,13int RS ELECT int
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Courier Times-Bold Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 3September 1, 2004Linear-time Sorting(read Section 8 on Sorting in Linear Time in C ORMEN , L EISERSON , R IVEST, S TEIN)We have seen two algorithms which both sort items in time proportional to . Can we be sure that there are no faster algori
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 2August 30, 2004HeapSort(read Section 6 on Heapsort in C ORMEN , L EISERSON , R IVEST, S TEIN)Priority Queues. A data structure implements the priority queue abstract data type if it supports at least the following operations: I NSERT, F IND M
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Times-Italic Courier %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: Book.dvi %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: Times-Roman Times-Bold Courier Times-Italic %EndComments %DVIPSWebPage: (www.radicaleye.com
Duke - CPS - 130
Meeting 1August 25, 2004QuickSort(read Section 7 on Quicksort in C ORMEN , L EISERSON , R IVEST, S TEIN)Quicksort has the reputation of being the fasted comparison-based sorting algorithm. Indeed it is very fast on the average but can be slow in bad c