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.
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 - 271
The Problem Learning Probability DistributionsCPS 271 Ron Parr Observe a sequence of events Predict the probability of future events based upon observations Classical statistical problem Surprisingly subtle issues ariseEvent Spaces We first c
Duke - CPS - 108
Inheritance (language independent)qFirst view: exploit common interfaces in programming Iterator and Comparable in Java, see List/ArrayList/Vector Iterators in STL/C+ share interface by convention/templatesImplementation varies while interfac
Duke - CPS - 210
Tricks (mixed syntax)if (some_condition) / as a hint { LOCK m DO if (some_condition) /the truth {stuff} END Cheap to get info but must check for } correctness; always a slow wayMore TricksGeneral pattern:while (! required_conditions) wait (m, c)
Duke - CPS - 108
Software frameworks/cadaversExperience with OO programming and design shows that design patterns are useful Where do we get the experience? How do we impart experience? What can we use to illustrate patterns in practice? What patterns should we em
Duke - CPS - 210
Power-Aware Ad Hoc RoutingMobicom98 paper Power-Aware Routing in Ad Hoc Networks by Singh, Woo, and Raghavendra What is ad hoc routing? Routing through cooperating wireless nodes that may be mobile (topology changing). Goal: reduce the energy cons
Duke - CPS - 189
Thomas Finley An Empirical Study of Novice Program Comprehension in the Imperative and ObjectOriented Styles by Vennila Ramalingam and Susan Wiedenbeck The title says it all, does it not? The authors sought to determine what differences in comprehens
Duke - CPS - 100
Searching, Maps, HashingqSearching is a very important programming application Consider google.com and other search engines In general we search a collection for a key Vector/List, Tree: O(n) and O(log n) If we compare keys when searching we c
Duke - CPS - 100
Intersection, Union, MultisetsFinding the intersection of two sets requires examining all the elements of one set and determining if these are in the other How can we examine all the elements of a MultiSet? What mechanism exists for accessing ind
Duke - CPS - 100
What is Computer Science?What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread which gathers these disparate branches into a single discipline? My answer to these questions is simple - it is
Duke - CPS - 100
Backtracking, Search, HeuristicsqMany problems require an approach similar to solving a maze Certain mazes can be solved using the "right-hand" rule Other mazes, e.g., with islands, require another approach If you have "markers", leave them at
Duke - CPS - 100
Review of Data StructuresqWeve studied concrete data structures Vectors Homogeneous aggregates supporting random access Linked lists Collections supporting constant-time insertionTrees Combine efficiency of search/insert from vector/linke
Duke - CPS - 110
COMPSCI 110 Operating Systems Who - Introductions How - Policies and Administrative Details Why - Objectives and Expectations What - Our Topic: Operating SystemsHow COMPSCI 110 will work Its all explained on the webhttp:/www.cs.duke.edu/educa
Duke - CPS - 100
Intersection, Union, MultisetsAnatomy of IntersectionFinding the intersection of two sets requires examining all the elements of one set and determining if these are in the other How can we examine all the elements of a MultiSet? What mechanis
Duke - CPS - 100
Name: HW 1 - Linked Lists Instructions: This HW is due in-class on Oct. 16. Turn in your work stapled and with your name on every page. This assignment is worth 100 points. You should work on your own, but you can use books/notes. You should not use
Duke - CPS - 100
CPS 100E - Program Design and Analysis I Prof. Rodger Section: 2-3 Trees handout2-3 Treesleaf nodes contain data item all leaves on same level nonleaf node has 2 or 3 children two search values largest item in left subtree largest item in middle s
Duke - CPS - 100
CPS 100E - Program Design and Analysis I Prof. Rodger Section: Trees handout Read Chap 6.5-6.6, Chap 17. We will not use the class implementation of trees in the book, but you should read about them. General Tree set of nodes vertices set of edges no
Duke - CPS - 100
CPS 100E - Program Design and Analysis I Prof. Rodger Section: Red Black Trees handoutRed-Black TreeBinary search tree properties every node is red or black every leaf is a NULL node and black the root is black If node is red, then its children ar
Duke - CPS - 100
The PlanGraphical User Interfaces GUIs Components Flat Layouts Hierarchical Layouts Designing a GUI Coding a GUIGUI.1GUI.2Components JLabel text/image display JTextField single line for text input/output JTextArea multiple lines for te
Duke - CPS - 100
Java: Base Types All information has a type or class designation Built-in TypesCalled : primitive types or base types boolean, char, bye, short, int, long, float, double Primarily use: int, double, booleanNeed to declare before using; defined
Duke - CPS - 100
On the Limits of ComputingExistence of Noncomputable FunctionsReasons for Failure1.Approach Matching up Programs and Functions E.g., assume 3 functions, only 2 programs Without details, conclude one function has no programRuns too long
Duke - CPS - 100
Intro to SortingSelection Sorting Example Sorting "Ideal" Computer Science Topic Theory and Practice meet Efficient Sorting Saves MoneyFirst look at some simple (quick and dirty?) algorithms Selection Sort1. 2. 3. Find smalle
Duke - CPS - 100
Creating HeapsArray-based heap Heap is an array-based implementation of a binary tree used for implementing priority queues, supports:insert, findmin, deletemin: complexities?store "node values" in array beginning at index 1 for node with
Duke - CPS - 100
Binary TreesFrom doubly-linked lists to binary treesLinked lists: efficient insertion/deletion, inefficient search ArrayList: search can be efficient, insertion/deletion not Binary trees: efficient insertion, deletion, and search trees used i
Duke - CPS - 100
Big Oh Again AgainRecognizing Common Recurrences Have taken the attitude that mostly you can look things up Now need to be able to do your own derivations Extend our menu of solutions to common recurrence Lets look at previously shown tableBe
Duke - CPS - 100
Searching, Maps,Tries (hashing)From Google to MapsSearching is a fundamentally important operation We want to search quickly, very very quickly Consider searching using Google, ACES, issues? In general we want to search in a collection for
Duke - CPS - 100
Intro to GraphsDefinitions and VocabularyA graph consists of a set of vertices (or nodes) and a set of edges (or arcs) where each edge connects a pair of vertices. If the pair of vertices defining an edge is ordered, then it is a directed graph.
Duke - CPS - 100
Data CompressionCompression is a high-profile application.zip, .mp3, .jpg, .gif, .gz, What property of MP3 was a significant factor in what made Napster work (why did Napster ultimately fail?)Why do we care?Secondary storage capacity double
Duke - CPS - 100
Searching, Maps,Tries (hashing)Searching is a fundamentally important operationWe want to search quickly, very very quickly Consider searching using Google, ACES, issues? In general we want to search in a collection for a keyWe've searched us
Duke - CPS - 100
Memory ModelCost of Disk I/OFor this course: Assume Uniform Access Time All elements in an array accessible with same time cost Reality is somewhat different Registers On (cpu) chip cache memory Off chip cache memory Main memory Virtual memo
Duke - CPS - 100
Inheritance and Interfaces Single inheritance in JavaInheritance models an "is-a" relationshipA class can extend only one class in Java A dog is a mammal, an ArrayList is a List, a square is a shape, Write general programs to understand
Duke - CPS - 100
Inheritance and Interfaces Inheritance models an "is-a" relationshipA dog is a mammal, an ArrayList is a List, a square is a shape, Write general programs to understand the abstraction, advantages?void doShape(Shape s) { System.out.println(s.a
Duke - CPS - 100
Other N log N SortsBinary Tree SortBasic Recipe o Insert into binary search tree (BST) o Do Inorder Traversal Complexity o Create: O(N log N) o Traversal O(N) Not usually used for sorting unless you need BST for other reasonsCompSci 100E28.1
Duke - CPS - 100
Java: Base Types Java: Operators for Base TypesAll information has a type or class designation Built-in TypesCalled : primitive types or base types boolean, char, bye, short, int, long, float, double Primarily use: int, double, booleanFami
Duke - CPS - 100
Java Basics Arrays!Java Basics Arrays!Should be a very familiar idea"!Problem: Deal with exam grades in a course o!Could have variable for each student o!Would need unique name for each variable o!Need lots of custom code o!Instead, assume
Duke - CPS - 100
Dropping Glass BallsTower with N Floors ! Given 2 glass balls ! Want to determine the lowest floor from which a ball can be dropped and will break ! How?!Glass balls revisited (more balls)! !1.! 2.! 3.! 4.! 5.! 6.! 7.! 8.! 9.! 10.!What is th
Duke - CPS - 100
Data CompressionYear Scheme 1967 ASCII 1950 Huffman 1977 Lempel-Ziv (LZ77) 1984 Lempel-Ziv-Welch (LZW) Unix compress 1987 (LZH) used by zip and unzip 1987 Move-to-front 1987 gzip 1995 Burrows-Wheeler 1997 BOA (statistical data compression)CompSci
Duke - CPS - 100
Problem 1!Problem 2!Given n, calculate 2n" "What if you wanted to print all from 20 to 2n? What if you wanted to return the value?Given a real number c and some error tolerance epsilon, estimate t, the square root of cCompSci 100E2.1
Duke - CPS - 100
Is there a Science of Networks?!From subsets to graphs with bits!What kinds of networks are there? From Bacon numbers to random graphs to Internet ! From FOAF to Selfish Routing: apparent similarities between many human and technological system
Duke - CPS - 100
Searching, Maps, TablesqSearching is a fundamentally important operation We want to do these operations quickly Consider searching using google.com, altavista.com, etc., In general we want to search in a collection for a key Weve seen searching
Duke - CPS - 100
Data Structures revisitedLinked lists and arrays and ArrayLists and . Linear structures, operations include insert, delete, traverse, . Advantages and trade-offs include . We want to move toward structures that support very efficient insertion a
Duke - CPS - 100
Conventions in Compsci 100 projectsKWIC: Key word in ContextArise, fair sun, and I. Yet I should shortly, for one would those twenty could but wherefore, villain, didst thou mean, But 'banished' to thou happy. Tybalt would cell there would she he
Duke - CPS - 100
Analysis: Algorithms and Data StructuresHow fast does the code run?We need a vocabulary to discuss performance and to reason about alternative algorithms and implementations Its faster! Its more elegant! Its safer! Its cooler! We need empirical
Duke - CPS - 100
Printed by Owen L. Astrachan Feb 04, 09 9:19import java.util.*;75ArrayListHash.javaPage 1/2Feb 04, 09 9:19ArrayListHash.javaPage 2/2public class ArrayListHash implements IMapper {5private static int SIZE = 1000000; private class Comb
Duke - CPS - 100
Printed by Owen L. Astrachan Mar 18, 09 11:42import java.util.*; public class Postfix {5Postfix.javaPage 1/1private static final String DELIMS = "+-*/ "; private int operate(String op, int lhs, int rhs){ if (op.equals("+") { return lhs + rhs;
Duke - CPS - 100
APT IPConverterhttp:/www.cs.duke.edu/csed/algoprobs/ipconverter.htmlAPT IPConverterThis problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior writ
Duke - FEB - 100
APT IPConverterhttp:/www.cs.duke.edu/csed/algoprobs/ipconverter.htmlAPT IPConverterThis problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior writ
Duke - CPS - 100
Data and InformationOrganizing Data: ideas and issuesHow and why do we organize data? Differences between data and information? What about knowledge?Often there is a time/space tradeoff If we use more space (memory) we can solve a data/ info
Duke - CPS - 100
Search, Trees, Games, BacktrackingSearch, Backtracking,HeuristicsTrees help with search How do you find a needle in a haystack? Set, map: binary search tree, balanced and otherwise Quadtree and more, scenes and objects in games 3-4 Tre
Duke - CPS - 100
Data Structures revisitedWordladder Story Linked lists and arrays and ArrayLists and Linear structures, operations include insert, delete, traverse, Advantages and trade-offs include We want to move toward structures that support very effi
Duke - CPS - 100
Printed by Owen L. Astrachan Jan 11, 09 20:25import java.util.*; /* * Model for KeyWordInContext (KWIC) demo program. As given this isnt fully * functional, but shows how the Model communicates with the View * @author Owen Astrachan * @date 9/2/2008
Duke - CPS - 100
Printed by Owen L. Astrachan Feb 04, 09 9:28import java.util.Iterator;75ISimpleList.javaPage 1/2Feb 04, 09 9:28ISimpleList.javaPage 2/2510/* * An interface similar to java.util.List, but doesn't include all the methods * of that int
Duke - CPS - 100
Printed by Owen L. Astrachan Feb 09, 09 12:41import java.util.*;75ListDoubler.javaPage 1/2Feb 09, 09 12:41ListDoubler.javaPage 2/2public class ListDoubler {5double ltime = ld.timeDouble(llist); double atime = ld.timeDouble(alist); do
Duke - CPS - 100
ADTs and vectors, towards linked listsqLinked listsqqtvector is a class-based implementation of a lower-level data type called an array tvector grows dynamically (doubles in size as needed) when elements inserted with push_back tvector prot
Duke - CPS - 100
Data Structures revisitedStack: What problems does it solve?Linked lists and arrays and ArrayLists and Linear structures, operations include insert, delete, traverse, Advantages and trade-offs include We want to move toward structures that
Duke - CPS - 100
Solving Problems RecursivelyPrint words entered, but backwardsRecursion is an indispensable tool in a programmer's toolkit Allows many complex problems to be solved simply Elegance and understanding in code often leads to better programs: eas
Duke - CPS - 100
What's in Compsci 100?Understanding tradeoffs: reasoning, analyzing, describing Algorithms Data Structures Programming Design Object oriented programming using Java IDE Language Problem-solving From design to codeCPS 1002.1Toward understanding
Duke - CPS - 100
Analysis: Algorithms and Data StructuresWe need a vocabulary to discuss performance and to reason about alternative algorithms and implementations It's faster! It's more elegant! It's safer! It's cooler! We need empirical tests and analytical/mat
Duke - CPS - 100
Balanced Search TreesqRotations and balanced treesqBinary search trees keep keys ordered, with efficient lookup Insert, Delete, Find, all are O(log n) in average case Worst case is bad Compared to hashing? Advantages? Balanced trees are guar
Duke - CPS - 100
2004.LinkedPracticehttp:/www.cs.duke.edu/courses/cps I 00/current/inclass/link2lllTnda* * zinliql-flrlnrle a Node * b) / pre: 0 < size(a) and 0 < size (b) and size (b) < size (a) node of list created by / / post: returns pointer to first z i n
Duke - CPS - 100
Searching, Maps, TablesqLog (google) is a big numberqSearching is a fundamentally important operation We want to do these operations quickly Consider searching using google.com, altavista.com, etc., In general we want to search in a collecti
Duke - CPS - 100
Oops I did it again Tiffany , Amrith Nooo Oh no no no no no Oh no no no no no I think I did it again I made an error I can't comprehend Oh Ola It might stop from compiling But it doesn't mean that I can't compress this, 'Cause to lose all of my huff