APP INVENTOR. Test Review

Size: px
Start display at page:

Download "APP INVENTOR. Test Review"

Transcription

1 APP INVENTOR Test Review

2 Main Concepts App Inventor Lists Creating Random Numbers Variables Searching and Sorting Data Linear Search Binary Search Selection Sort Quick Sort Abstraction Modulus Division

3 Lists

4 Lists Lists allow you to store a large group of data within a variable. Lists are an important part of computer science as we learned with searching and sorting data (see notes below)

5 Lists Each location in a list is called an index. Example: the second item (no way) found in the list below is found in index 2. The length of a list is determined by how many items are found in the list. Example: The list below has a length of 8.

6 Random Numbers

7 Random Numbers Often in programs we need to create random numbers. The random blocks are found in the Math block category. The block above will create a random number between 1 and 100 including 1 and 100. We used this block in the magic 8 ball program.

8 Variables

9 Variables A variable is a named place in memory. Each variable has a name and stores a value. Variables can hold: Numbers Colors Words Names of files media files Variables can only hold one value at a time but that value can change.

10 Creating a Variable App Inventor 1. Navigate to the Blocks View 2. Select the Variable built in category of blocks 3. Select the initialize global name to block 4. Give it a value (variables can hold, numbers, words, lists, colors, logic blocks) 5. Assign the variable a meaningful name

11 Variables Initialize a variable means to create a new variable and give it a value: Variable has 2 blocks Setter Blocks Used to set a new value stored in a variable Getter Blocks Used to get the value stored in a variable

12 Searching and Sorting Data

13 Searching And Sorting Why? Most of what a computer does is searching and sorting data. Because of this, it is a widely studied part of computer science. Producing many solutions to the problem of sorting and search data. We looked at 2 searches Linear Search Binary Search 2 Sorts Selection Quick

14 Searching Linear Search Linear Search: Checks each element in a sequence until the desired element is found or the list is exhausted, meaning that the desired target is not in the list. Used if the list that is to be searched is not ordered. Generally, this technique is used for small lists, or lists that are not searched often. Key Points: Speed: This search method is on average slower than the Binary Search. Order: This search can be used if the data is sorted or Not. Best Case Scenario: The item is found in the first comparison. Worst Case Scenario: The item is found in the last index of the list or it is not located in the list at all.

15 Linear Search - Example

16 Searching: Binary Search Binary Search: starts by comparing the target (the value that you are looking for) with the value found in the middle index of the list. If the value found in the middle index is greater than that of the target, you can ignore all of the data that is after that middle index. The process is then repeated with the remaining data until we either find the target value or satisfy ourselves that the target is not in the list. Find the new middle, compare, and remove the half where the target is not found.

17 Searching Binary Search Key points: Speed: This search method is on average faster than a Linear Search. Order: This search can only be used if the data is sorted. Best Case Scenario: The item will be found faster than a Linear Search. Worst Case Scenario: The item will be found just as fast as a Linear Search.

18 Binary Search: Example

19 Sorting- Selection Sort 1. Divide the list to be sorted into a sorted portion at the front (initially empty) and an unsorted portion at the end (initially the whole list). 2. Find the smallest element in the unsorted list: 1. Select the first element of the unsorted list as the initial candidate. 2. Compare the candidate to each element of the unsorted list in turn, replacing the candidate with the current element if the current element is smaller. 3. Once the end of the unsorted list is reached, the candidate is the smallest element. 3. Swap the smallest element found in the previous step with the first element in the unsorted list, thus extending the sorted list by one element. 4. Repeat the steps 2 and 3 above until only one element remains in the unsorted list.

20 Selection Sort - Key points Difficulty: Easy. The simplest sorting technique. Data Set Size: Very small. This is a good algorithm to sort a small number of elements because the number of comparisons is low. Speed: Slow... maybe. It is potentially very slow if you are sorting a large set of data of 100,000 phone numbers or example.

21 Sorting - Quick Sort 1. Randomly pick an element, called a pivot, from the list. 2. Reorder the list so that all elements with values less than the pivot are placed before the pivot, while all elements with values greater than the pivot are placed after it (equal values can go either way). 3. After this partitioning, the pivot is in its final position. 4. Repeat the process by sorting the sub-list of lesser elements and the sub-list of greater elements. (Source: Wikipedia.org)

