3 Pages

week10

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

Word Count: 335

Document Preview

improving Interfaces: Shotgun We 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 class to represent a sequence, but we don't want to force client code into using a specific class Doesn't allow for future improvements Doesn't allow for...

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.
improving Interfaces: Shotgun We 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 class to represent a sequence, but we don't want to force client code into using a specific class Doesn't allow for future improvements Doesn't allow for idiosyncratic coding requirements Doesn't adhere to good engineering principles What are our options? 10.1 Genome Revolution: COMPSCI 006G Whats a class? State and behavior What behavior does a Strand have? Construct from As far as shotgun goes, what are operations on strand? In addition to shotgun, what might we do with strands? List constructors, methods, What state does a strand need to accomplish this behavior? Postpone this decision as long as possible Once we decide, how can we allow for future changes? Refactoring? Private state and behavior 10.2 Genome public Revolution: COMPSCI 006G Starting design/implementation Start with something simple we can test Develop a plan for adding behavior Add behavior and test incrementally Design and implement tests with outside classes or methods internal to the class were building Advantages and disadvantages? White box/Clear box and black box testing Black box means we cant see inside what were testing Advantages and disadvantages? Other approaches? Genome Revolution: COMPSCI 006G 10.3 Example: Rectangle We want to implement a Rectangle class. Why? Co...

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
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 )( ' % " &$#! 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('&$2&$" ) #) # #" #" # 21343('1&'&$" ) #) # #" #" # 213('635$1%$" ) # #" ) # #" # 2110($&'&$%$" ) # #" #" #" #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
Duke - CPS - 130
August 23, 2004Introduction and OverviewOrganizationMeetings. We meet twice a week, and with possibly one or two exceptions always on Mondays and Wednesdays, from 1:15 to 2:30pm, in room D106 LSRC. Communication. The course material will be delivered i
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 Helvetica %EndComments %DVIPSWebPage: (www.radi