Algorithms: The recipe for computation
|
|
- Nickolas Roberts
- 5 years ago
- Views:
Transcription
1 Algorithms: The recipe for computation 2B Experimenting with algorithms Principles of Computation, Carnegie Mellon University - CORTINA 1 Fundamentals of Computational Algorithms A variable is used to represent a data value needed for the algorithm. When algorithms are implemented as computer programs, a variable corresponds to a memory cell where data is stored for the computer program. A variable can store only one data value at a time. If an algorithm instructs us to store a data value in a variable (e.g. Set x = 1 ), the previous value associated with this variable is lost. x Principles of Computation, Carnegie Mellon University - CORTINA 2 1
2 Fundamentals of Computational Algorithms A variable can also be used to represent an ordered collection of data values. Such a variable is called a vector. A data value in a vector is named using the variable name and a subscript. A This value is labeled A[0] Principles of Computation, Carnegie Mellon University - CORTINA 3 Fundamentals of Computational Algorithms Example: Let A be a vector of 8 integers. Set A[0] = 1. Set A[0] = 1. Set A[1] = 2. Set i = 0. Set A[2] = 4. Do the following 7 times: Set A[3] = 8. Add 1 to i. Set A[4] = 16. Set A[i] = A[i-1] * 2 Set A[5] = 32. Set A[6] = 64. Set A[7] = Principles of Computation, Carnegie Mellon University - CORTINA 4 2
3 Algorithm Example 1. Input m 2. Set n = While m > 0 do the following: a. Multiply n by 2. b. Subtract 1 from m. 4. Output n. m n Principles of Computation, Carnegie Mellon University - CORTINA 5 Vector Example 3. Set i = 0 4. Set m = A[0] 5. Do the following while i < n-1: a. Add 1 to i b. If A[i] > m, set m = A[i] SELECTION 6. Output m if this is true then we do this otherwise, we don t do anything for this substep Principles of Computation, Carnegie Mellon University - CORTINA 6 3
4 Vector Example 3. Set i = 0 4. Set m = A[0] 5. Do the following while i < n-1: a. Add 1 to i b. If A[i] > m, set m = A[i] 6. Output m LOOP repeat this pair of steps as long as the condition is true NOTE: You cannot exit out of this loop in the middle of its work! Principles of Computation, Carnegie Mellon University - CORTINA 7 Tracing Points 3. Set i = 0 4. Set m = A[0] 5. Do the following while i < n-1: a. Add 1 to i b. If A[i] > m, set m = A[i] 6. Output m In order to trace what an algorithm is doing, take a snapshot immediately after a step is executed, and examine the contents of all variables Principles of Computation, Carnegie Mellon University - CORTINA 8 4
5 Tracing the algorithm n = 5 A = [4, 7, 3, 9, 8] i m Input a vector of values A[0], A[1],..., A[n-1] 3. Set i = 0 4. Set m = A[0] 5. Do the following while i < n-1: a. Add 1 to i b. If A[i] > m, set m = A[i] 6. Output m Principles of Computation, Carnegie Mellon University - CORTINA 9 Another way to look at it 3. Set i = 0 4. Set m = A[0] 5. Do the following while i < n-1 : a. Add 1 to i b. If A[i] > m, set m = A[i] 6. Output m Principles of Computation, Carnegie Mellon University - CORTINA 10 5
6 Another algorithm LOOP exchange A[i] and A[i+1] LOOP Loop: repeat each step in the box the indicated number of times IMPORTANT: You cannot exit the loop in the middle of its steps Principles of Computation, Carnegie Mellon University - CORTINA 11 Another algorithm exchange A[i] and A[i+1] if this is true then we do this otherwise, we don t do anything for this substep Principles of Computation, Carnegie Mellon University - CORTINA 12 6
7 Tracing Points exchange A[i] and A[i+1] In order to trace what an algorithm is doing, take a snapshot immediately after a step is executed, and examine the contents of all variables Principles of Computation, Carnegie Mellon University - CORTINA 13 Tracing the algorithm (1) n = 5 A = [8, 4, 9, 3, 7] i A 0 [8, 4, 9, 3, 7] 2. Input a vector of values A[0], A[1],, A[n-1] exchange A[i] and A[i+1] Principles of Computation, Carnegie Mellon University - CORTINA 14 7
8 Tracing the algorithm (2) n = 5 A = [8, 4, 9, 3, 7] i A 0 [4, 8, 3, 7, 9] 2. Input a vector of values A[0], A[1],, A[n-1] exchange A[i] and A[i+1] Principles of Computation, Carnegie Mellon University - CORTINA 15 Tracing the algorithm (3) n = 5 A = [8, 4, 9, 3, 7] i A 0 [4, 3, 7, 8, 9] 2. Input a vector of values A[0], A[1],, A[n-1] exchange A[i] and A[i+1] Principles of Computation, Carnegie Mellon University - CORTINA 16 8
9 Tracing the algorithm (4) n = 5 A = [8, 4, 9, 3, 7] i A 0 [3, 4, 7, 8, 9] 2. Input a vector of values A[0], A[1],, A[n-1] exchange A[i] and A[i+1] Principles of Computation, Carnegie Mellon University - CORTINA 17 Tracing the algorithm (5) n = 5 A = [8, 4, 9, 3, 7] i A 0 [3, 4, 7, 8, 9] 2. Input a vector of values A[0], A[1],, A[n-1] exchange A[i] and A[i+1] Principles of Computation, Carnegie Mellon University - CORTINA 18 9
10 Analyzing the algorithm Step 3 says to perform the subsequent substeps a total of n times. Does step 3 need to be performed n times in general? Principles of Computation, Carnegie Mellon University - CORTINA 19 The algorithm revised 3. Do the following n 1 times: b. Do the following n 1 times: exchange A[i] and A[i+1] Principles of Computation, Carnegie Mellon University - CORTINA 20 10
11 Analyzing the algorithm Step 3b says to examine n 1 pairs of data values in the vector. Do we need to examine all n 1 pairs in general? Principles of Computation, Carnegie Mellon University - CORTINA 21 The algorithm revised 3. Let j = 1 4. Do the following n 1 times: b. Do the following n j times: exchange A[i] and A[i+1] c. Add 1 to j 5. Output A Principles of Computation, Carnegie Mellon University - CORTINA 22 11
12 Analyzing the algorithm The algorithm continues to execute even if the vector becomes sorted. Can we stop the computation even earlier if the vector becomes sorted? How do we know if the vector is sorted? Principles of Computation, Carnegie Mellon University - CORTINA 23 The final algorithm (Bubble Sort) 3. Let j = 1 4. Do the following n 1 times: b. Let s = 0 c. Do the following n j times: exchange A[i] and A[i+1], and add 1 to s d. Add 1 to j e. If s = 0, exit step 4 and goto step 5 5. Output A Principles of Computation, Carnegie Mellon University - CORTINA 24 12
13 The evils of GOTO Edgsar Dijkstra, Dutch computer scientist who created the shortestpath algorithm used in networking today (see Chap. 4) Received the Turing Award (from ACM) in 1972 for his contributions to Computer Science Go To Statement Considered Harmful Communications of the ACM, March 1968 For a number of years I have been familiar with the observation that the quality of programmers is a decreasing function of the density of go to statements in the programs they produce. More recently I discovered why the use of the go to statement has such disastrous effects, and I became convinced that the go to statement should be abolished from all "higher level" programming languages (i.e. everything except, perhaps, plain machine code) Principles of Computation, Carnegie Mellon University - CORTINA 25 What does this algorithm do? 1. Set d = an integer between 0 and 6, inclusive. 2. Set n = an integer between 28 and 31, inclusive. 3. Draw a grid with 6 rows and 7 columns. 4. Skip the first d cells in the first row of the grid. 5. Set i = While i < n do the following: a. Write the current value of i in the next available cell of the current row of the grid. b. If (i+d) modulo 7 = 0, move to the next row. c. Add 1 to i. Trace this with d = 4 and n = Principles of Computation, Carnegie Mellon University - CORTINA 26 13
14 Tracing the algorithm d = 4 n = 31 Output: 1. Set d = an integer in [0,6]. 2. Set n = an integer in [28,31]. 3. Draw a grid with 6 rows and 7 columns. 4. Skip the first d cells in the first row of the grid. 5. Set i = While i < n do the following: a. Write the current value of i in the next available cell of the current row of the grid. b. If (i+d) modulo 7 = 0, move to the next row. c. Add 1 to i Principles of Computation, Carnegie Mellon University - CORTINA 27 What does this algorithm do? 1. Set X = 0 2. Set Y = 1 3. Set Z = 1 4. Set X = X + 4 / Z 5. While X -X > do the following: a. Set X equal to X b. Add 1 to Y c. Add 2 to Z d. If Y is odd, set X = X + 4 / Z ; otherwise set X = X 4 / Z 6. Output X Principles of Computation, Carnegie Mellon University - CORTINA 28 14
Algorithms: The recipe for computation
Algorithms: The recipe for computation 2C Visualizing Algorithms with Flowcharts 15-105 Principles of Computation, Carnegie Mellon University - CORTINA 1 Flowcharts Flowcharts are used to show the flow
More informationHow invariants help writing loops Author: Sander Kooijmans Document version: 1.0
How invariants help writing loops Author: Sander Kooijmans Document version: 1.0 Why this document? Did you ever feel frustrated because of a nasty bug in your code? Did you spend hours looking at the
More informationIntroduction to Computer Science Midterm 3 Fall, Points
Introduction to Computer Science Fall, 2001 100 Points Notes 1. Tear off this sheet and use it to keep your answers covered at all times. 2. Turn the exam over and write your name next to the staple. Do
More informationUNIT 6A Organizing Data: Lists Principles of Computing, Carnegie Mellon University
UNIT 6A Organizing Data: Lists Carnegie Mellon University 1 Data Structure The organization of data is a very important issue for computation. A data structure is a way of storing data in a computer so
More informationLecture 1 Contracts. 1 A Mysterious Program : Principles of Imperative Computation (Spring 2018) Frank Pfenning
Lecture 1 Contracts 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning In these notes we review contracts, which we use to collectively denote function contracts, loop invariants,
More informationAn Overview of ABAP Debugger Settings and System Areas
An Overview of ABAP Debugger Settings and System Areas An Overview of ABAP Debugger Settings and System Areas Authro The ABAP Debugger contains a wealth of settings and information about your ABAP environment
More informationLecture 1 Contracts : Principles of Imperative Computation (Fall 2018) Frank Pfenning
Lecture 1 Contracts 15-122: Principles of Imperative Computation (Fall 2018) Frank Pfenning In these notes we review contracts, which we use to collectively denote function contracts, loop invariants,
More informationThis lesson combines vertical translations and dilations in several quadratic and inverse variation modeling applications.
Learning Objectives Combined Vertical Transformations Algebra ; Pre-Calculus Time required: 90 min. This lesson combines vertical translations and dilations in several quadratic and inverse variation modeling
More informationData Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi
Data Structures and Algorithms Dr. Naveen Garg Department of Computer Science and Engineering Indian Institute of Technology, Delhi Lecture 20 Priority Queues Today we are going to look at the priority
More informationGOOGLE APPS. If you have difficulty using this program, please contact IT Personnel by phone at
: GOOGLE APPS Application: Usage: Program Link: Contact: is an electronic collaboration tool. As needed by any staff member http://www.google.com or http://drive.google.com If you have difficulty using
More informationStructured Programming with goto Statements
Structured Programming with goto Statements Yann-Gaël Guéhéneuc Article by Donald E. Knuth Presented in course IFT6310 GEODES Ptidej Team OO Programs Quality Evaluation and Enhancement using Patterns Group
More informationLecture 6 Binary Search
Lecture 6 Binary Search 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning One of the fundamental and recurring problems in computer science is to find elements in collections, such
More informationIntroduction to Programming in C Department of Computer Science and Engineering. Lecture No. #29 Arrays in C
Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #29 Arrays in C (Refer Slide Time: 00:08) This session will learn about arrays in C. Now, what is the word array
More informationFundamentals of Python: First Programs. Chapter 4: Strings (Indexing, Slicing, and Methods)
Fundamentals of Python: First Programs Chapter 4: Strings (Indexing, Slicing, and Methods) Objectives After completing this lesson, you will be able to: 1) Know the definition of a string and that strings
More informationNumber System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value
1 Number System Introduction In this chapter, we will study about the number system and number line. We will also learn about the four fundamental operations on whole numbers and their properties. Natural
More informationRevision Topic 11: Straight Line Graphs
Revision Topic : Straight Line Graphs The simplest way to draw a straight line graph is to produce a table of values. Example: Draw the lines y = x and y = 6 x. Table of values for y = x x y - - - - =
More informationRecursion: The Beginning
Yufei Tao ITEE University of Queensland This lecture is the inception of a powerful technique called recursion. If used judiciously, this technique can simplify the design of an algorithm significantly,
More informationMicrosoft Access XP (2002) Queries
Microsoft Access XP (2002) Queries Column Display & Sorting Simple Queries And & Or Conditions Ranges Wild Cards Blanks Calculations Multi-table Queries Table of Contents INTRODUCTION TO ACCESS QUERIES...
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2017 Lecture 2a Andrew Tolmach Portland State University 1994-2017 Review: Expressions Inspired by familiar mathematical notation Usually have recursive (tree-like) structure
More informationNumber Systems MA1S1. Tristan McLoughlin. November 27, 2013
Number Systems MA1S1 Tristan McLoughlin November 27, 2013 http://en.wikipedia.org/wiki/binary numeral system http://accu.org/index.php/articles/1558 http://www.binaryconvert.com http://en.wikipedia.org/wiki/ascii
More informationLecture 6 Sorting and Searching
Lecture 6 Sorting and Searching Sorting takes an unordered collection and makes it an ordered one. 1 2 3 4 5 6 77 42 35 12 101 5 1 2 3 4 5 6 5 12 35 42 77 101 There are many algorithms for sorting a list
More informationLet us start with a quick revision of algebra and how to work with variables. Now let us look at the simpler topic, namely Substitution.
Section F Algebra & Equations Objective In this section, we will be dealing with solving equations for the variable involved, manipulating formulae to get one variable as the subject of the formula and
More information4. Write a sum-of-products representation of the following circuit. Y = (A + B + C) (A + B + C)
COP 273, Winter 26 Exercises 2 - combinational logic Questions. How many boolean functions can be defined on n input variables? 2. Consider the function: Y = (A B) (A C) B (a) Draw a combinational logic
More informationFundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials
Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals
More informationCatalan Numbers. Table 1: Balanced Parentheses
Catalan Numbers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles November, 00 We begin with a set of problems that will be shown to be completely equivalent. The solution to each problem
More informationExcel 2016: Part 1. Updated January 2017 Copy cost: $1.50
Excel 2016: Part 1 Updated January 2017 Copy cost: $1.50 Getting Started Please note that you are required to have some basic computer skills for this class. Also, any experience with Microsoft Word is
More informationWhen Brunel s ship the SS Great Britain was launched into the River Thames, it made such a splash that several spectators on the opposite bank were
C. A. R. Hoare Emeritus Professor of Computing at the University of Oxford and is now a senior researcher at Microsoft Research in Cambridge, England. He received the 1980 ACM Turing Award for his fundamental
More informationIntroduction to Microsoft Excel
Intro to Excel Introduction to Microsoft Excel OVERVIEW In this lab, you will become familiar with the general layout and features of Microsoft Excel spreadsheet computer application. Excel has many features,
More informationA Constant Rate of Change Name Part 1
A Constant Rate of Change Name Part 1 Consider the function table below. Complete this page by solving the problems at the bottom. Use a separate sheet of paper for your descriptions and explanations.
More informationChapter 2 - Control Structures
Chapter 2 - Control Structures 1 Outline 2.1 Introduction 2.2 Algorithms 2.3 Pseudocode 2.4 Control Structures 2.5 if Selection Structure 2.6 if/else Selection Structure 2.7 while Repetition Structure
More informationCambridge Ordinary Level 2210 Computer Science November 2016 Principal Examiner Report for Teachers
COMPUTER SCIENCE Paper 2210/12 Paper 1 Key messages If a candidate writes the answer to a question on an additional page they must indicate very clearly to the Examiner where the revised answer can be
More informationMISD Elementary/Middle School Standards Based Report Cards Program
MISD PowerSchool Document MISD Elementary/Middle School Standards Based Report Cards Program Once you log in to the Standards Report Card program select your school in this first screen. Ok If you receive
More informationMaking use of other Applications
AppGameKit 2 Collision Using Arrays Making use of other Applications Although we need game software to help makes games for modern devices, we should not exclude the use of other applications to aid the
More information(Refer Slide Time 6:48)
Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 8 Karnaugh Map Minimization using Maxterms We have been taking about
More informationAccess Office Integration for Excel
Access Office Integration for Excel Introduction The following document has been designed to guide you through the process of downloading Dimensions data in to Excel via the Access Office Integration tool.
More informationCSc 110, Spring 2017 Lecture 39: searching
CSc 110, Spring 2017 Lecture 39: searching 1 Sequential search sequential search: Locates a target value in a list (may not be sorted) by examining each element from start to finish. Also known as linear
More informationPart B Finite-state Machines
MTH237: Weeks 2 5 (22) Part Finite-state Machines Text: ooper Notes, hapters 4 7 hapter4 hapter 4 Introduction to finite-state machines (printed notes) Section4. 4. yclops, the simplest possible omputer
More informationBasic tasks in Excel 2013
Basic tasks in Excel 2013 Excel is an incredibly powerful tool for getting meaning out of vast amounts of data. But it also works really well for simple calculations and tracking almost any kind of information.
More informationSearching, Sorting. Arizona State University 1
Searching, Sorting CSE100 Principles of Programming with C++, Fall 2018 (based off Chapter 9 slides by Pearson) Ryan Dougherty Arizona State University http://www.public.asu.edu/~redoughe/ Arizona State
More informationChapter 10 Error Detection and Correction 10.1
Chapter 10 Error Detection and Correction 10.1 10-1 INTRODUCTION some issues related, directly or indirectly, to error detection and correction. Topics discussed in this section: Types of Errors Redundancy
More informationBinary Representation. Jerry Cain CS 106AJ October 29, 2018 slides courtesy of Eric Roberts
Binary Representation Jerry Cain CS 106AJ October 29, 2018 slides courtesy of Eric Roberts Once upon a time... Claude Shannon Claude Shannon was one of the pioneers who shaped computer science in its early
More informationCSC 121 Spring 2017 Howard Rosenthal
CSC 121 Spring 2017 Howard Rosenthal Agenda To be able to define computer program, algorithm, and highlevel programming language. To be able to list the basic stages involved in writing a computer program.
More informationChapter 8 Algorithms 1
Chapter 8 Algorithms 1 Objectives After studying this chapter, the student should be able to: Define an algorithm and relate it to problem solving. Define three construct and describe their use in algorithms.
More informationAlgorithms: The recipe for computation
Algorithms: The recipe for computation 2A What is an algorithm? 15-105 Principles of Computation, Carnegie Mellon University - CORTINA 1 Algorithms An algorithm is a precise rule (or set of rules) specifying
More informationCMPSCI 145 Spring 2014 Lab #1. Professor William T. Verts
CMPSCI 145 Spring 2014 Lab #1 Setting Up This project must be performed on a Microsoft Windows-based PC, and not on an Apple Macintosh, unless you have installed Windows through Boot Camp, Parallels 9
More informationCS 360 Programming Languages Interpreters
CS 360 Programming Languages Interpreters Implementing PLs Most of the course is learning fundamental concepts for using and understanding PLs. Syntax vs. semantics vs. idioms. Powerful constructs like
More informationAlgorithms. Chapter 8. Objectives After studying this chapter, students should be able to:
Objectives After studying this chapter, students should be able to: Chapter 8 Algorithms Define an algorithm and relate it to problem solving. Define three construct and describe their use in algorithms.
More informationEnGenius Mesh AP Reset Tool Quick Guide
EnGenius Mesh AP Reset Tool Quick Guide Revision : 1.1 Table of Contents EnGenius MESH AP Reset Tool Quick Guide 1. Overview...3 2. Installation Procedure...3 3. Uninstallation Procedure...3 4. Tool Layout...4
More informationIntroduction to Access 97/2000
Introduction to Access 97/2000 PowerPoint Presentation Notes Slide 1 Introduction to Databases (Title Slide) Slide 2 Workshop Ground Rules Slide 3 Objectives Here are our objectives for the day. By the
More informationCreating and Displaying Multi-Layered Cross Sections in Surfer 11
Creating and Displaying Multi-Layered Cross Sections in Surfer 11 The ability to create a profile in Surfer has always been a powerful tool that many users take advantage of. The ability to combine profiles
More informationBirkbeck (University of London) Department of Computer Science and Information Systems. Introduction to Computer Systems (BUCI008H4)
Birkbeck (University of London) Department of Computer Science and Information Systems Introduction to Computer Systems (BUCI008H4) CREDIT VALUE: none Spring 2017 Mock Examination Date: Tuesday 14th March
More informationJMC 2015 Teacher s notes Recap table
JMC 2015 Teacher s notes Recap table JMC 2015 1 Number / Adding and subtracting integers Number / Negative numbers JMC 2015 2 Measuring / Time units JMC 2015 3 Number / Estimating Number / Properties of
More informationAlgorithms A Look At Efficiency
Algorithms A Look At Efficiency 1B Big O Notation 15-121 Introduction to Data Structures, Carnegie Mellon University - CORTINA 1 Big O Instead of using the exact number of operations to express the complexity
More information1. Let n be a positive number. a. When we divide a decimal number, n, by 10, how are the numeral and the quotient related?
Black Converting between Fractions and Decimals Unit Number Patterns and Fractions. Let n be a positive number. When we divide a decimal number, n, by 0, how are the numeral and the quotient related?.
More informationObjectives of This Chapter
Chapter 6 C Arrays Objectives of This Chapter Array data structures to represent the set of values. Defining and initializing arrays. Defining symbolic constant in a program. Using arrays to store, list,
More informationMIT Spring 2011 Quiz 3
MIT 6.035 Spring 2011 Quiz 3 Full Name: MIT ID: Athena ID: Run L A TEX again to produce the table 1. Consider a simple machine with one ALU and one memory unit. The machine can execute an ALU operation
More information! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)
Final Exam Exercises CS 2308 Spring 2014 Jill Seaman Chapters 1-7 + 11 Write C++ code to: Determine if a number is odd or even Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More informationTo become familiar with array manipulation, searching, and sorting.
ELECTRICAL AND COMPUTER ENGINEERING 06-88-211: COMPUTER AIDED ANALYSIS LABORATORY EXPERIMENT #2: INTRODUCTION TO ARRAYS SID: OBJECTIVE: SECTIONS: Total Mark (out of 20): To become familiar with array manipulation,
More informationCOP 3014 Honors: Spring 2017 Homework 5
COP 3014 Honors: Spring 2017 Homework 5 Total Points: 150 Due: Thursday 03/09/2017 11:59:59 PM 1 Objective The purpose of this assignment is to test your familiarity with C++ functions and arrays. You
More informationSCHOOL OF ENGINEERING & BUILT ENVIRONMENT. Mathematics. Numbers & Number Systems
SCHOOL OF ENGINEERING & BUILT ENVIRONMENT Mathematics Numbers & Number Systems Introduction Numbers and Their Properties Multiples and Factors The Division Algorithm Prime and Composite Numbers Prime Factors
More informationChapter 6 Programming the LC-3
Chapter 6 Programming the LC-3 Based on slides McGraw-Hill Additional material 4/5 Lewis/Martin Aside: Booting the Computer How does it all begin? We have LC-3 hardware and a program, but what next? Initial
More informationCRM CUSTOMER RELATIONSHIP MANAGEMENT
CRM CUSTOMER RELATIONSHIP MANAGEMENT Customer Relationship Management is identifying, developing and retaining profitable customers to build lasting relationships and long-term financial success. The agrē
More informationUNIT 6A Organizing Data: Lists. Last Two Weeks
UNIT 6A Organizing Data: Lists 1 Last Two Weeks Algorithms: Searching and sorting Problem solving technique: Recursion Asymptotic worst case analysis using the big O notation 2 1 This Week Observe: The
More informationAny Integer Can Be Written as a Fraction
All fractions have three parts: a numerator, a denominator, and a division symbol. In the simple fraction, the numerator and the denominator are integers. Eample 1: Find the numerator, denominator, and
More informationIntroduction to MATLABs Data Acquisition Toolbox, the USB DAQ, and accelerometers
Introduction to MATLABs Data Acquisition Toolbox, the USB DAQ, and accelerometers This week we will start to learn the software that we will use through the course, MATLAB s Data Acquisition Toolbox. This
More informationEXCEL PRACTICE 5: SIMPLE FORMULAS
EXCEL PRACTICE 5: SIMPLE FORMULAS SKILLS REVIEWED: Simple formulas Printing with and without formulas Footers Widening a column Putting labels and data in Bold. PART 1 - DIRECTIONS 1. Open a new spreadsheet
More informationLab 2 Power Functions
Name Student ID # Instructor Lab Period Date Due Lab 2 Power Functions Objectives 1. To become familiar with the definition of a power function, an even function, an odd function, and a root function.
More informationEXCEL walkthrough. It is from May 2012, Paper 3 Practical Test 0417/32. It is available on the OLIE under the past papers section.
EXCEL walkthrough This is a walkthrough for a fairly straightforward past paper. However, if you have done one then the rest are pretty straight forward. It is from May 2012, Paper 3 Practical Test 0417/32
More informationMATH 1MP3 Homework #4 Due: 11:59pm, Wednesday, March 6.
MATH 1MP3 Homework #4 Due: 11:59pm, Wednesday, March 6. Important notes: To start the assignment, download the Jupyter notebook file assignment 4 template.ipynb found here: https://ms.mcmaster.ca/~matt/1mp3/homework/assignment_4_template.
More informationCOUNTING AND CONVERTING
COUNTING AND CONVERTING The base of each number system is also called the radix. The radix of a decimal number is ten, and the radix of binary is two. The radix determines how many different symbols are
More informationCSCE 110 Dr. Amr Goneid Exercise Sheet (7): Exercises on Recursion
CSCE 110 Dr. Amr Goneid Exercise Sheet (7): Exercises on Recursion Consider the following recursive function: int what ( int x, int y) if (x > y) return what (x-y, y); else if (y > x) return what (x, y-x);
More informationXVIII Open Cup named after E.V. Pankratiev Stage 1: Grand Prix of Romania, Sunday, September 17, 2017
Problem A. Balance file: 1 second 512 mebibytes We say that a matrix A of size N N is balanced if A[i][j] + A[i + 1][j + 1] = A[i + 1][j] + A[i][j + 1] for all 1 i, j N 1. You are given a matrix A of size
More informationSorting is a problem for which we can prove a non-trivial lower bound.
Sorting The sorting problem is defined as follows: Sorting: Given a list a with n elements possessing a total order, return a list with the same elements in non-decreasing order. Remember that total order
More informationControl, Quick Overview. Selection. Selection 7/6/2017. Chapter 2. Control
Chapter 2 Control, Quick Overview Control Selection Selection Selection is how programs make choices, and it is the process of making choices that provides a lot of the power of computing 1 Python if statement
More information8 Algorithms 8.1. Foundations of Computer Science Cengage Learning
8 Algorithms 8.1 Foundations of Computer Science Cengage Learning 8.2 Objectives After studying this chapter, the student should be able to: Define an algorithm and relate it to problem solving. Define
More informationHow many leaves on the decision tree? There are n! leaves, because every permutation appears at least once.
Chapter 8. Sorting in Linear Time Types of Sort Algorithms The only operation that may be used to gain order information about a sequence is comparison of pairs of elements. Quick Sort -- comparison-based
More informationLaboratory 1. Part 1: Introduction to Spreadsheets
Laboratory 1 Part 1: Introduction to Spreadsheets By the end of this laboratory session you should be familiar with: Navigating around a worksheet. Naming sheets and cells. Formatting. The use of formulae.
More informationExcel Basics: Working with Spreadsheets
Excel Basics: Working with Spreadsheets E 890 / 1 Unravel the Mysteries of Cells, Rows, Ranges, Formulas and More Spreadsheets are all about numbers: they help us keep track of figures and make calculations.
More informationCSCI 334: Principles of Programming Languages. Computer Architecture (a really really fast introduction) Lecture 11: Control Structures II
1 byte{ 1 byte{ CSCI 334: Principles of Programming Languages Lecture 11: Control Structures II Computer Architecture (a really really fast introduction) Instructor: Dan Barowy Memory Instructions main
More informationUnits 0 to 4 Groovy: Introduction upto Arrays Revision Guide
Units 0 to 4 Groovy: Introduction upto Arrays Revision Guide Second Year Edition Name: Tutorial Group: Groovy can be obtained freely by going to http://groovy-lang.org/download Page 1 of 8 Variables Variables
More informationLesson 4. Objective: Compare and classify quadrilaterals. Lesson Suggested Lesson Structure. Multiply by 4 (8 minutes)
Lesson 4 3 7 Lesson 4 Objective: Suggested Lesson Structure Fluency Practice Application Problem Concept Development Student Debrief Total Time (12 minutes) (7 minutes) (31 minutes) (10 minutes) (60 minutes)
More informationGrade 6 Math Circles November 6 & Relations, Functions, and Morphisms
Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Relations Let s talk about relations! Grade 6 Math Circles November 6 & 7 2018 Relations, Functions, and
More informationSpreadsheet View and Basic Statistics Concepts
Spreadsheet View and Basic Statistics Concepts GeoGebra 3.2 Workshop Handout 9 Judith and Markus Hohenwarter www.geogebra.org Table of Contents 1. Introduction to GeoGebra s Spreadsheet View 2 2. Record
More informationIB Sets and Venn Diagram Questions- Package #1
I Sets and Venn Diagram Questions- Package #1 1. is the set of all the positive integers less than or equal to 12., and C are subsets of. = {1, 2, 3, 4, 6,12} = {odd integers} C = {5, 6, 8} (a) Write down
More informationCarnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Administrivia. Administrivia. Faloutsos/Pavlo CMU /615
Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications C. Faloutsos A. Pavlo Lecture#14(b): Implementation of Relational Operations Administrivia HW4 is due today. HW5 is out. Faloutsos/Pavlo
More informationIn either case, remember to delete each array that you allocate.
CS 103 Path-so-logical 1 Introduction In this programming assignment you will write a program to read a given maze (provided as an ASCII text file) and find the shortest path from start to finish. 2 Techniques
More informationHOW TO DIVIDE: MCC6.NS.2 Fluently divide multi-digit numbers using the standard algorithm. WORD DEFINITION IN YOUR WORDS EXAMPLE
MCC6.NS. Fluently divide multi-digit numbers using the standard algorithm. WORD DEFINITION IN YOUR WORDS EXAMPLE Dividend A number that is divided by another number. Divisor A number by which another number
More informationUNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Computational Science & Engineering
COMP60081 Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE M.Sc. in Computational Science & Engineering Fundamentals of High Performance Execution Wednesday 16 th January 2008 Time: 09:45
More informationHow to Remove Duplicate Rows in Excel
How to Remove Duplicate Rows in Excel http://www.howtogeek.com/198052/how-to-remove-duplicate-rows-in-excel/ When you are working with spreadsheets in Microsoft Excel and accidentally copy rows, or if
More informationRev. C 11/09/2010 Downers Grove Public Library Page 1 of 41
Table of Contents Objectives... 3 Introduction... 3 Excel Ribbon Components... 3 Office Button... 4 Quick Access Toolbar... 5 Excel Worksheet Components... 8 Navigating Through a Worksheet... 8 Making
More informationLecture 12 Hash Tables
Lecture 12 Hash Tables 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning, Rob Simmons Dictionaries, also called associative arrays as well as maps, are data structures that are
More informationIntroduction to Excel
Introduction to Excel Written by Jon Agnone Center for Social Science Computation & Research 145 Savery Hall University of Washington Seattle WA 98195 U.S.A. (206)543-8110 November 2004 http://julius.csscr.washington.edu/pdf/excel.pdf
More informationFlowcharts for Picaxe BASIC
Flowcharts for Picaxe BASIC Tech Studies Page 1 of 11 In the college you will use the PICAXE Programming Environment in order to carry out all of your program writing, simulating and downloading to the
More informationLecture 4 Searching Arrays
Lecture 4 Searching Arrays 15-122: Principles of Imperative Computation (Spring 2018) Frank Pfenning One of the fundamental and recurring problems in computer science is to find elements in collections,
More informationesay Solutions Ltd Using Formulae
esay Solutions Ltd Using Formulae Contents 1. Basics... 3 Example... 3 2. Form Items and Values... 4 Numbers... 4 Text... 4 Logical... 5 Using Form Items... 5 3. Computing... 7 Operators... 7 Comparing...
More informationCSC-140 Assignment 5
CSC-140 Assignment 5 Please do not Google a solution to these problems, cause that won t teach you anything about programming - the only way to get good at it, and understand it, is to do it! 1 Introduction
More informationCMPUT 396 Sliding Tile Puzzle
CMPUT 396 Sliding Tile Puzzle Sliding Tile Puzzle 2x2 Sliding Tile States Exactly half of the states are solvable, the other half are not. In the case of 2x2 puzzles, I can solve it if I start with a configuration
More informationQUICK EXCEL TUTORIAL. The Very Basics
QUICK EXCEL TUTORIAL The Very Basics You Are Here. Titles & Column Headers Merging Cells Text Alignment When we work on spread sheets we often need to have a title and/or header clearly visible. Merge
More information6.1 Evaluate Roots and Rational Exponents
VOCABULARY:. Evaluate Roots and Rational Exponents Radical: We know radicals as square roots. But really, radicals can be used to express any root: 0 8, 8, Index: The index tells us exactly what type of
More informationSorting. Sorting. Stable Sorting. In-place Sort. Bubble Sort. Bubble Sort. Selection (Tournament) Heapsort (Smoothsort) Mergesort Quicksort Bogosort
Principles of Imperative Computation V. Adamchik CS 15-1 Lecture Carnegie Mellon University Sorting Sorting Sorting is ordering a list of objects. comparison non-comparison Hoare Knuth Bubble (Shell, Gnome)
More information