1 / 4

Debugging APTs: Going green

Debugging APTs: Going green. SandwichBar APT: from ideas to code to green def whichOrder(available,orders): for idx,sand in enumerate(orders): CirclesCountry APT: from ideas to code to green def leastBorders(x,y,r,x1,y1,x2,y2): count = 0 for i,r in enumerate(r):.

nike
Download Presentation

Debugging APTs: Going green

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Debugging APTs: Going green • SandwichBar APT: from ideas to code to green def whichOrder(available,orders): for idx,sand in enumerate(orders): • CirclesCountry APT: from ideas to code to green def leastBorders(x,y,r,x1,y1,x2,y2): count = 0 for i,r in enumerate(r):

  2. Question from previous Compsci 6 names=["Jessica Chang: Feb 10, 1991", "Leo Rofe: Aug 3, 1973", "Chris Brown: May 14, 1991", "Wayne Dark Light: Dec 25, 1985", "Zhiyi Zhang: Nov 24, 1995"] • Spec for format given, and the call findNames(names,1991) returns… • ["Jessica Chang", "Chris Brown"] def findNames(list,year):

  3. Revisiting cgratio APT • 'cost' of finding likely sources of protein in DNA def cgratio(strand): cg = 0 for nuc in strand: if nuc == 'c' or nuc == 'g': cg += 1 return cg def maxIndex(strand,windowSize): index,max = 0,0 for i in range(0,len(strand)-windowSize+1): cg = cgratio(strand[i:i+windowSize]) if cg > max: max,index = cg,i return index

  4. Revisiting cgratio APT • 'cost' of finding likely sources of protein in DNA def runningMax(strand,windowSize): gc,counters = 0,[] for nuc in strand: counters.append(gc) if nuc == 'c' or nuc == 'g': gc += 1 counters.append(gc) index,max = 0,0 for i in range(windowSize,len(strand)+1): diff = counters[i] - counters[i-windowSize] if diff > max: max,index = diff,i return index-windowSize

More Related