22 Quick Sort Key Points Difficulty: Low to medium. More complex than a Selection Sort but still quite simple to understand. Data Set Size: Large. This is a good algorithm to sort a large number of elements because the number of comparisons is small in comparison to the number of items in the list. Speed: Faster... maybe. It is potentially very fast if you are sorting a large set of data of 100,000 phone numbers or example. It will never be slower than a selection sort

23 Abstraction

24 Abstraction - Definition In computer science the term abstract means to simplify, generalize or to eliminate irrelevant detail. In computer science, we use the term to mean simplifying or eliminating irrelevant detail so that we can create a model or plan a solution to a problem. An abstraction is a general representation of something -- of some person or place or event or process. Abstractions are formed by including only those details needed to make the abstraction useful to us in some way.

25 Abstraction - Example A map is an example of abstraction because it removes all unnecessary information from the map. It only keeps what is important; general aspects of the geography. It doesn t show every part of the geography. It can t. It can t show every tree and flower. The person who made the map abstracted out the irrelevant information and left the most important information for finding the treasure.

26 Abstraction - Example A variable is an example of abstraction. In a program a variable can hold many different values. The programmer doesn t have to worry about every single value that it holds. They just have to worry if the variable value can be used in an equation. The specific value in the variable number is not important. What is important is the equation. It will always add one to the current value of number.

27 Modulus Division

28 Modulus Division Modulus division returns the remainder after the division of one number by another. Rather than returning the quotient, modulus division returns the remainder. 26 % 5 = 1 (% = Modulus division) The modulus division block is found in the math category

29 Modulus division We used modulus division in the list_picker practice app We used it to know if the length of the list is odd or even. If it is odd then the modulus division will result in a number. If it results in a 0 then the list is even. 4 % 2 = 0 (even) 5 % 2 = 1 (odd)

For example, we have seen that a list may be searched more efficiently if it is sorted.

For example, we have seen that a list may be searched more efficiently if it is sorted. Sorting 1 Many computer applications involve sorting the items in a list into some specified order. For example, we have seen that a list may be searched more efficiently if it is sorted. To sort a group

More information

Sorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)

Sorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2) Sorting revisited How did we use a binary search tree to sort an array of elements? Tree Sort Algorithm Given: An array of elements to sort 1. Build a binary search tree out of the elements 2. Traverse

More information

6. Standard Algorithms

6. Standard Algorithms 6. Standard Algorithms The algorithms we will examine perform Searching and Sorting. 6.1 Searching Algorithms Two algorithms will be studied. These are: 6.1.1. inear Search The inear Search The Binary

More information

Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

More information

Binary Heap Algorithms

Binary Heap Algorithms CS Data Structures and Algorithms Lecture Slides Wednesday, April 5, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn G. Chappell

More information

Quick Sort. Implementation

