8.3 Relative Rates of Growth. The function grows very fast. We could graph it on the chalkboard: If x is 3 inches, y is about 20 inches: We have gone.

Slides:



Advertisements
Similar presentations
College of Information Technology & Design
Advertisements

Searching for Data Relationship between searching and sorting Simple linear searching Linear searching of sorted data Searching for string or numeric data.
8.3 Relative Rates of Growth. The function grows very fast. We could graph it on the chalkboard: If x is 3 inches, y is about 20 inches: We have gone.
Relative Rates of Growth Section 8.2. The exponential function grows so rapidly and the natural logarithm function grows so slowly that they set standards.
Advanced Topics in Algorithms and Data Structures Page 1 Parallel merging through partitioning The partitioning strategy consists of: Breaking up the given.
Search and Recursion CS221 – 2/23/09. List Search Algorithms Linear Search: Simple search through unsorted data. Time complexity = O(n) Binary Search:
CS 206 Introduction to Computer Science II 09 / 10 / 2008 Instructor: Michael Eckmann.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 11: Sorting and Searching  Searching Linear Binary  Sorting.
CIS 101: Computer Programming and Problem Solving Lecture 6 Usman Roshan Department of Computer Science NJIT.
Recursion.
Objectives Learn how to implement the sequential search algorithm Explore how to sort an array using the selection sort algorithm Learn how to implement.
CS 106 Introduction to Computer Science I 03 / 07 / 2008 Instructor: Michael Eckmann.
Efficiency of Algorithms Csci 107 Lecture 8. Last time –Data cleanup algorithms and analysis –  (1),  (n),  (n 2 ) Today –Binary search and analysis.
Algorithm Efficiency and Sorting
 Last lesson  Arrays for implementing collection classes  Performance analysis (review)  Today  Performance analysis  Logarithm.
Searching Arrays Linear search Binary search small arrays
Analysis of Algorithm.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Prentice Hall Slide 8- 1.
© 2006 Pearson Addison-Wesley. All rights reserved10 A-1 Chapter 10 Algorithm Efficiency and Sorting.
CS 106 Introduction to Computer Science I 10 / 16 / 2006 Instructor: Michael Eckmann.
Search Lesson CS1313 Spring Search Lesson Outline 1.Searching Lesson Outline 2.How to Find a Value in an Array? 3.Linear Search 4.Linear Search.
Time Complexity Dr. Jicheng Fu Department of Computer Science University of Central Oklahoma.
1 Growth of Functions CS 202 Epp, section ??? Aaron Bloomfield.
(C) 2010 Pearson Education, Inc. All rights reserved. Java How to Program, 8/e.
DISCRETE MATHEMATICS I CHAPTER 11 Dr. Adam Anthony Spring 2011 Some material adapted from lecture notes provided by Dr. Chungsim Han and Dr. Sam Lomonaco.
Sorting HKOI Training Team (Advanced)
Announcements Topics: -finish section 4.2; work on sections 4.3, 4.4, and 4.5 * Read these sections and study solved examples in your textbook! Work On:
Guillaume De l'Hôpital Actually, L’Hôpital’s Rule was developed by his teacher Johann Bernoulli. De L’Hôpital paid Bernoulli for private lessons,
Searching. RHS – SOC 2 Searching A magic trick: –Let a person secretly choose a random number between 1 and 1000 –Announce that you can guess the number.
SEARCHING. Vocabulary List A collection of heterogeneous data (values can be different types) Dynamic in size Array A collection of homogenous data (values.
Searching. Linear (Sequential) Search Search an array or list by checking items one at a time. Linear search is usually very simple to implement, and.
SEARCHING.  This is a technique for searching a particular element in sequential manner until the desired element is found.  If an element is found.
Algorithms and their Applications CS2004 ( ) Dr Stephen Swift 4.1 Time Complexity and Asymptotic Notation.
MCA-2012Data Structure1 Algorithms Rizwan Rehman CCS, DU.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2008 Algorithm analysis, searching and sorting  best vs. average vs. worst case analysis  big-Oh.
Chapter 8 Search and Sort ©Rick Mercer. Outline Understand how binary search finds elements more quickly than sequential search Sort array elements Implement.
Review 1 Arrays & Strings Array Array Elements Accessing array elements Declaring an array Initializing an array Two-dimensional Array Array of Structure.
Searching & Sorting Programming 2. Searching Searching is the process of determining if a target item is present in a list of items, and locating it A.
3.3 Complexity of Algorithms
Lecture on Binary Search and Sorting. Another Algorithm Example SEARCHING: a common problem in computer science involves storing and maintaining large.
Big Oh Notation Greek letter Omicron (Ο) is used to denote the limit of asymptotic growth of an algorithm If algorithm processing time grows linearly with.
Algorithmic Analysis Charl du Plessis and Robert Ketteringham.
Sorting and Searching. Selection Sort  “Search-and-Swap” algorithm 1) Find the smallest element in the array and exchange it with a[0], the first element.
Sorting & Searching Review. Selection Sort 1. Find the smallest element 2. Move to the front of the array (swap with front) 3. Repeat Steps 1&2, but ignoring.
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. Selection Sort Sorts an array by repeatedly finding the smallest.
UNIT 5.  The related activities of sorting, searching and merging are central to many computer applications.  Sorting and merging provide us with a.
Sorting and Searching by Dr P.Padmanabham Professor (CSE)&Director
ALGORITHMS.
Asymptotic Behavior Algorithm : Design & Analysis [2]
CS 106 Introduction to Computer Science I 03 / 02 / 2007 Instructor: Michael Eckmann.
Chapter 9 Sorting. The efficiency of data handling can often be increased if the data are sorted according to some criteria of order. The first step is.
Course Code #IDCGRF001-A 5.1: Searching and sorting concepts Programming Techniques.
Chapter 8 Searching and Sorting © 2006 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.
1. Searching The basic characteristics of any searching algorithm is that searching should be efficient, it should have less number of computations involved.
SECTION 2 BINARY OPERATIONS Definition: A binary operation  on a set S is a function mapping S X S into S. For each (a, b)  S X S, we will denote the.
Data Structures Arrays and Lists Part 2 More List Operations.
Copyright © 2014 Curt Hill Algorithms From the Mathematical Perspective.
Sorting & Searching Geletaw S (MSC, MCITP). Objectives At the end of this session the students should be able to: – Design and implement the following.
Algorithm Analysis with Big Oh ©Rick Mercer. Two Searching Algorithms  Objectives  Analyze the efficiency of algorithms  Analyze two classic algorithms.
Ch03-Algorithms 1. Algorithms What is an algorithm? An algorithm is a finite set of precise instructions for performing a computation or for solving a.
Solving separable differential equations HW: Practice WS (last two pages of slide show)
LECTURE 2 : fundamentals of analysis of algorithm efficiency Introduction to design and analysis algorithm 1.
Relative Rates of Growth
Binary Search Example with Labeled Indices
Chapter 8 Search and Sort
Searching: linear & binary
Divide and Conquer Algorithms Part I
Relative Rates of Growth
8.2 Relative Rates of Growth
Relative Rates of Growth
Presentation transcript:

8.3 Relative Rates of Growth

The function grows very fast. We could graph it on the chalkboard: If x is 3 inches, y is about 20 inches: We have gone less than half-way across the board horizontally, and already the y-value would reach the Andromeda Galaxy! At 64 inches, the y-value would be at the edge of the known universe! (13 billion light-years)

The function grows very slowly. If we graph it on the chalkboard it looks like this: We would have to move 2.6 miles to the right before the line moves a foot above the x-axis! 64 inches By the time we reach the edge of the universe again (13 billion light-years) the chalk line will only have reached 64 inches! The function increases everywhere, even though it increases extremely slowly.

Definitions: Faster, Slower, Same-rate Growth as Let f ( x ) and g ( x ) be positive for x sufficiently large. 1. f grows faster than g (and g grows slower than f ) as if or 2. f and g grow at the same rate as if

WARNING Please temporarily suspend your common sense.

According to this definition, does not grow faster than. Since this is a finite non-zero limit, the functions grow at the same rate! The book says that “ f grows faster than g ” means that for large x values, g is negligible compared to f. “Grows faster” is not the same as “has a steeper slope”!

Which grows faster, or ? This is indeterminate, so we apply L’Hôpital’s rule. Still indeterminate. grows faster than. We can confirm this graphically:

“Growing at the same rate” is transitive. In other words, if two functions grow at the same rate as a third function, then the first two functions grow at the same rate.

Example 4: Show that and grow at the same rate as. f and g grow at the same rate.

Order and Oh-Notation Definition f of Smaller Order than g Let f and g be positive for x sufficiently large. Then f is of smaller order than g as if We write and say “ f is little-oh of g.” Saying is another way to say that f grows slower than g.

Order and Oh-Notation Saying is another way to say that f grows no faster than g. Definition f of at Most the Order of g Let f and g be positive for x sufficiently large. Then f is of at most the order of g as if there is a positive integer M for which We write and say “ f is big-oh of g.” for x sufficiently large 

Binary Search: When searching a sorted list, the idea is to look at the element in the middle. If the key is equal to that, the search is finished. If the key is less than the middle element, do a binary search on the first half. If it's greater, do a binary search of the second half. Sequential Search: is a method for finding a particular value in a list, that consists of checking every one of its elements, one at a time and in sequence, until the desired one is found.

Webster’s dictionary contains ≈ 26,000 words that begin with the letter “a”. Using the binary search method what would be the maximum number of searches to find a match for a word beginning with the letter “a”? Using the sequential search method, what would be the maximum number of searches to find a match for a word beginning with the letter “a”? 26,000