Take-home Lab 1. Arrays
|
|
- Cori Elliott
- 5 years ago
- Views:
Transcription
1 Take-home Lab 1 Arrays
2 Findx 2-Dimensional Array Graded! Submit by Friday 23:59
3 Find You are given a treasure map by your friend Map is divided into R by C cells Super Marks The Spot You need to find all the Super in the map Square of size at least 3 Composed entirely by on both diagonals If you find all the Super, you get the treasure
4 How many Super? 7
5 How many Super? 7 Square of size 3
6 How many Super? 7 Square of size 3
7 How many Super? 7 Square of size 4
8 How many Super? 7 Square of size 5
9 How many Super? 7 Square of size 5
10 How many Super? 7 Square of size 6? No Super
11 How many Super? 7 Square of size 7 Total: 6
12 Planning 1. Read input Map dimensions and the map itself 2. Count all the Super Create a method to find it 3. Output answer The number of Super
13 Input Two integers Dimensions of the map R: the number of cows C: the number of columns R lines of characters One line has C characters Characters are either or.
14 Reading the input Initialise the scanner Scanner sc = new Scanner(System.in) Read the first integer int numrows = sc.nextint() Read the next integer int numcols = sc.nextint() Initialise the map char[][] map = new char[numrows][numcols] Read all the lines for (int i = 0; i < numrows; i++) String row = sc.next() map[i] = row.tochararray()
15 Counting all the Super Place your code in its own method int countsuper(char[][] map, int numrows, int numcols) Break the problem down to smaller sub-problems For each of the possible square sizes Iterate through every cell, using it as the top-left corner of a possible Super square of the current square size Check whether that square is really a Super If it is, add 1 to the total Super count Return the total Super count as an integer
16 Iterating through the map 7
17 Iterating through the map 7
18 Iterating through the map 7
19 Iterating through the map 7
20 Iterating through the map 7
21 Iterating through the map 7
22 Iterating through the map 7
23 Iterating through the map 7
24 Is it a Super? Given a square size and the top-left cell, we are able to check whether it is a Super boolean issuper(char[][] map, int size, int currrow, int currcol) What defines a Super? Square of size at least 3 Composed entirely by on both diagonals First check the square size Return false if square size less than 3 Then check the diagonals Return true if both diagonals are composed of all
25 Diagonal Checking x 7 Super 6 x 6 Super
26 Diagonal Checking Left diagonal Start at the top left corner Go down to the bottom right corner Right diagonal Start at the top right corner Go down to the bottom left corner Write two methods to check them boolean isleftdiagonalall(map, size, currrow, currcol) boolean isrightdiagonalall(map, size, currrow, currcol)
27 Checking the Left Diagonal Let r be currrow Let c be currcol For i from 0 to squaresize If map[r][c] is Go to next cell on the diagonal Else Return false
28 Checking the Right Diagonal Let r be currrow Let c be currcol + squaresize - 1 For i from 0 to squaresize If map[r][c] is Go to next cell on the diagonal Else Return false
29 Finally, display output Simply print the number of Super System.out.println(countSuper(map, numrows, numcols)) Don t print anything else!
30 Questions?
31 Island 2-Dimensional Array
32 Island You are given a map of Hyrule, a land of many islands Map is divided into R by C cells You need to find all the islands in Hyrule Rectangle of at least size 2 Composed entirely of 1 Surrounded entirely by 0 Count the total number of islands
33 Islands of Hyrule
34 Islands of Hyrule
35 Islands of Hyrule
36 Islands of Hyrule
37 Islands of Hyrule
38 Planning 1. Read input Map dimensions and the map itself 2. Count all the islands Create a method to count the islands 3. Output answer The number of islands
39 Input Two integers Dimensions of the map R: the number of cows C: the number of columns R lines of characters One line has C characters Characters are either 1 or 0
40 Reading the input Initialise the scanner Scanner sc = new Scanner(System.in) Read the first integer int numrows = sc.nextint() Read the next integer int numcols = sc.nextint() Initialise the map char[][] map = new char[numrows][numcols] Read all the lines for (int i = 0; i < numrows; i++) String row = sc.next() map[i] = row.tochararray()
41 Counting islands Place your code in its own method int countislands(char[][] map, int numrows, int numcols) How to find? Iterate through every cell from top to bottom, using it as the top-left corner of a possible island If the cell contains a 1, it is definitely the top-left of an island Increase the total island count by one Set all the island s 1 to 0 to prevent double counting Return the total island count as an integer
42 Counting islands
43 Counting islands
44 Counting islands
45 Counting islands
46 Counting islands
47 Counting islands
48 Counting islands
49 Counting islands
50 Counting islands lazy way All islands have this pattern on their top left corner Once you see that pattern, you know it is an island But what if an island starts on the edge of the map? Add a dummy row and column of 0 to the top and left of the map Now there will be no islands that start on the edge of the map
51 Counting islands lazy way Find this pattern
52 Counting islands lazy way Add dummy row and column
53 Counting islands lazy way Find this pattern
54 Counting islands lazy way Find this pattern
55 Counting islands lazy way Find this pattern
56 Counting islands lazy way Find this pattern
57 Finally, display output Simply print the number of islands System.out.println(countIslands(map, numrows, numcols)) Don t print anything else!
58 Questions?
59 Measurement Calculation and Formatting
60 Measurement You are a teacher that needs to take students measurements You are given a list of students names, heights and weights You are to find the shortest and tallest students For these students, you are also required to find their BMI
61 Planning 1. Read input Number of students and their information 2. Find the shortest student and his BMI 3. Output the information 4. Find the tallest student and his BMI 5. Output the information
62 Input Integer N, the number of students N lines of student information, consisting of: String name Integer height Integer weight
63 Reading the input Initialise the scanner Scanner sc = new Scanner(System.in) Read the first integer int numstudents = sc.nextint() Store the information in three separate arrays String[] names; int[] heights; int[] weights; Read all the lines for (int i = 0; i < numstudents; i++) names[i] = sc.next() heights[i] = sc.nextint() weights[i] = sc.nextint()
64 Shortest Student Go through the height array and keep the index of the smallest number Use that index to get the name and weight of the corresponding student Calculate the BMI of the student Output the required information Use similar steps to find the tallest student s information
65 Without using arrays We don t absolutely need arrays for this problem While reading the input, keep track of the shortest and tallest students at the same time Also store their height and weight Once you finish reading the input, just calculate the BMI of both students You end up using less storage space, but it is easy to make careless mistakes
66 Calculating BMI BMI is not guaranteed to be a whole number, hence we have to store it as a float or double type double bmi; However weight and height were stored as integers, so we need to convert them to double as well double heightforbmi = height / 100 double weightforbmi = weight double bmi = weightforbmi / (heightforbmi * heightforbmi) Alternatively, we could have read them in as a double from the start sc.nextdouble()
67 Printing two decimal places If you want a String representation in two decimal places, use: String.format( %.2f, bmi) If you just want to directly print it, use: System.out.printf( %.2f, bmi) Note that printf does not give a newline at the end of the output You will need to add your own newline Read this link for more information
68 Output Construct your output like this String outputshortest = String.format( %s is the shortest with BMI equals to %.2f., name, bmi) Input the name and the calculated bmi in the correct order System.out.println(outputShortest) Read this simple formatting guide Can be used for both String.format() and System.out.printf()
69 Questions?
1. Write a program to calculate distance traveled by light
G. H. R a i s o n i C o l l e g e O f E n g i n e e r i n g D i g d o h H i l l s, H i n g n a R o a d, N a g p u r D e p a r t m e n t O f C o m p u t e r S c i e n c e & E n g g P r a c t i c a l M a
More informationCS Exam 1 Study Guide and Practice Exam
CS 150 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types.............................................. 2.2 Suggestions, Warnings, and Resources.................................
More informationCS 163/164 - Exam 1 Study Guide and Practice Exam
CS 163/164 - Exam 1 Study Guide and Practice Exam September 11, 2017 Summary 1 Disclaimer 2 Variables 2.1 Primitive Types.............................................. 2.2 Strings...................................................
More informationIntroduction to Programming (Java) 3/12
Introduction to Programming (Java) 3/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction
More informationCSE 311: Foundations of Computing. Lecture 26: Cardinality
CSE 311: Foundations of Computing Lecture 26: Cardinality Cardinality and Computability Computers as we know them grew out of a desire to avoid bugs in mathematical reasoning A brief history of reasoning
More informationComputer Science Introductory Course MSc - Introduction to Java
Computer Science Introductory Course MSc - Introduction to Java Lecture 1: Diving into java Pablo Oliveira ENST Outline 1 Introduction 2 Primitive types 3 Operators 4 5 Control Flow
More informationCSE 311: Foundations of Computing. Lecture 27: Undecidability
CSE 311: Foundations of Computing Lecture 27: Undecidability Last time: Countable sets A set is countable iff we can order the elements of as = {,,, Countable sets: N-the natural numbers Z - the integers
More informationProblem Decomposition: One Professor s Approach to Coding
Problem Decomposition: One Professor s Approach to Coding zombie[1] zombie[3] Fewer Buuuuugs zombie[4] zombie[2] zombie[5] zombie[0] Fundamentals of Computer Science I Overview Problem Solving Understand
More informationDynamic Programming( Weighted Interval Scheduling)
Dynamic Programming( Weighted Interval Scheduling) 17 November, 2016 Dynamic Programming 1 Dynamic programming algorithms are used for optimization (for example, finding the shortest path between two points,
More informationCS177 Fall Midterm 1. Wed 10/07 6:30p - 7:30p. There are 25 multiple choice questions. Each one is worth 4 points.
CS177 Fall 2015 Midterm 1 Wed 10/07 6:30p - 7:30p There are 25 multiple choice questions. Each one is worth 4 points. Answer the questions on the bubble sheet given to you. Only the answers on the bubble
More informationThomas Jefferson Invitational Open in Informatics
Thomas Jefferson Invitational Open in Informatics Sample Problems (With Solutions) Version 2.01.1 By programmers, For programmers Preface Preface Welcome to the TJ IOI Sample Problems document. Here, you
More informationMath 3361-Modern Algebra Lecture 08 9/26/ Cardinality
Math 336-Modern Algebra Lecture 08 9/26/4. Cardinality I started talking about cardinality last time, and you did some stuff with it in the Homework, so let s continue. I said that two sets have the same
More information2 - Strings and Binomial Coefficients
November 14, 2017 2 - Strings and Binomial Coefficients William T. Trotter trotter@math.gatech.edu Basic Definition Let n be a positive integer and let [n] = {1, 2,, n}. A sequence of length n such as
More informationAt the end of the exam you must copy that folder onto a USB stick. Also, you must your files to the instructor.
Before you begin your work, please create a new file folder on your computer. The name of the folder should be YourLastName_YourFirstName For example, if your name is John Smith your folder should be named
More informationDepartment of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007)
Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination II (Fall 2007) Problem 1: Specify two different predicates P (x) and
More informationIntroduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:
German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Rimon Elias Dr. Hisham Othman Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:
More informationQuiz 1 Solutions. Problem 2. Asymptotics & Recurrences [20 points] (3 parts)
Introduction to Algorithms October 13, 2010 Massachusetts Institute of Technology 6.006 Fall 2010 Professors Konstantinos Daskalakis and Patrick Jaillet Quiz 1 Solutions Quiz 1 Solutions Problem 1. We
More informationQuiz 2 out of 50 points
Quiz 2 out of 50 points Print your name on the line below. Do not turn this page over until told by the staff to do so. This quiz is closed-book. However, you may utilize during the quiz one two-sided
More informationFinal Exam Version A December 16, 2014 Name: NetID: Section: # Total Score
CS 374 : Algorithms and Models of Computation, Fall 2014 Final Exam Version A December 16, 2014 Name: NetID: Section: 1 2 3 # 1 2 3 4 5 6 Total Score Max 20 10 10 10 10 10 70 Grader Don t panic! Please
More informationAssignment 1: Due Friday Feb 6 at 6pm
CS1110 Spring 2015 Assignment 1: Due Friday Feb 6 at 6pm You must work either on your own or with one partner. If you work with a partner, you and your partner must first register as a group in CMS and
More informationCSE 331 Winter 2018 Homework 1
Directions: - Due Wednesday, January 10 by 11 pm. - Turn in your work online using gradescope. You should turn in a single pdf file. You can have more than one answer per page, but please try to avoid
More informationElementary Sorts 1 / 18
Elementary Sorts 1 / 18 Outline 1 Rules of the Game 2 Selection Sort 3 Insertion Sort 4 Shell Sort 5 Visualizing Sorting Algorithms 6 Comparing Sorting Algorithms 2 / 18 Rules of the Game Sorting is the
More informationData Structure and Algorithm Homework #1 Due: 2:20pm, Tuesday, March 12, 2013 TA === Homework submission instructions ===
Data Structure and Algorithm Homework #1 Due: 2:20pm, Tuesday, March 12, 2013 TA email: dsa1@csie.ntu.edu.tw === Homework submission instructions === For Problem 1, submit your source code, a Makefile
More informationData Structures in Java
Data Structures in Java Lecture 20: Algorithm Design Techniques 12/2/2015 Daniel Bauer 1 Algorithms and Problem Solving Purpose of algorithms: find solutions to problems. Data Structures provide ways of
More informationNotater: INF3331. Veronika Heimsbakk December 4, Introduction 3
Notater: INF3331 Veronika Heimsbakk veronahe@student.matnat.uio.no December 4, 2013 Contents 1 Introduction 3 2 Bash 3 2.1 Variables.............................. 3 2.2 Loops...............................
More informationITI Introduction to Computing II
(with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 11, 2015 Please don t print these lecture notes unless you really need to!
More informationReview Exercise 2. 1 a Chemical A 5x+ Chemical B 2x+ 2y12 [ x+ Chemical C [ 4 12]
Review Exercise a Chemical A 5x+ y 0 Chemical B x+ y [ x+ y 6] b Chemical C 6 [ ] x+ y x+ y x, y 0 c T = x+ y d ( x, y) = (, ) T = Pearson Education Ltd 08. Copying permitted for purchasing institution
More informationObject Oriented Software Design (NTU, Class Even, Spring 2009) Final Examination Problem Sheet TIME: 06/16/2009, 14:20 17:20
Final Examination Problem Sheet TIME: 06/16/2009, 14:20 17:20 This is a closed-book exam. Any form of cheating or lying will not be tolerated. Students can get zero scores and/or fail the class and/or
More informationOne-to-one functions and onto functions
MA 3362 Lecture 7 - One-to-one and Onto Wednesday, October 22, 2008. Objectives: Formalize definitions of one-to-one and onto One-to-one functions and onto functions At the level of set theory, there are
More informationYou have 3 hours to complete the exam. Some questions are harder than others, so don t spend too long on any one question.
Data 8 Fall 2017 Foundations of Data Science Final INSTRUCTIONS You have 3 hours to complete the exam. Some questions are harder than others, so don t spend too long on any one question. The exam is closed
More informationUniversity of New Mexico Department of Computer Science. Midterm Examination. CS 361 Data Structures and Algorithms Spring, 2003
University of New Mexico Department of Computer Science Midterm Examination CS 361 Data Structures and Algorithms Spring, 2003 Name: Email: Print your name and email, neatly in the space provided above;
More information8. More on Iteration with For
8. More on Iteration with For Topics: Using for with range Summation Computing Min s Functions and for-loops Graphical iteration Traversing a String Character-by-Character s = abcd for c in s: print c
More information9A. Iteration with range. Topics: Using for with range Summation Computing Min s Functions and for-loops A Graphics Applications
9A. Iteration with range Topics: Using for with range Summation Computing Min s Functions and for-loops A Graphics Applications Iterating Through a String s = abcd for c in s: print c Output: a b c d In
More informationIntroduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:
German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 1 Discussion:
More informationA. TONTON AND THE ACCIDENT Time limit: 1s Memory limit: 512MB Input stream: stdin Output stream: stdout
A. TONTON AND THE ACCIDENT On the independence day of Tonton kingdom, Tonton friends take a day trip to the Tonton forest. However, an accident happens that all of friends fall down to a scared deep hole.
More informationLexical Analysis. Reinhard Wilhelm, Sebastian Hack, Mooly Sagiv Saarland University, Tel Aviv University.
Lexical Analysis Reinhard Wilhelm, Sebastian Hack, Mooly Sagiv Saarland University, Tel Aviv University http://compilers.cs.uni-saarland.de Compiler Construction Core Course 2017 Saarland University Today
More informationMore Example Using Loops
Loops and Repetitive Computations For More Example Using Loops Example 35 (contd) printing of first row print the first day i= i+1 no i < 7? yes printf("%6d", i) exit no i < =n? i = i+7 printf("\n") printing
More informationReleased Test Answer and Alignment Document Mathematics Grade 4 Performance Based Assessment
Released Test Answer and Alignment Document Mathematics Grade 4 Performance Based Assessment The following pages include the answer key for all machine-scored items, followed by the rubrics for the hand-scored
More informationAnalysis of Algorithms. Outline 1 Introduction Basic Definitions Ordered Trees. Fibonacci Heaps. Andres Mendez-Vazquez. October 29, Notes.
Analysis of Algorithms Fibonacci Heaps Andres Mendez-Vazquez October 29, 2015 1 / 119 Outline 1 Introduction Basic Definitions Ordered Trees 2 Binomial Trees Example 3 Fibonacci Heap Operations Fibonacci
More informationBanneker Middle School. Summer Math Packet C2.0 Algebra 1
Banneker Middle School Summer Math Packet C2.0 Algebra 1 Dear Student and Parent, The purpose of this packet is to provide a review of objectives that were taught the previous school year and provide tasks
More informationITI Introduction to Computing II
(with contributions from R. Holte) School of Electrical Engineering and Computer Science University of Ottawa Version of January 9, 2019 Please don t print these lecture notes unless you really need to!
More information4 ORTHOGONALITY ORTHOGONALITY OF THE FOUR SUBSPACES 4.1
4 ORTHOGONALITY ORTHOGONALITY OF THE FOUR SUBSPACES 4.1 Two vectors are orthogonal when their dot product is zero: v w = orv T w =. This chapter moves up a level, from orthogonal vectors to orthogonal
More information1. Problem I calculated these out by hand. It was tedious, but kind of fun, in a a computer should really be doing this sort of way.
. Problem 5.2-. I calculated these out by hand. It was tedious, but kind of fun, in a a computer should really be doing this sort of way. 2 655 95 45 243 77 33 33 93 86 5 36 8 3 5 2 4 2 2 2 4 2 2 4 4 2
More informationMA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation Closure properties of Regular Languages Pumping Theorem Your Questions? Previous class days' material Reading Assignments HW 6 or 7 problems Anything else 1 Regular Expressions
More informationFinal Exam (Version B) December 16, 2014 Name: NetID: Section: 1 2 3
CS 374 : Algorithms and Models of Computation, Fall 2014 Final Exam (Version B) December 16, 2014 Name: NetID: Section: 1 2 3 # 1 2 3 4 5 6 Total Score Max 20 10 10 10 10 10 70 Grader Don t panic! Please
More informationIntroduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion: power(m,n) = m n
German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 5 Discussion:
More informationRead this before starting!
Points missed: Student's Name: Total score: / points East Tennessee State University Department of Computer and Information Sciences CSCI 25 (Tarnoff) Computer Organization TEST 2 for Fall Semester, 28
More informationSection 001. Read this before starting! You may use one sheet of scrap paper that you will turn in with your test.
Points missed: Student's Name: Total score: /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 1 for Spring Semester,
More informationMiniMat: Matrix Language in OCaml LLVM
Terence Lim - tl2735@columbia.edu August 17, 2016 Contents 1 Introduction 4 1.1 Goals........................................ 4 1.1.1 Flexible matrix notation......................... 4 1.1.2 Uncluttered................................
More informationCS325: Analysis of Algorithms, Fall Final Exam
CS: Analysis of Algorithms, Fall 0 Final Exam I don t know policy: you may write I don t know and nothing else to answer a question and receive percent of the total points for that problem whereas a completely
More informationMathematics 222a Quiz 2 CODE 111 November 21, 2002
Student s Name [print] Student Number Mathematics 222a Instructions: Print your name and student number at the top of this question sheet. Print your name and your instructor s name on the answer sheet.
More informationCSCI-141 Exam 1 Review September 19, 2015 Presented by the RIT Computer Science Community
CSCI-141 Exam 1 Review September 19, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. Python basics (a) The programming language Python (circle the best answer): i. is primarily
More informationCITS2211 Discrete Structures (2017) Cardinality and Countability
CITS2211 Discrete Structures (2017) Cardinality and Countability Highlights What is cardinality? Is it the same as size? Types of cardinality and infinite sets Reading Sections 45 and 81 84 of Mathematics
More informationCounting Methods. CSE 191, Class Note 05: Counting Methods Computer Sci & Eng Dept SUNY Buffalo
Counting Methods CSE 191, Class Note 05: Counting Methods Computer Sci & Eng Dept SUNY Buffalo c Xin He (University at Buffalo) CSE 191 Discrete Structures 1 / 48 Need for Counting The problem of counting
More informationRead this before starting!
Points missed: Student's Name: Total score: / points East Tennessee State University Department of Computer and Information Sciences CSCI 25 (Tarnoff) Computer Organization TEST 2 for Spring Semester,
More informationLexical Analysis: DFA Minimization & Wrap Up
Lexical Analysis: DFA Minimization & Wrap Up Automating Scanner Construction PREVIOUSLY RE NFA (Thompson s construction) Build an NFA for each term Combine them with -moves NFA DFA (subset construction)
More informationCSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4
CSE 20 Lecture 4: Introduction to Boolean algebra Reminder First quiz will be on Friday (17th January) in class. It is a paper quiz. Syllabus is all that has been done till Wednesday. If you want you may
More informationCSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis. Ruth Anderson Winter 2019
CSE332: Data Structures & Parallelism Lecture 2: Algorithm Analysis Ruth Anderson Winter 2019 Today Algorithm Analysis What do we care about? How to compare two algorithms Analyzing Code Asymptotic Analysis
More informationSponsored by: UGA Math Department and UGA Math Club. Written test, 25 problems / 90 minutes November 16, 2013
Sponsored by: UGA Math Department and UGA Math Club Written test, 5 problems / 90 minutes November 6, 03 Instructions. At the top of the left of side of your scan-tron answer sheet, fill in your last name,
More informationCycle 2: Why Does It Matter?
Lesson. It s All Relative 9 Part Cycle : Why Does It Matter? Lesson. It s All Relative. 5 5.. a. Negative; $0,000 Negative; 400 4. a. Loss of 0 yards Loss of 0.6 points for the day 5. 6. a. 6 6 4 4 c.
More informationNumerical Methods Lecture 2 Simultaneous Equations
Numerical Methods Lecture 2 Simultaneous Equations Topics: matrix operations solving systems of equations pages 58-62 are a repeat of matrix notes. New material begins on page 63. Matrix operations: Mathcad
More informationA secret of bees 1 MODELLING EXERCISE. (by Thilo Gross)
A secret of bees 1 (by Thilo Gross) Bees have interesting family trees. A male bee, a so-called drone (D) only has one parent, who is a queen (Q). A queen has two parents, a queen and a drone. So a drone
More informationE40M. Binary Numbers. M. Horowitz, J. Plummer, R. Howe 1
E40M Binary Numbers M. Horowitz, J. Plummer, R. Howe 1 Reading Chapter 5 in the reader A&L 5.6 M. Horowitz, J. Plummer, R. Howe 2 Useless Box Lab Project #2 Adding a computer to the Useless Box alows us
More informationIntroduction to Python
Introduction to Python Luis Pedro Coelho Institute for Molecular Medicine (Lisbon) Lisbon Machine Learning School II Luis Pedro Coelho (IMM) Introduction to Python Lisbon Machine Learning School II (1
More informationFranklin Math Bowl 2007 Group Problem Solving Test 6 th Grade
Group Problem Solving Test 6 th Grade 1. Consecutive integers are integers that increase by one. For eample, 6, 7, and 8 are consecutive integers. If the sum of 9 consecutive integers is 9, what is the
More information1 Java Night Countdown (30%)
Midterm Examination Problem Sheet TIME: 04/18/2009, 19:00 21:00 This is a open-textbook exam. You can use the Absolute Java textbook as your reference during the exam. Any other references are not allowed.
More informationPhysics 101. Hour Exam I Fall Last Name: First Name Network-ID Discussion Section: Discussion TA Name:
Last Name: First Name Network-ID Discussion Section: Discussion TA Name: Instructions Turn off your cell phone and put it away. Keep your calculator on your own desk. Calculators cannot be shared. This
More informationLinear Programming The Simplex Algorithm: Part II Chapter 5
1 Linear Programming The Simplex Algorithm: Part II Chapter 5 University of Chicago Booth School of Business Kipp Martin October 17, 2017 Outline List of Files Key Concepts Revised Simplex Revised Simplex
More informationPeriodic Table and Atomic Structure: Secret Agent Student Advanced Version
Periodic Table and Atomic Structure: Secret Agent Student Advanced Version This lab explores the structure of atoms and elements as well as simple ionic bonds. Students use colored beads and the periodic
More informationPiXL AQA Style Pre Paper 2H Practice Answers
PiXL AQA Style Pre Paper 2H Practice Answers This set of answers is not a conventional marking scheme; while it gives a basic allocation of marks, its main purpose it to help students understand how to
More informationTuring Machine Recap
Turing Machine Recap DFA with (infinite) tape. One move: read, write, move, change state. High-level Points Church-Turing thesis: TMs are the most general computing devices. So far no counter example Every
More informationWhere, on Earth, are you?
Where, on Earth, are you? We all live on a big planet called Earth, of course. But where on Earth? And if you want to go to a different spot on Earth other than the spot you are in, how do you know which
More informationUniversity of New Mexico Department of Computer Science. Final Examination. CS 561 Data Structures and Algorithms Fall, 2006
University of New Mexico Department of Computer Science Final Examination CS 561 Data Structures and Algorithms Fall, 2006 Name: Email: Print your name and email, neatly in the space provided above; print
More informationExam EDAF May 2011, , Vic1. Thore Husfeldt
Exam EDAF05 25 May 2011, 8.00 13.00, Vic1 Thore Husfeldt Instructions What to bring. You can bring any written aid you want. This includes the course book and a dictionary. In fact, these two things are
More informationMath Final Exam December 14, 2009 Page 1 of 5
Math 201-803-Final Exam December 14, 2009 Page 1 of 5 (3) 1. Evaluate the expressions: (a) 10 C 4 (b) 10 P 4 (c) 15!4! 3!11! (4) 2. (a) In how many ways can a president, a vice president and a treasurer
More informationMassachusetts Tests for Educator Licensure (MTEL )
Massachusetts Tests for Educator Licensure (MTEL ) BOOKLET 2 Mathematics Subtest Copyright 2010 Pearson Education, Inc. or its affiliate(s). All rights reserved. Evaluation Systems, Pearson, P.O. Box 226,
More informationJune Mr. Brown
June 06 Hello, future Algebra II students: The packet attached to this letter contains a series of problems that will overview the Algebra I skills you must have mastered in order to have a good start
More information0478 COMPUTER SCIENCE
CAMBRIDGE INTERNATIONAL EXAMINATIONS Cambridge International General Certificate of Secondary Education www.xtremepapers.com MARK SCHEME f the May/June 2015 series 0478 COMPUTER SCIENCE 0478/23 Paper 2
More informationCS325: Analysis of Algorithms, Fall Midterm
CS325: Analysis of Algorithms, Fall 2017 Midterm I don t know policy: you may write I don t know and nothing else to answer a question and receive 25 percent of the total points for that problem whereas
More informationMathematics 8 Review 1 Square Roots. Practice: When a number is multiplied by itself, you square the number. The product is a perfect square.
Mathematics 8 Review 1 Square Roots When a number is multiplied by itself, you square the number. The product is a perfect square. For example: The square of 5 is 5 5 25 We write: 5 2 5 5 25 We say: Five
More informationIntroduction to Computer Programming, Spring Term 2018 Practice Assignment 3 Discussion:
German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Mohammed Abdel Megeed Introduction to Computer Programming, Spring Term 2018 Practice Assignment 3 Discussion:
More informationTricks of the Trade in Combinatorics and Arithmetic
Tricks of the Trade in Combinatorics and Arithmetic Zachary Friggstad Programming Club Meeting Fast Exponentiation Given integers a, b with b 0, compute a b exactly. Fast Exponentiation Given integers
More informationprinting Three areas: solid calculus, particularly calculus of several
Math 5610 printing 5600 5610 Notes of 8/21/18 Quick Review of some Prerequisites Three areas: solid calculus, particularly calculus of several variables. linear algebra Programming (Coding) The term project
More informationMHCA Math Summer Packet 2015
Directions: MHCA Math Summer Packet 2015 For students entering PreCalculus Honors You are to complete all the problems assigned in this packet by Friday, September 4 th. If you don t turn in your summer
More informationReview of matrices. Let m, n IN. A rectangle of numbers written like A =
Review of matrices Let m, n IN. A rectangle of numbers written like a 11 a 12... a 1n a 21 a 22... a 2n A =...... a m1 a m2... a mn where each a ij IR is called a matrix with m rows and n columns or an
More informationof a circle Q that can be inscribed in a corner of the square tangent to two sides of the square and to the circle inscribed in the square?
Problem 1) Suppose A, B, and C are the vertices of a right triangle with C being the vertex of the right angle, c the length of the hypotenuse, a the length of the leg opposite A, and b the length of the
More informationLesson 1: Inverses of Functions Lesson 2: Graphs of Polynomial Functions Lesson 3: 3-Dimensional Space
Table of Contents Introduction.............................................................. v Unit 1: Modeling with Matrices... 1 Lesson 2: Solving Problems Using Matrices.................................
More informationRecursive Definitions
Recursive Definitions Example: Give a recursive definition of a n. a R and n N. Basis: n = 0, a 0 = 1. Recursion: a n+1 = a a n. Example: Give a recursive definition of n i=0 a i. Let S n = n i=0 a i,
More informationIntermediate Mathematics Provincial Assessment 2009
Intermediate Mathematics Last Name: First Name: MI: Teacher: School: School District: You will have to complete your name and school information in three places: (1) On this sheet (above) (2) On the bubble
More information(tree searching technique) (Boolean formulas) satisfying assignment: (X 1, X 2 )
Algorithms Chapter 5: The Tree Searching Strategy - Examples 1 / 11 Chapter 5: The Tree Searching Strategy 1. Ex 5.1Determine the satisfiability of the following Boolean formulas by depth-first search
More information4. What is the probability that the two values differ by 4 or more in absolute value? There are only six
1. Short Questions: 2/2/2/2/2 Provide a clear and concise justification of your answer. In this problem, you roll two balanced six-sided dice. Hint: Draw a picture. 1. What is the probability that the
More informationOutline. policies for the first part. with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014
Outline 1 midterm exam on Friday 11 July 2014 policies for the first part 2 questions with some potential answers... MCS 260 Lecture 10.0 Introduction to Computer Science Jan Verschelde, 9 July 2014 Intro
More information6.001 Recitation 22: Streams
6.001 Recitation 22: Streams RI: Gerald Dalley, dalleyg@mit.edu, 4 May 2007 http://people.csail.mit.edu/dalleyg/6.001/sp2007/ The three chief virtues of a programmer are: Laziness, Impatience and Hubris
More information1.2 Inductive Reasoning
1.2 Inductive Reasoning Goal Use inductive reasoning to make conjectures. Key Words conjecture inductive reasoning counterexample Scientists and mathematicians look for patterns and try to draw conclusions
More informationMath.3336: Discrete Mathematics. Combinatorics: Basics of Counting
Math.3336: Discrete Mathematics Combinatorics: Basics of Counting Instructor: Dr. Blerina Xhabli Department of Mathematics, University of Houston https://www.math.uh.edu/ blerina Email: blerina@math.uh.edu
More informationData Structures and Algorithms Winter Semester
Page 0 German University in Cairo December 26, 2015 Media Engineering and Technology Faculty Prof. Dr. Slim Abdennadher Dr. Wael Abouelsadaat Data Structures and Algorithms Winter Semester 2015-2016 Final
More informationRead this before starting!
Points missed: Student's Name: Total score: / points East Tennessee State University epartment of omputer and Information Sciences SI 25 (Tarnoff) omputer Organization TEST 2 for Fall Semester, 28 Read
More informationIntermediate Mathematics League of Eastern Massachusetts
Intermediate Mathematics League of Eastern Massachusetts Meet # January, 2002 Category 1 Mystery 1. How many positive whole numbers between 202 and 2002 are divisible by 4, 5, and 6? 2. What is the largest
More informationCS-140 Fall 2018 Test 2 Version Practice Nov. 12, Name:
CS-140 Fall 2018 Test 2 Version Practice Nov. 12, 2018 Name: 1. (10 points) For the following, Check T if the statement is true, or F if the statement is false. (a) T F : If a child overrides its parent
More informationFall 2016 Test 1 with Solutions
CS3510 Design & Analysis of Algorithms Fall 16 Section B Fall 2016 Test 1 with Solutions Instructor: Richard Peng In class, Friday, Sep 9, 2016 Do not open this quiz booklet until you are directed to do
More information