Quick Sort. Implementation Implementation Next, recall that our goal is to partition all remaining elements based on whether they are smaller than or greater than the pivot We will find two entries: One larger than the pivot (staring

More information

No Solution Equations Let s look at the following equation: 2 +3=2 +7

No Solution Equations Let s look at the following equation: 2 +3=2 +7 5.4 Solving Equations with Infinite or No Solutions So far we have looked at equations where there is exactly one solution. It is possible to have more than solution in other types of equations that are

More information

Math Circle Beginners Group October 18, 2015

Math Circle Beginners Group October 18, 2015 Math Circle Beginners Group October 18, 2015 Warm-up problem 1. Let n be a (positive) integer. Prove that if n 2 is odd, then n is also odd. (Hint: Use a proof by contradiction.) Suppose that n 2 is odd

More information

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent

More information

Heaps & Priority Queues in the C++ STL 2-3 Trees

Heaps & Priority Queues in the C++ STL 2-3 Trees Heaps & Priority Queues in the C++ STL 2-3 Trees CS 3 Data Structures and Algorithms Lecture Slides Friday, April 7, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks

More information

Analysis of Binary Search algorithm and Selection Sort algorithm

Analysis of Binary Search algorithm and Selection Sort algorithm Analysis of Binary Search algorithm and Selection Sort algorithm In this section we shall take up two representative problems in computer science, work out the algorithms based on the best strategy to

More information

Section 1.4 Place Value Systems of Numeration in Other Bases

Section 1.4 Place Value Systems of Numeration in Other Bases Section.4 Place Value Systems of Numeration in Other Bases Other Bases The Hindu-Arabic system that is used in most of the world today is a positional value system with a base of ten. The simplest reason

More information

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92. Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

More information

B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees

B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees B-Trees Algorithms and data structures for external memory as opposed to the main memory B-Trees Previous Lectures Height balanced binary search trees: AVL trees, red-black trees. Multiway search trees:

More information

Data Structures. Topic #12

Data Structures. Topic #12 Data Structures Topic #12 Today s Agenda Sorting Algorithms insertion sort selection sort exchange sort shell sort radix sort As we learn about each sorting algorithm, we will discuss its efficiency Sorting

More information

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team Lecture Summary In this lecture, we learned about the ADT Priority Queue. A

More information

Zeros of a Polynomial Function

Zeros of a Polynomial Function Zeros of a Polynomial Function An important consequence of the Factor Theorem is that finding the zeros of a polynomial is really the same thing as factoring it into linear factors. In this section we

More information

Data Structures and Data Manipulation

Data Structures and Data Manipulation Data Structures and Data Manipulation What the Specification Says: Explain how static data structures may be used to implement dynamic data structures; Describe algorithms for the insertion, retrieval

More information

Base Conversion written by Cathy Saxton

Base Conversion written by Cathy Saxton Base Conversion written by Cathy Saxton 1. Base 10 In base 10, the digits, from right to left, specify the 1 s, 10 s, 100 s, 1000 s, etc. These are powers of 10 (10 x ): 10 0 = 1, 10 1 = 10, 10 2 = 100,

More information

CSC148 Lecture 8. Algorithm Analysis Binary Search Sorting

CSC148 Lecture 8. Algorithm Analysis Binary Search Sorting CSC148 Lecture 8 Algorithm Analysis Binary Search Sorting Algorithm Analysis Recall definition of Big Oh: We say a function f(n) is O(g(n)) if there exists positive constants c,b such that f(n)

More information

Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1.

Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1. Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 1 Quiz 1 Do not open this quiz booklet until you are directed

More information

Module 9. User Interface Design. Version 2 CSE IIT, Kharagpur

Module 9. User Interface Design. Version 2 CSE IIT, Kharagpur Module 9 User Interface Design Lesson 21 Types of User Interfaces Specific Instructional Objectives Classify user interfaces into three main types. What are the different ways in which menu items can be

More information

Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles B-Trees Algorithms and data structures for external memory as opposed to the main memory B-Trees Previous Lectures Height balanced binary search trees: AVL trees, red-black trees. Multiway search trees:

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information

Data Structures Fibonacci Heaps, Amortized Analysis

Data Structures Fibonacci Heaps, Amortized Analysis Chapter 4 Data Structures Fibonacci Heaps, Amortized Analysis Algorithm Theory WS 2012/13 Fabian Kuhn Fibonacci Heaps Lacy merge variant of binomial heaps: Do not merge trees as long as possible Structure:

More information

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015 CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Today Registration should be done. Homework 1 due 11:59 pm next Wednesday, January 14 Review math essential

More information

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion

CHAPTER 5. Number Theory. 1. Integers and Division. Discussion CHAPTER 5 Number Theory 1. Integers and Division 1.1. Divisibility. Definition 1.1.1. Given two integers a and b we say a divides b if there is an integer c such that b = ac. If a divides b, we write a

More information

Test 4 Sample Problem Solutions, 27.58 = 27 47 100, 7 5, 1 6. 5 = 14 10 = 1.4. Moving the decimal two spots to the left gives

Test 4 Sample Problem Solutions, 27.58 = 27 47 100, 7 5, 1 6. 5 = 14 10 = 1.4. Moving the decimal two spots to the left gives Test 4 Sample Problem Solutions Convert from a decimal to a fraction: 0.023, 27.58, 0.777... For the first two we have 0.023 = 23 58, 27.58 = 27 1000 100. For the last, if we set x = 0.777..., then 10x

More information

Outline. Introduction Linear Search. Transpose sequential search Interpolation search Binary search Fibonacci search Other search techniques

Outline. Introduction Linear Search. Transpose sequential search Interpolation search Binary search Fibonacci search Other search techniques Searching (Unit 6) Outline Introduction Linear Search Ordered linear search Unordered linear search Transpose sequential search Interpolation search Binary search Fibonacci search Other search techniques

More information

Battleships Searching Algorithms

Battleships Searching Algorithms Activity 6 Battleships Searching Algorithms Summary Computers are often required to find information in large collections of data. They need to develop quick and efficient ways of doing this. This activity

More information

Chapter 11 Number Theory

Chapter 11 Number Theory Chapter 11 Number Theory Number theory is one of the oldest branches of mathematics. For many years people who studied number theory delighted in its pure nature because there were few practical applications

More information

Chapter 13: Query Processing. Basic Steps in Query Processing

Chapter 13: Query Processing. Basic Steps in Query Processing Chapter 13: Query Processing! Overview! Measures of Query Cost! Selection Operation! Sorting! Join Operation! Other Operations! Evaluation of Expressions 13.1 Basic Steps in Query Processing 1. Parsing

More information

Solutions of Linear Equations in One Variable

Solutions of Linear Equations in One Variable 2. Solutions of Linear Equations in One Variable 2. OBJECTIVES. Identify a linear equation 2. Combine like terms to solve an equation We begin this chapter by considering one of the most important tools

More information

Welcome to Harcourt Mega Math: The Number Games

Welcome to Harcourt Mega Math: The Number Games Welcome to Harcourt Mega Math: The Number Games Harcourt Mega Math In The Number Games, students take on a math challenge in a lively insect stadium. Introduced by our host Penny and a number of sporting

More information

Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter 4 described a mathematical system

Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter 4 described a mathematical system CHAPTER Number Theory FIGURE FIGURE FIGURE Plus hours Plus hours Plus hours + = + = + = FIGURE. Clock Arithmetic and Modular Systems Clock Arithmetic The introduction to Chapter described a mathematical

More information

CHAPTER 19 Programming Lists of Data

CHAPTER 19 Programming Lists of Data CHAPTER 19 Programming Lists of Data As you ve already seen, apps handle events and make decisions; such processing is fundamental to computing. But, the other fundamental part of an app is its data the

More information

Graphing Rational Functions

Graphing Rational Functions Graphing Rational Functions A rational function is defined here as a function that is equal to a ratio of two polynomials p(x)/q(x) such that the degree of q(x) is at least 1. Examples: is a rational function

More information

Node-Based Structures Linked Lists: Implementation

Node-Based Structures Linked Lists: Implementation Linked Lists: Implementation CS 311 Data Structures and Algorithms Lecture Slides Monday, March 30, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org

More information

RSA Question 2. Bob thinks that p and q are primes but p isn t. Then, Bob thinks Φ Bob :=(p-1)(q-1) = φ(n). Is this true?

RSA Question 2. Bob thinks that p and q are primes but p isn t. Then, Bob thinks Φ Bob :=(p-1)(q-1) = φ(n). Is this true? RSA Question 2 Bob thinks that p and q are primes but p isn t. Then, Bob thinks Φ Bob :=(p-1)(q-1) = φ(n). Is this true? Bob chooses a random e (1 < e < Φ Bob ) such that gcd(e,φ Bob )=1. Then, d = e -1

More information

Zabin Visram Room CS115 CS126 Searching. Binary Search

Zabin Visram Room CS115 CS126 Searching. Binary Search Zabin Visram Room CS115 CS126 Searching Binary Search Binary Search Sequential search is not efficient for large lists as it searches half the list, on average Another search algorithm Binary search Very

More information

Multiplying Fractions

Multiplying Fractions . Multiplying Fractions. OBJECTIVES 1. Multiply two fractions. Multiply two mixed numbers. Simplify before multiplying fractions 4. Estimate products by rounding Multiplication is the easiest of the four

More information

s = 1 + 2 +... + 49 + 50 s = 50 + 49 +... + 2 + 1 2s = 51 + 51 +... + 51 + 51 50 51. 2

s = 1 + 2 +... + 49 + 50 s = 50 + 49 +... + 2 + 1 2s = 51 + 51 +... + 51 + 51 50 51. 2 1. Use Euler s trick to find the sum 1 + 2 + 3 + 4 + + 49 + 50. s = 1 + 2 +... + 49 + 50 s = 50 + 49 +... + 2 + 1 2s = 51 + 51 +... + 51 + 51 Thus, 2s = 50 51. Therefore, s = 50 51. 2 2. Consider the sequence

More information

KS3 Computing Group 1 Programme of Study 2015 2016 2 hours per week

KS3 Computing Group 1 Programme of Study 2015 2016 2 hours per week 1 07/09/15 2 14/09/15 3 21/09/15 4 28/09/15 Communication and Networks esafety Obtains content from the World Wide Web using a web browser. Understands the importance of communicating safely and respectfully

More information

Record Storage and Primary File Organization

Record Storage and Primary File Organization Record Storage and Primary File Organization 1 C H A P T E R 4 Contents Introduction Secondary Storage Devices Buffering of Blocks Placing File Records on Disk Operations on Files Files of Unordered Records

More information

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes. 1. The advantage of.. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. [A] Lists [B] Linked Lists [A] Trees [A] Queues 2. The

More information

Grade 7 & 8 Math Circles October 19, 2011 Prime Numbers

Grade 7 & 8 Math Circles October 19, 2011 Prime Numbers 1 University of Waterloo Faculty of Mathematics Centre for Education in Mathematics and Computing Grade 7 & 8 Math Circles October 19, 2011 Prime Numbers Factors Definition: A factor of a number is a whole

More information

CHAPTER 18 Programming Your App to Make Decisions: Conditional Blocks

CHAPTER 18 Programming Your App to Make Decisions: Conditional Blocks CHAPTER 18 Programming Your App to Make Decisions: Conditional Blocks Figure 18-1. Computers, even small ones like the phone in your pocket, are good at performing millions of operations in a single second.

More information

Solutions to Math 51 First Exam January 29, 2015

Solutions to Math 51 First Exam January 29, 2015 Solutions to Math 5 First Exam January 29, 25. ( points) (a) Complete the following sentence: A set of vectors {v,..., v k } is defined to be linearly dependent if (2 points) there exist c,... c k R, not

More information

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 10

Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 10 CS 70 Discrete Mathematics and Probability Theory Fall 2009 Satish Rao, David Tse Note 10 Introduction to Discrete Probability Probability theory has its origins in gambling analyzing card games, dice,

More information

Symbol Tables. Introduction

Symbol Tables. Introduction Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The

More information

Chapter 7 - Roots, Radicals, and Complex Numbers

Chapter 7 - Roots, Radicals, and Complex Numbers Math 233 - Spring 2009 Chapter 7 - Roots, Radicals, and Complex Numbers 7.1 Roots and Radicals 7.1.1 Notation and Terminology In the expression x the is called the radical sign. The expression under the

More information

Partitioning and Divide and Conquer Strategies

Partitioning and Divide and Conquer Strategies and Divide and Conquer Strategies Lecture 4 and Strategies Strategies Data partitioning aka domain decomposition Functional decomposition Lecture 4 and Strategies Quiz 4.1 For nuclear reactor simulation,

More information

6 March 2007 1. Array Implementation of Binary Trees

6 March 2007 1. Array Implementation of Binary Trees Heaps CSE 0 Winter 00 March 00 1 Array Implementation of Binary Trees Each node v is stored at index i defined as follows: If v is the root, i = 1 The left child of v is in position i The right child of

More information

Algorithms. Margaret M. Fleck. 18 October 2010

Algorithms. Margaret M. Fleck. 18 October 2010 Algorithms Margaret M. Fleck 18 October 2010 These notes cover how to analyze the running time of algorithms (sections 3.1, 3.3, 4.4, and 7.1 of Rosen). 1 Introduction The main reason for studying big-o

More information

CSC 180 H1F Algorithm Runtime Analysis Lecture Notes Fall 2015

CSC 180 H1F Algorithm Runtime Analysis Lecture Notes Fall 2015 1 Introduction These notes introduce basic runtime analysis of algorithms. We would like to be able to tell if a given algorithm is time-efficient, and to be able to compare different algorithms. 2 Linear

More information

Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design

Chapter 6: Physical Database Design and Performance. Database Development Process. Physical Design Process. Physical Database Design Chapter 6: Physical Database Design and Performance Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden Robert C. Nickerson ISYS 464 Spring 2003 Topic 23 Database

More information

Outline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb

Outline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb Binary Search Trees Lecturer: Georgy Gimel farb COMPSCI 220 Algorithms and Data Structures 1 / 27 1 Properties of Binary Search Trees 2 Basic BST operations The worst-case time complexity of BST operations

More information

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

More information

Physical Data Organization

Physical Data Organization Physical Data Organization Database design using logical model of the database - appropriate level for users to focus on - user independence from implementation details Performance - other major factor

More information

Partial Fractions Decomposition

Partial Fractions Decomposition Partial Fractions Decomposition Dr. Philippe B. Laval Kennesaw State University August 6, 008 Abstract This handout describes partial fractions decomposition and how it can be used when integrating rational

More information

An Introduction to Number Theory Prime Numbers and Their Applications.

An Introduction to Number Theory Prime Numbers and Their Applications. East Tennessee State University Digital Commons @ East Tennessee State University Electronic Theses and Dissertations 8-2006 An Introduction to Number Theory Prime Numbers and Their Applications. Crystal

More information

Simplifying Algebraic Fractions

Simplifying Algebraic Fractions 5. Simplifying Algebraic Fractions 5. OBJECTIVES. Find the GCF for two monomials and simplify a fraction 2. Find the GCF for two polynomials and simplify a fraction Much of our work with algebraic fractions

More information

MEP Y9 Practice Book A

MEP Y9 Practice Book A 1 Base Arithmetic 1.1 Binary Numbers We normally work with numbers in base 10. In this section we consider numbers in base 2, often called binary numbers. In base 10 we use the digits 0, 1, 2, 3, 4, 5,

More information

recursion, O(n), linked lists 6/14

recursion, O(n), linked lists 6/14 recursion, O(n), linked lists 6/14 recursion reducing the amount of data to process and processing a smaller amount of data example: process one item in a list, recursively process the rest of the list

More information

Fundamentals of Probability

Fundamentals of Probability Fundamentals of Probability Introduction Probability is the likelihood that an event will occur under a set of given conditions. The probability of an event occurring has a value between 0 and 1. An impossible

More information

Row Echelon Form and Reduced Row Echelon Form

Row Echelon Form and Reduced Row Echelon Form These notes closely follow the presentation of the material given in David C Lay s textbook Linear Algebra and its Applications (3rd edition) These notes are intended primarily for in-class presentation

More information

International Journal of Advanced Research in Computer Science and Software Engineering

International Journal of Advanced Research in Computer Science and Software Engineering Volume 3, Issue 7, July 23 ISSN: 2277 28X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Greedy Algorithm:

More information

Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract

Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 7, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic skills.

More information

Programming Your App to Make Decisions: Conditional Blocks

Programming Your App to Make Decisions: Conditional Blocks Chapter 18 Programming Your App to Make Decisions: Conditional Blocks Computers, even small ones like the phone in your pocket, are good at performing thousands of operations in just a few seconds. Even

More information

Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child Binary Search Trees Data in each node Larger than the data in its left child Smaller than the data in its right child FIGURE 11-6 Arbitrary binary tree FIGURE 11-7 Binary search tree Data Structures Using

More information

MATH-0910 Review Concepts (Haugen)

MATH-0910 Review Concepts (Haugen) Unit 1 Whole Numbers and Fractions MATH-0910 Review Concepts (Haugen) Exam 1 Sections 1.5, 1.6, 1.7, 1.8, 2.1, 2.2, 2.3, 2.4, and 2.5 Dividing Whole Numbers Equivalent ways of expressing division: a b,

More information

Chapter Objectives. Chapter 9. Sequential Search. Search Algorithms. Search Algorithms. Binary Search

Chapter Objectives. Chapter 9. Sequential Search. Search Algorithms. Search Algorithms. Binary Search Chapter Objectives Chapter 9 Search Algorithms Data Structures Using C++ 1 Learn the various search algorithms Explore how to implement the sequential and binary search algorithms Discover how the sequential

More information

Data Structures. Chapter 8

Data Structures. Chapter 8 Chapter 8 Data Structures Computer has to process lots and lots of data. To systematically process those data efficiently, those data are organized as a whole, appropriate for the application, called a

More information

7.S.8 Interpret data to provide the basis for predictions and to establish

7.S.8 Interpret data to provide the basis for predictions and to establish 7 th Grade Probability Unit 7.S.8 Interpret data to provide the basis for predictions and to establish experimental probabilities. 7.S.10 Predict the outcome of experiment 7.S.11 Design and conduct an

More information

Historical Slideshow App A Coding Solution (This is a spoiler document)

Historical Slideshow App A Coding Solution (This is a spoiler document) Historical Slideshow App A Coding Solution (This is a spoiler document) Note: there are many ways to code this solution. This is just the solution I picked Use the table below to get you started with this

More information

Computer Science 210: Data Structures. Searching

Computer Science 210: Data Structures. Searching Computer Science 210: Data Structures Searching Searching Given a sequence of elements, and a target element, find whether the target occurs in the sequence Variations: find first occurence; find all occurences

More information

Programming Lists of Data

Programming Lists of Data Chapter 19 Programming Lists of Data As you ve already seen, apps handle events and make decisions; such processing is fundamental to computing. But the other fundamental part of an app is its data the

More information

- Easy to insert & delete in O(1) time - Don t need to estimate total memory needed. - Hard to search in less than O(n) time

- Easy to insert & delete in O(1) time - Don t need to estimate total memory needed. - Hard to search in less than O(n) time Skip Lists CMSC 420 Linked Lists Benefits & Drawbacks Benefits: - Easy to insert & delete in O(1) time - Don t need to estimate total memory needed Drawbacks: - Hard to search in less than O(n) time (binary

More information

Encoding Text with a Small Alphabet

Encoding Text with a Small Alphabet Chapter 2 Encoding Text with a Small Alphabet Given the nature of the Internet, we can break the process of understanding how information is transmitted into two components. First, we have to figure out

More information

Lecture 5: Gate Logic Logic Optimization

Lecture 5: Gate Logic Logic Optimization Lecture 5: Gate Logic Logic Optimization MAH, AEN EE271 Lecture 5 1 Overview Reading McCluskey, Logic Design Principles- or any text in boolean algebra Introduction We could design at the level of irsim

More information

Useful Number Systems

Useful Number Systems Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

More information

Section IV.1: Recursive Algorithms and Recursion Trees

Section IV.1: Recursive Algorithms and Recursion Trees Section IV.1: Recursive Algorithms and Recursion Trees Definition IV.1.1: A recursive algorithm is an algorithm that solves a problem by (1) reducing it to an instance of the same problem with smaller

More information

1 Present and Future Value

1 Present and Future Value Lecture 8: Asset Markets c 2009 Je rey A. Miron Outline:. Present and Future Value 2. Bonds 3. Taxes 4. Applications Present and Future Value In the discussion of the two-period model with borrowing and

More information

2) Based on the information in the table which choice BEST shows the answer to 1 906? 906 899 904 909

2) Based on the information in the table which choice BEST shows the answer to 1 906? 906 899 904 909 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ) Multiplying a number by results in what type of. even. 0. even.,0. odd..,0. even ) Based on the information in the table which choice BEST shows the answer to 0? 0 0 0 )

