7 Pages

03ControlSmall

Course: CMSC 131, Fall 2009
School: Maryland
Rating:
 
 
 
 
 

Word Count: 1345

Document Preview

Set Lecture #3: Conditional and Iterative Structures Control Structures uninitialized variables if branching if / else branching logical operators nesting of control structures proper indenting and spacing conventions java identifier naming conventions named constants while loop do-while loop for loop CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) Control Flow and Conditionals Control flow: the order in...

Register Now

Unformatted Document Excerpt

Coursehero >> Maryland >> Maryland >> CMSC 131

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.
Set Lecture #3: Conditional and Iterative Structures Control Structures uninitialized variables if branching if / else branching logical operators nesting of control structures proper indenting and spacing conventions java identifier naming conventions named constants while loop do-while loop for loop CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) Control Flow and Conditionals Control flow: the order in which statements are executed General rule: top to bottom Several Control Structures that change that Conditional statements: permit control flow to be dependent on (true/false) conditions if if-else CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) if and 1 if-else The if and if-else statements should have the following form: if (condition) { statements; } tests the condition if true statement is done; otherwise it is skipped if (condition) { statements1; } else { statements2; } tests the condition if true, statements1 is done; otherwise statements2 is done CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 2 1 Java and White Space You can add: carriage returns, spaces, tabs wherever you want in Java Properly used, this makes your program easier to read and understand http://java.sun.com/docs/codeconv/html/CodeConv TOC.doc.html CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 3 Logical Operators Used for forming more complex conditions. and && if ( temp >= 97 && temp <= 99 ) { System.out.println( Patient is healthy ); } or || if ( months >= 3 || miles >= 3000 ) { System.out.println( Change your oil ); } not: ! if ( ! phone.equals( 301-555-1212 ) ) { System.out.println( Sorry, wrong number ); } CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 4 Blocks W hat happens? if (i > 10) i = 10; saturate = true; Desired: both i, saturate are set only when i > 10 Actual: only the i=10 statement is dependant Only one statement can be associated with if The saturate assignment statement is not part of the if Blocks solve this problem CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 5 2 Blocks W hat happens? if (i > 10) i = 10; saturate = true; else k = 100; Desired: both i, saturate are set only when i > 10 Actual: syntax error Only one statement can be associated with if The saturate assignment statement is not part of the if The else cant find the if it belongs to Blocks solve this problem also CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 6 What Blocks Are Blocks are sequences of statements glued together into one Form: { <statement 1>; <statement 2>; } Example: if (i > 10) { i = 10; saturate = true; block } else { i = i+1; } block if, if-else, {} are statement constructors They take statement(s) and convert them into a new statement Implications: if statements, etc. can also appear inside (be nested within) one another CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 7 Issues with if-else Nested If/Elses can be Ugly and Confusing! indent and block carefully The Dangling Else Problem Java rule: else is associated with innermost possible if Cascading Elses W E WILL USE { } FOR ALL IF, IF-ELSE, IF-ELSE-IF, STATEMENTS CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 8 3 In Projects You must use meaningful variable names it must tell the purpose of that variable what it is meant to hold it can not have so much abbreviation that only you can read it You must use Java convention indenting and brace placement the indenting show the purpose in nesting with braces in the Java determined places with respect to the lines of code Java convention of capitalization of identifiers variables and methods start with lower case classes and interfaces start with upper case variables, methods, classes and interface use camelCase constants are all uppercase with underscores between words You must have Fully Blocked if statements and looping structures You must have all lines less than or equal to 80 columns of text You must use "named constants" for any literal values that will not change during program execution. CMSC 131 Fall 2009 9 Jan Plane (adapted from Bonnie Dorr) Named Constants If same value should be used in several places, how to ensure consistency? i.e. Check on temperature may be performed more than once i.e. Same prompt might be printed in several places final int MAX_OK_TEMP = 99; Just like a regular variable declaration/initialization, except Special term final Necessity of initial value Any valid variable name will work, convention but is to use all capitals Difference from non-final variables: assignment attempt leads to error! literals (= named values) e.g. if (temp >= 212 || temp <= 32) if (temp >= BOILING || temp <= FREEZING) e.g. System.out.print (Enter integer: ); System.out.print (PROMPT); CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 10 Naming Rules and Conventions W hat is legal for variable names? Letters, digits, $, _ Cant start variable name with digit Avoid reserved words Avoid names starting or ending with $ or _ Use camelCase: Variables & Methods use lower-case for first letter Classes/Interfaces use upper-case for first letter Naming Conventions: Standards developed over time. Variables and methods: Start with lowercase, and use uppercase for each new word: dataList2 myFavoriteM artian showM eT heM oney Class names: Start with uppercase and uppercase for each new word: String JOptionPane M yFavoriteClass Named constants (variables whose value never changes): All uppercase with underscores between words: MAX_LENGTH DAYS_PER_WEEK BOILING_POINT Make variable names not too long, not too short Bad: crtItm Bad : theCurrentItemBeingProcessed Good : currentItem CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 11 4 Meaningful Variable Names Choose names for your variables to reflect their purpose Bad String string = ; System.out.println (Enter name: ); string = sc.next(); if (string.equals (John Doe)) Good String name = ; System.out.println (Enter name: ); name = sc.next(); if (name.equals (John Doe)) CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 12 Loops in Java So far our programs execute every program statement at most once Often, we want to perform operations more than once: Sum all numbers from 1 to 10 Repeatedly prompt user for input Loops allow statements to be executed multiple times. Loop types in Java: while do-while for Call iteration CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 13 while and do-while Loops while and do-while loops contain: A statement, called the body A boolean condition Idea: the body is executed one more time as long as the condition is true while-loop: The condition is tested before each body execution while( condition ){ body } do-while-loop: The condition is tested after each body execution do{ body } while ( condition ); Main difference: do-while loop bodies always executed at least once because it is bottom tested rather than top tested CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 14 5 Types of loops indefinite iteration usually tests something that is coming from outside the loop structure (e.g. input) needs to eventually change from true to false counted iteration something that is controlled inside the loop to start at some value and count up or down until some set ending point CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 15 for loop for-loop: The counter is set, the condition is tested before each body execution, the update is performed at the end of each iteration for( initialization; condition; update){ body } Usually used for counted loops, but any of the parts can be left empty. CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 16 Infinite Loops Loops can run forever if condition never becomes false Be careful when programming loops! Add statements for termination into loop body first Often these statements are at end of body e.g. while (i <= 10) { System.out.println(i); i = i + 1; } CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 17 6 Variables, Blocks and Scoping Variables can be declared anywhere in a Java program W hen are the declarations active? After they are executed Only inside the block in which they are declared Scope rules formalize which variable declaration are active when Global variables: scope is entire program Local variables: scope is a block CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 18 Nested Loops while, do-while are statement constructors (like if and if-else: they use blocks) Loops can thus be used inside other loops! CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) 19 Nesting Example public class NestedLoops { public static void main(String[] args) { int rowNumber = 1; while (rowNumber < 10) { int colNumber = 1; while (colNumber < 10) { System.out.print((rowNumber + colNumber) % 2); colNumber = colNumber + 1; } System.out.println(); rowNumber = rowNumber + 1; } } } Inner loop CMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr) Outer loop 20 7
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:

Maryland - CMSC - 131
Lecture Set 4:More About Methods and More About OperatorsMethodsDefinitions InvocationsMore arithmetic operators Operator Side effects Operator Precedence Short-circuitingCMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr)main methodpublic stat
Maryland - CMSC - 131
Lecture Set 5:Design and ClassesThis Set:Methods and Parameter PassingBasics of program designPseudo-codeObjects and classesHeapsGarbage CollectionMore about Creating Objects and classes in JavaMethodsConstructors, Accessors, MutatorsEquality
Maryland - CMSC - 131
Lecture Set #6:Encapsulaton, this,junit testing and Libraries1.2.3.4.5.Review of Parameter passingthispublic vs. private Choicesjunit testingLibrariesCMSC 131 Fall 2009Jan Plane (adapted from Bonnie Dorr)Tracing Parameters andMethodsRecal
Maryland - CMSC - 131
Lecture Set #7:Exceptions&amp; Mutability Issues1.2.3.4.Break and Continue for LoopsExceptionsMutability/ImmutabilityStringbuffer classCMSC 131Fall 2009Jan Plane (adapted from Bonnie Dorr)break from loopsbreak can also be used to exit immediatel
Maryland - CMSC - 131
Lecture Set #8: Debugging1. 2.Complete Class Summary The Eclipse DebuggerCMSC 131 Fall 2009 Jan PlanePutting the pieces togetherConstructorsdefault constructor constructors with parameters copy constructorsDatadata members: instance/static and pub
Maryland - CMSC - 131
Lecture Set #9: Arrays IntroThis lecture set: Intro to arrays Copying arrays and making arrays bigger Array lengths and out-of-bounds indexing Passing arrays and array elements to a function Privacy Leaks Different levels of copyCMSC 131 Fall 2009 Jan P
Maryland - CMSC - 131
11/1/2009Lecture Set #10:Two-Dimensional Arrays2-dimensional arrays1.1.2.Ragged ArraysRectangular ArraysCMSC 131 Fall 2009Jan Plane (adapted from Bonnie Dorr)Recall ArraysArrays: sequences of elements from the same basetypeint[] a;Date[] d;
Maryland - CMSC - 131
Lecture Set #11:Ternary Operatorand SwitchMethod Overloading Warningternary operator: The ?:(conditional operator)switchCMSC 131 Fall 2009Jan Plane (adapted from Bonnie Dorr)Method OverloadingMethod definitionpublic static void f(int x, float y
Maryland - CMSC - 131
Lecture Set #12:PolymorphismIntroduction1.2.WrappersInterfacesCMSC 131 Fall 2009Jan Plane (Adapted from Bonnie Dorr)WrappersW e may want to treat primitives as though they were objectsFor example, generic routines can be implemented using inter
Maryland - CMSC - 131
Lecture Set #13:Algorithms and Design1.2.3.Algorithmic DesignAlgorithmic AnalysisSystem DesignCMSC 131 Fall 2009Jan Plane (Adapted from Bonnie Dorr)What is an algorithm?The method used to solve a particular problem is called analgorithm.Examp
Maryland - CMSC - 131
Lecture Set #14:Command Line RunningIssues &amp; Comments1.2.3.Command-line JavaArguments to Main MethodCommenting ReviewCMSC 131 Fall 2009Jan Plane (adapted from Bonnie Dorr)Command-Line JavaSource File:an ASCII text file named appropriately for
Maryland - CMSC - 131
Lecture Set #15: Collections1.1. 2.CollectionsArrayList Stack2.1.New Looping constructfor each loopCMSC 131 Fall 2009 Jan Plane (adapted from Bonnie Dorr)Collections in JavaArrays are collectionsArrays are objects Arrays are sequences of eleme
Maryland - CMSC - 131
Lecture Set # 16:Packages1.PackagesCMSC 131 Fall 2009Jan Plane (adapted from Bonnie Dorr)Java Program OrganizationProgram Organization:Java program: is composed of 1 or more Java source files.Source file: can have 1 or more class and/or interface
Maryland - CMSC - 131
Lecture Set #17:InheritanceInheritanceConceptualIs-A relationship compared to contains-aTerminologyOverloading compared to OverridingsuperisInstanceOf and getClass()CMSC 131 Fall 2009Jan Plane (adapted from Bonnie Dorr)InheritanceA crucial fea
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IICourse IntroductionDepartment of Computer ScienceUniversity of Maryland, College ParkCourse Catalog DescriptionIntroduction to use of computers to solveproblems using software engineeringprinciplesDesign, bu
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIObject-OrientedProgramming IntroDepartment of Computer ScienceUniversity of Maryland, College Park1Object-Oriented Programming (OOP)Approach to improving softwareView software as a collection of objects (ent
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIObject-OrientedProgramming &amp; JavaLanguage ConstructsDepartment of Computer ScienceUniversity of Maryland, College Park1Review of Java Language ConstructsBasic elementsPrimitive types, variables, constants,
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIAbstract ClassesDepartment of Computer ScienceUniversity of Maryland, College ParkModifier AbstractDescriptionLeave lower-level details to subclassDefines contract for subclassesAllows inheritance of other m
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIJava Support for OOPDepartment of Computer ScienceUniversity of Maryland, College ParkOverviewObjects &amp; class, this, superReferences, alias, levels of copyingConstructor, initialization blockGarbage collecti
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIProgram Correctness,ExceptionsDepartment of Computer ScienceUniversity of Maryland, College ParkOverviewProgram correctness is determined by thepresence / absence of program defects (errors)IssuesTypes of e
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIJava Inner ClassesDepartment of Computer ScienceUniversity of Maryland, College Park1Java ClassesTop level classesDeclared inside packageVisible throughout package, perhaps furtherNormally declared in their
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIGraphical User Interface(GUI)Department of Computer ScienceUniversity of Maryland, College Park1Graphical User Interface (GUI)User interfaceInterface between user and computerBoth input and outputAffects u
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIAlgorithmic Complexity IDepartment of Computer ScienceUniversity of Maryland, College Park1Algorithm EfficiencyEfficiencyAmount of resources used by algorithmTime, spaceMeasuring efficiencyBenchmarkingAsy
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIAlgorithmic Complexity IIDepartment of Computer ScienceUniversity of Maryland, College Park1OverviewCritical sectionsComparing complexityTypes of complexity analysis2Analyzing AlgorithmsGoalFind asymptot
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IICollection Abstractions &amp;Java CollectionsDepartment of Computer ScienceUniversity of Maryland, College ParkCollectionPrograms represent and manipulateabstractions (chunks of information)Examples: roster of s
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IILinear Data StructuresDepartment of Computer ScienceUniversity of Maryland, College ParkOverviewLinear data structuresGeneral propertiesImplementationsArrayLinked listRestricted abstractionsStackQueueLi
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIGeneric ProgrammingDepartment of Computer ScienceUniversity of Maryland, College ParkGeneric ProgrammingGeneric programmingDefining constructs that can be used with differentdata typesI.e., using same code f
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIHashingDepartment of Computer ScienceUniversity of Maryland, College Park1HashingHashingHashing function function that maps data to a value (e.g.,integer)Hash Code/Hash Value value returned by a hash functi
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IISets and MapsDepartment of Computer ScienceUniversity of Maryland, College Park1How Do Collections Work in Java?Elements are NOT copied when insertedCollection contains references, not objectsFinding matchin
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIRecursive AlgorithmsDepartment of Computer ScienceUniversity of Maryland, College ParkRecursionRecursion is a strategy for solving problemsA procedure that calls itselfApproachIf ( problem instance is simple
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IITrees &amp; Binary Search TreesDepartment of Computer ScienceUniversity of Maryland, College Park1TreesTrees are hierarchicaldata structuresOne-to-many relationshipbetween elementsParent nodeTree node / eleme
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIHeaps &amp; Priority QueuesDepartment of Computer ScienceUniversity of Maryland, College ParkOverviewBinary treesCompleteHeapsInsertgetSmallestHeap applicationsHeapsortPriority queuesComplete Binary TreesA
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIJava I/O OverviewDepartment of Computer ScienceUniversity of Maryland, College Park1Input/OutputApproaches to store file dataText filesData represented in human-readable formExample: Java source programsUs
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IINetworkingDepartment of Computer ScienceUniversity of Maryland, College Park1NetworkingInternetDesigned with multiple layers of abstractionUnderlying medium is unreliable, packet orientedPacket-SwitchingAn
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IISoftware DevelopmentDepartment of Computer ScienceUniversity of Maryland, College Park1Modern Software DevelopmentWhy do we want to study the softwaredevelopment process?To understandSoftware development pr
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IISoftware Process ModelsDepartment of Computer ScienceUniversity of Maryland, College Park1OverviewSoftware process modelsWaterfallIterativeChoosing a software process modelLevel of understandingCost of ch
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIProblem Specification&amp; Software ArchitectureDepartment of Computer ScienceUniversity of Maryland, College ParkOverviewProblem specificationObstaclesSoftware ArchitectureHow to divide workInterface &amp; condit
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIProgram TestingDepartment of Computer ScienceUniversity of Maryland, College ParkProgram TestingEmpirical testingTest software with selected test casesTest failures frequently indicate software errorsAbsence
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIObject-Oriented DesignDepartment of Computer ScienceUniversity of Maryland, College ParkApplying Object-Oriented Design1.Look at objects participating in system2.Find nouns in problem statement (requirements
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIUnified Modeling Language(UML)Department of Computer ScienceUniversity of Maryland, College ParkUML (Unified Modeling Language)UML is a modeling language forSpecifyingVisualizingConstructingDocumentingobj
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIGraphs &amp; Graph TraversalDepartment of Computer ScienceUniversity of Maryland, College Park1Graph Data StructuresMany-to-many relationship between elementsEach element has multiple predecessorsEach element ha
Maryland - CMSC - 132
CMSC 132:Object-Oriented Programming IIThreads in JavaDepartment of Computer ScienceUniversity of Maryland, College Park1ProblemMultiple tasks for computerDraw &amp; display images on screenCheck keyboard &amp; mouse inputSend &amp; receive data on network
Maryland - CMSC - 250
RelationsCMSC 2501DefinitionsqA relation from X to Y is a subset of X YqIf R is a relation and (x,y) in R we denote this xRyCMSC 2502Exampleqq&quot;Less than&quot; relation from A = cfw_0,1,2 to B = cfw_1,2,3Use traditional notation0 &lt; 1, 0 &lt; 2, 0 &lt;
Maryland - CMSC - 250
FunctionsCMSC 2501Function terminologyq A function maps elements of one set (called the domain)to another set (called the codomain).q Domain: the set which contains the values to which thefunction is appliedq Codomain: the set which contains the p
Maryland - CMSC - 250
Counting and ProbabilityCMSC 2501Countingq Counting elements in a list: how many integers in the list from 1 to 10? how many integers in the list from m to n? (assuming m n)CMSC 2502How Many in a List?q How many positive three-digit integers are
Maryland - CMSC - 250
Set TheoryCMSC 2501Set definitionsDefinition: A set is a collection of objects.Examples: A = cfw_1,2,3B = cfw_x Z | 4 &lt; x &lt; 4C = cfw_x Z+ | 4 &lt; x &lt; 4A set is completely defined by its elements, i.e.,cfw_a,b = cfw_b,a = cfw_a,b,a = cfw_a,a,a,b,b,b
Maryland - CMSC - 250
Mathematical InductionCMSC 2501Logic of Inductionq Induction principle:P(1)(n 1)[P(n) P(n+1)] (n 1)[P(n)]CMSC 2502Logic of Inductionq Induction principle:P(1)(n 2)[P(n-1) P(n)] (n 1)[P(n)]CMSC 2503Descriptionq Inductive proofs must have:
Maryland - CMSC - 250
Summations and ProductsCMSC 2501Sequences 2,4,6,8,for i 1ai = 2i an infinite sequencebi = (1)i for i 1 an infinite sequence for 1 i 6 ci = i + 5 a finite sequenceCMSC 2502Finding an explicit formulaq Figure out the formula for this sequenc
Maryland - CMSC - 250
Number TheoryCMSC 2501Introductory number theoryqA good proof should have: a statement of what is to be proven (labeled as Theorem,Lemma, Proposition, or Corollary) &quot;Proof&quot; to indicate where the proof starts a clear indication of flow a clear in
Maryland - CMSC - 250
Predicate LogicCMSC 2501QuantificationqqqqqqxThere exists an xxFor all x'sDomain- the set where these subjects come from( x) [P(x)] there exists an x for which predicate p is true(x) [P(x)] for all x, predicate p is trueNotation:x Zx R
Maryland - CMSC - 250
CircuitsCMSC 2501Find Boolean formula for:q p, q &amp; rare thevariables.qroutput1111110110101001011001000CMSC 250p01000002Find Boolean Formulaq For each row with output 1 obtain mini-formula whichis 1 exactly on
Maryland - CMSC - 250
Discrete StructuresCMSC 250Lecture 1January 24-28, 2011CMSC 2501AdministrativeqqSyllabus (Online)Every week (mostly): Worksheet Quiz HomeworkqClass webpageTwo midterms, as noted on the syllabus (on the classwebpage)qAcademic integrityq
Maryland - CMSC - 250
CMSC 250-Discrete Structures, Spring 2011Syllabus: SHORT VERSIONSECOND MIDTERM IS APRIL 13, 2011 AT 6:00-7:30WHERE YOU WILL TAKE THE MIDTERM ON APRIL 13, 2011:1. If you are in sections 0101 or 0102 then take the midterm in CSI 1115.2. If you are in s
Maryland - CMSC - 250
SOLUTIONforPracticeExam,CMSC250Thesequestionsareintendedtoprovideareasonablycompleteoverviewoftheconceptswehavecoveredsofarthissemester.Theactualexamwillhavesomewhatfewerquestions,butdrawnlargelyfromthisgeneraltypeofquestion.Sincetherewasnohomeworkset
Maryland - CMSC - 250
Practice Exam, CMSC 250 These questions are intended to provide a reasonably complete overview of the concepts we have covered so far this semester. The actual exam will have somewhat fewer questions, but drawn la
Maryland - CMSC - 250
Relating Internal and External Path LenghtsDenition 0.1 A Full Binary Tree is a tree where every node has either 0 or 2 children.Denition 0.2 Let T be a tree. The leaves of T are the nodes at the bottom that have no children.The internal nodes of T are
Maryland - CMSC - 250
Weak and Strong InductionAuthor(s): J. C. ShepherdsonSource: The American Mathematical Monthly, Vol. 76, No. 9 (Nov., 1969), pp. 989-1004Published by: Mathematical Association of AmericaStable URL: http:/www.jstor.org/stable/2317124 .Accessed: 04/04/
Maryland - CMSC - 250
CMSC 250-Discrete Structures, Spring 20111DescriptionWe will study fundamental mathematical concepts that are relevant to computer science. Inparticular we will cover propositional and predicate logic, proof techniques, mathematicalinduction, element
Maryland - CMSC - 250
Spring-2011CMSC 250: Homework 12Due: Wed May 4, 2011NOTE: Due AT THE BEGINNING of Recitation!COURSE WEBSITE: http:/www.cs.umd.edu/ gasarch/250/S11.htmlNOTE: In this HW N = cfw_0, 1, 2, . . .. In this HW answer can use choose-notation or factorialsor
Maryland - CMSC - 250
Spring-2011CMSC 250: Homework 12Due: Wed May 4, 2011NOTE: Due AT THE BEGINNING of Recitation!COURSE WEBSITE: http:/www.cs.umd.edu/ gasarch/250/S11.htmlNOTE: In this HW N = cfw_0, 1, 2, . . .. In this HW answer can use choose-notation or factorialsor
Maryland - CMSC - 250
Spring-2011CMSC 250: Homework 11Due: Wed Apr 27, 2011NOTE: Due AT THE BEGINNING of Recitation!COURSE WEBSITE: http:/www.cs.umd.edu/ gasarch/250/S11.htmlNOTE: In this HW N = cfw_0, 1, 2, . . .. In this HW answer can use choose-notation or factorialso