Assignment 10 Sample problems. Generalized Manhattan.

Slides:



Advertisements
Similar presentations
Monday, 13 April Created by Mr.Lafferty Level E Quadrilaterals This presentation will cover the basic properties of various quadrilaterals. It is.
Advertisements

A. How do we tell the location by letters and numbers?
Five Themes of Geography
Direction at your fingertips. A compass rose is a design on a map that shows directions. It shows north, south, east, west, northeast, northwest, southeast,
Help me find the cardinal directions
Probability Theory: Counting in Terms of Proportions Great Theoretical Ideas In Computer Science Steven Rudich, Anupam GuptaCS Spring 2004 Lecture.
Seattle Preparatory School Advanced Placement Computer Science Seattle Preparatory School Advanced Placement Computer Science LESSON 62 FEBRUARY 12, 2015.
Real Numbers Week 1 Topic 1.
EDT Chapter 41 Coordinate Systems Cartesian, Relative and Polar Sacramento City College EDT 310.
Chapter 12 Section 1 Measuring Motion Bellringer
The Land Around Us An Introduction to Maps By: Mrs. Miles.
Estimating Square Roots The square root of a number is the value that, when multiplied by itself, gives the original number. 2 x 2 = 4 Square RootSquare.
9.5 APPLICATION OF TRIG NAVIGATION.
THIS MINI-LESSON WILL COVER: What is the difference between scalars and vector quantities? What is the difference between distance and displacement ?
25-Oct-15 Jeroo Code. Overview In this presentation we will discuss: How to write code in Jeroo How to run a Jeroo program.
Map Skills Compass Rose. Vocabulary Words A compass rose is a symbol that helps someone find directions on a map.
DIRECTIONS. These are the questions pertaining to movement of a person or a vehicle in a given direction. Using sense of direction, you are required to.
Day 6 What we will do today…. Review: Measurement Directions: Copy and Answer the following questions. 1.What is another word that describes length? 2.The.
Review Maps/Globes Grade 3. A ______________ is a model of the Earth that A ______________ is a model of the Earth that is shaped like a ball or _______________.
9-4 Polygons in the Coordinate Plane Learn to draw polygons in the coordinate plane and find the lengths of their sides.
Motion What are some words and/or concepts we use when describing motion? Look at an object. Close your eyes. In a few seconds, open them again. Can you.
Theme 4 - Location Where is It?Where is It? Why is It There?Why is It There? Two Types of Location Absolute Relative.
Maps. The World Political  Political maps show how people have divided places on the Earth into countries, states, cities.
Dividing a Decimal by a Decimal. Dividing Whole Numbers 12 ÷ 2 = 120 ÷ 20 = 1200 ÷ 200 = ÷ 2000 = Multiply both 12 and 2 by 10 Multiply.
Map Skills.
Motion Graphs Position vs. time. Vocabulary Position Where you are relative to the origin (reference point/observer) Distance The total length of how.
Factorization : Difference of Two Squares and Perfect Squares.
Motion Unit 2 Chapter 11.1 & 11.2 Distance vs. Displacement Speed and Velocity.
Quick Sort Modifications By Mr. Dave Clausen Updated for Python.
Distance vs. Displacement Unit 5– Lecture 1. Distance Distance – the length traveled by an object Practice – What is the distance? ▫Pattie walks 4 km.
1. Map Key/Legend – a part of a map that explains what the symbols on the map represent. 2. Compass Rose – a direction marker on a map 3. Cardinal Directions.
Motion and Force Chapter Three: Motion 3.1 Position and Velocity 3.2 Graphs of Motion 3.3 Acceleration.
Measurement and Geometry 43 North South East West South-East South-West North-West North-East
Map Notes. Compass Rose ► A symbol used to show directions.
Basics of Geography.
Geography: The Study of Earth
MATHEMATICS The Measure of Data Location
NORTHINGS AND EASTINGS
Principles of a Grid Reference
Jeroo Code 18-Jul-18.
DESCRIBING POSITION How would you describe where you are right now?
Principles of a Grid Reference
Describing Motion.
Chapter 5 Section 1 Motion.
Modeling with Geometry
Selection Sort – an array sorting algorithm
Parts of a Map.
Analyzing Displacement, Velocity and Vector Directions
Parts of a Map.
What is the half life of an element and why is this important?
REVIEW: Perfect Squares
Building Geography Skills
Motion and Force. Motion and Force Chapter Three: Motion 3.1 Position and Velocity 3.2 Graphs of Motion 3.3 Acceleration.
Motion and Force. Motion and Force Chapter Twelve: Distance, Time, and Speed 12.1 Distance, Direction, and Position 12.2 Speed 12.3 Graphs of Motion.
Theme 4 - Location Two Types of Location Where is It? Absolute
Parts of a Map.
Motion and Force. Motion and Force Chapter Three: Motion 3.1 Position and Velocity 3.2 Graphs of Motion 3.3 Acceleration.
北 N north 西 W west 東 E east south南 S.
Estimating Non-perfect Radicals Scientific Notation
Pythagorean Theorem Skill 61.
Warm Up Problem of the Day Lesson Presentation Lesson Quizzes 1.
National Geographic Reach for Reading
NORTHINGS AND EASTINGS
Distance, Direction and Position
Motion and Force. Motion and Force Chapter Three: Motion 3.1 Position and Velocity 3.2 Graphs of Motion 3.3 Acceleration.
Maps & Map Keys.
Parts of a Map.
Jeroo Code 7-Sep-19.
Coordinate Systems Cartesian, Relative and Polar
Map Elements.
Presentation transcript:

Assignment 10 Sample problems

Generalized Manhattan

Consider a generalized form of Manhattan where n streets and n avenues form a square grid graph. That is, every block is a perfect square with the same area. For each of the following walking paths, choose the corresponding distanced walked in big O notation. (The length of one block is one unit.)

Start in the southwest corner. Walk north four blocks, east two blocks, south two blocks, west one block.

The answer is O(1)

How can we get ? =9=O(1)

Start in the southwest corner. Walk diagonally to the northeast corner.

The answer is O(n)

How can we get ? n+n=2n=O(n)

Start in the southwest corner. Repeat walk up to the north (n-1) street, then turn right to walk east one block, down to the southern- most street and left one block. Stop when the most right southeast avenue is reached.

The answer is O(n²)

How can we get ? n*(n-1)+n=n²=O(n²)

Average Waiting Time

Consider the word “blueberry". Suppose we repeatedly pick a single letter at random from anywhere in the word. (Please enter any fractional answers in their decimal form.) 1)How many times, on average, do we pick before we get the letter “b"? 2) How many times, on average, do we pick before we get the letter “u"? 3)How many times, on average, do we pick before we get one of the letters in the word “beer"?

Consider the word “blueberry". Suppose we repeatedly pick a single letter at random from anywhere in the word. (Please enter any fractional answers in their decimal form.) 1)How many times, on average, do we pick before we get the letter “b"? The answer is 4.5 2) How many times, on average, do we pick before we get the letter “u"? The answer is 9 3)How many times, on average, do we pick before we get one of the letters in the word “beer"? The answer is 1.5

How can we get ? 1: p=2/9, so the answer is 1/p=4.5 2: p=1/9, so the answer is 1/p=9 3: p=2/9+2/9+2/9=6/9, so the answer is 1/p=9/6=1.5

Number of Bisections

Suppose you have a bag of 512 chocolates. You decide to give them to your friends by dividing the chocolates into half. For example, you give half of these chocolates to your best friend, then give another half of leftover chocolates to your another friend. Each time, you just give half of the leftover chocolates to one of your friend. How many times total can you divide like this before you only have one chocolate left?

The answer is 9 2.^9=512

Find the Biggest Element

1) What is the minimum number of operations to find the biggest element in an unsorted list of size n? 2) What is the minimum number of operations required to find the biggest element of a sorted (ascending) list of length n?

1) What is the minimum number of operations to find the biggest element in an unsorted list of size n? The answer is n-1 2) What is the minimum number of operations required to find the biggest element of a sorted (ascending) list of length n? The answer is 0

How can we get ? 1:for unsorted list, you need compare n-1 times to find the maximum number 2: for sorted list, you do not need compare them again, you can directly get the maximum number from the end of the sorted list