More information

SOLVING QUADRATIC EQUATIONS - COMPARE THE FACTORING ac METHOD AND THE NEW DIAGONAL SUM METHOD By Nghi H. Nguyen

SOLVING QUADRATIC EQUATIONS - COMPARE THE FACTORING ac METHOD AND THE NEW DIAGONAL SUM METHOD By Nghi H. Nguyen SOLVING QUADRATIC EQUATIONS - COMPARE THE FACTORING ac METHOD AND THE NEW DIAGONAL SUM METHOD By Nghi H. Nguyen A. GENERALITIES. When a given quadratic equation can be factored, there are 2 best methods

More information

NUMBER SYSTEMS. William Stallings

NUMBER SYSTEMS. William Stallings NUMBER SYSTEMS William Stallings The Decimal System... The Binary System...3 Converting between Binary and Decimal...3 Integers...4 Fractions...5 Hexadecimal Notation...6 This document available at WilliamStallings.com/StudentSupport.html

More information

/ Department of Mechanical Engineering. Manufacturing Networks. Warehouse storage: cases or layers? J.J.P. van Heur. Where innovation starts

/ Department of Mechanical Engineering. Manufacturing Networks. Warehouse storage: cases or layers? J.J.P. van Heur. Where innovation starts / Department of Mechanical Engineering Manufacturing Networks Warehouse storage: cases or layers? J.J.P. van Heur Where innovation starts Systems Engineering Group Department of Mechanical Engineering

More information

Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

More information

Multiplying and Dividing Fractions

Multiplying and Dividing Fractions Multiplying and Dividing Fractions 1 Overview Fractions and Mixed Numbers Factors and Prime Factorization Simplest Form of a Fraction Multiplying Fractions and Mixed Numbers Dividing Fractions and Mixed

More information

THE NUMBER OF REPRESENTATIONS OF n OF THE FORM n = x 2 2 y, x > 0, y 0

THE NUMBER OF REPRESENTATIONS OF n OF THE FORM n = x 2 2 y, x > 0, y 0 THE NUMBER OF REPRESENTATIONS OF n OF THE FORM n = x 2 2 y, x > 0, y 0 RICHARD J. MATHAR Abstract. We count solutions to the Ramanujan-Nagell equation 2 y +n = x 2 for fixed positive n. The computational

More information

Chapter 7 Memory Management

Chapter 7 Memory Management Operating Systems: Internals and Design Principles, 6/E William Stallings Chapter 7 Memory Management Patricia Roy Manatee Community College, Venice, FL 2008, Prentice Hall Memory Management Subdividing

More information

Persistent Binary Search Trees

Persistent Binary Search Trees Persistent Binary Search Trees Datastructures, UvA. May 30, 2008 0440949, Andreas van Cranenburgh Abstract A persistent binary tree allows access to all previous versions of the tree. This paper presents

More information

Data Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets

Data Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets Data Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets We ve been talking a lot about efficiency in computing and run time. But thus far mostly ignoring data

More information

ZIMBABWE SCHOOL EXAMINATIONS COUNCIL. COMPUTER STUDIES 7014/01 PAPER 1 Multiple Choice SPECIMEN PAPER

ZIMBABWE SCHOOL EXAMINATIONS COUNCIL. COMPUTER STUDIES 7014/01 PAPER 1 Multiple Choice SPECIMEN PAPER ZIMBABWE SCHOOL EXAMINATIONS COUNCIL General Certificate of Education Ordinary Level COMPUTER STUDIES 7014/01 PAPER 1 Multiple Choice SPECIMEN PAPER Candidates answer on the question paper Additional materials:

More information

The Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!

The Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)! The Tower of Hanoi Recursion Solution recursion recursion recursion Recursive Thinking: ignore everything but the bottom disk. 1 2 Recursive Function Time Complexity Hanoi (n, src, dest, temp): If (n >

More information

361 Computer Architecture Lecture 14: Cache Memory

361 Computer Architecture Lecture 14: Cache Memory 1 361 Computer Architecture Lecture 14 Memory cache.1 The Motivation for s Memory System Processor DRAM Motivation Large memories (DRAM) are slow Small memories (SRAM) are fast Make the average access

More information

IB Maths SL Sequence and Series Practice Problems Mr. W Name

IB Maths SL Sequence and Series Practice Problems Mr. W Name IB Maths SL Sequence and Series Practice Problems Mr. W Name Remember to show all necessary reasoning! Separate paper is probably best. 3b 3d is optional! 1. In an arithmetic sequence, u 1 = and u 3 =

More information

Greatest Common Factor and Least Common Multiple

Greatest Common Factor and Least Common Multiple Greatest Common Factor and Least Common Multiple Intro In order to understand the concepts of Greatest Common Factor (GCF) and Least Common Multiple (LCM), we need to define two key terms: Multiple: Multiples

More information

Chapter 8: Bags and Sets

Chapter 8: Bags and Sets Chapter 8: Bags and Sets In the stack and the queue abstractions, the order that elements are placed into the container is important, because the order elements are removed is related to the order in which

More information

Hash Tables. Computer Science E-119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Data Dictionary Revisited

Hash Tables. Computer Science E-119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Data Dictionary Revisited Hash Tables Computer Science E-119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Data Dictionary Revisited We ve considered several data structures that allow us to store and search for data

More information