Scalability for Search Scaling means how a system must grow if resources or work grows –Scalability is the ability of a system, network, or process, to.

Slides:



Advertisements
Similar presentations
Growth-rate Functions
Advertisements

Intro to Analysis of Algorithms. Algorithm “A sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any.
Razdan with contribution from others 1 Algorithm Analysis What is the Big ‘O Bout? Anshuman Razdan Div of Computing.
Asymptotic Notation (O, Ω,  ) s Describes the behavior of the time or space complexity for large instance characteristics s Common asymptotic functions.
Analysys & Complexity of Algorithms Big Oh Notation.
Algorithmic Complexity Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Chapter 3 Growth of Functions
Analysis of Algorithms intro.  What is “goodness”?  How to measure efficiency? ◦ Profiling, Big-Oh  Big-Oh: ◦ Motivation ◦ Informal examples ◦ Informal.
Not all algorithms are created equally Insertion of words from a dictionary into a sorted list takes a very long time. Insertion of the same words into.
Analysis of Algorithms1 Estimate the running time Estimate the memory space required. Time and space depend on the input size.
20-Jun-15 Analysis of Algorithms II. 2 Basics Before we attempt to analyze an algorithm, we need to define two things: How we measure the size of the.
Cmpt-225 Algorithm Efficiency.
Analysis of Algorithms (pt 2) (Chapter 4) COMP53 Oct 3, 2007.
Lecture 3 Aug 31, 2011 Goals: Chapter 2 (algorithm analysis) Examples: Selection sorting rules for algorithm analysis discussion of lab – permutation generation.
Elementary Data Structures and Algorithms
Lecture 3 Feb 7, 2011 Goals: Chapter 2 (algorithm analysis) Examples: Selection sorting rules for algorithm analysis Image representation Image processing.
David Luebke 1 8/17/2015 CS 332: Algorithms Asymptotic Performance.
Algorithm Analysis (Big O)
CSE 5311 DESIGN AND ANALYSIS OF ALGORITHMS. Definitions of Algorithm A mathematical relation between an observed quantity and a variable used in a step-by-step.
Algorithm Cost Algorithm Complexity. Algorithm Cost.
Program Performance & Asymptotic Notations CSE, POSTECH.
CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a lgorithms.
Week 2 CS 361: Advanced Data Structures and Algorithms
SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY Lecture 12 CS2110 – Fall 2009.
Algorithm Efficiency CS 110: Data Structures and Algorithms First Semester,
Mathematics Review and Asymptotic Notation
CSC 201 Analysis and Design of Algorithms Lecture 04: CSC 201 Analysis and Design of Algorithms Lecture 04: Time complexity analysis in form of Big-Oh.
1 Computer Algorithms Lecture 3 Asymptotic Notation Some of these slides are courtesy of D. Plaisted, UNC and M. Nicolescu, UNR.
Analysis of Algorithms
CS 221 Analysis of Algorithms Instructor: Don McLaughlin.
Analysis of Algorithms These slides are a modified version of the slides used by Prof. Eltabakh in his offering of CS2223 in D term 2013.
Asymptotic Analysis-Ch. 3
 DATA STRUCTURE DATA STRUCTURE  DATA STRUCTURE OPERATIONS DATA STRUCTURE OPERATIONS  BIG-O NOTATION BIG-O NOTATION  TYPES OF DATA STRUCTURE TYPES.
Computation, Complexity, and Algorithm IST 501 Fall 2014 Dongwon Lee, Ph.D.
Algorithm Analysis (Algorithm Complexity). Correctness is Not Enough It isn’t sufficient that our algorithms perform the required tasks. We want them.
Asymptotic Notation (O, Ω, )
Program Efficiency & Complexity Analysis. Algorithm Review An algorithm is a definite procedure for solving a problem in finite number of steps Algorithm.
Algorithm Analysis CS 400/600 – Data Structures. Algorithm Analysis2 Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely.
Chapter 5 Algorithms (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Algorithmic Analysis Charl du Plessis and Robert Ketteringham.
Big-O. Algorithm Analysis Exact analysis: produce a function f(n) measuring how many basic steps are needed for a given inputs n On any input of size.
Computation, Complexity, and Algorithm IST 512 Spring 2012 Dongwon Lee, Ph.D.
Asymptotic Notations By Er. Devdutt Baresary. Introduction In mathematics, computer science, and related fields, big O notation describes the limiting.
David Luebke 1 1/6/2016 CS 332: Algorithms Asymptotic Performance.
1/6/20161 CS 3343: Analysis of Algorithms Lecture 2: Asymptotic Notations.
Asymptotic Performance. Review: Asymptotic Performance Asymptotic performance: How does algorithm behave as the problem size gets very large? Running.
Algorithm Analysis (Big O)
DS.A.1 Algorithm Analysis Chapter 2 Overview Definitions of Big-Oh and Other Notations Common Functions and Growth Rates Simple Model of Computation Worst.
21-Feb-16 Analysis of Algorithms II. 2 Basics Before we attempt to analyze an algorithm, we need to define two things: How we measure the size of the.
Big O David Kauchak cs302 Spring Administrative Assignment 1: how’d it go? Assignment 2: out soon… Lab code.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Announcement We will have a 10 minutes Quiz on Feb. 4 at the end of the lecture. The quiz is about Big O notation. The weight of this quiz is 3% (please.
Complexity of Algorithms Fundamental Data Structures and Algorithms Ananda Guna January 13, 2005.
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.
GC 211:Data Structures Week 2: Algorithm Analysis Tools Slides are borrowed from Mr. Mohammad Alqahtani.
Algorithmic Foundations COMP108 COMP108 Algorithmic Foundations Algorithm efficiency Prudence Wong.
Algorithmic Foundations COMP108 COMP108 Algorithmic Foundations Algorithm efficiency Prudence Wong
Data Structures I (CPCS-204) Week # 2: Algorithm Analysis tools Dr. Omar Batarfi Dr. Yahya Dahab Dr. Imtiaz Khan.
GC 211:Data Structures Week 2: Algorithm Analysis Tools
Last time More and more information born digital
Scalability for Search
Asymptotic Notations Algorithms perform f(n) basic operations to accomplish task Identify that function Identify size of problem (n) Count number of operations.
GC 211:Data Structures Algorithm Analysis Tools
What is an Algorithm? Algorithm Specification.
Scalability for Search and Big O
Asymptotic Notations Algorithms perform f(n) basic operations to accomplish task Identify that function Identify size of problem (n) Count number of operations.
Analysys & Complexity of Algorithms
Scalability for Search and Big O
Asymptotic Notations Algorithms perform f(n) basic operations to accomplish task Identify that function Identify size of problem (n) Count number of operations.
Performance Evaluation
Presentation transcript:

Scalability for Search Scaling means how a system must grow if resources or work grows –Scalability is the ability of a system, network, or process, to handle growing amounts of work in a graceful manner or its ability to be enlarged to accommodate that growth (wikipedia) Search usually must scale in two ways: Number of things searched – N Number of searchers - M

Scenarios I’ve got two algorithms that accomplish the same task –Which is better? I want to store some data –How do my storage needs scale as more data is stored Given an algorithm, can I determine how long it will take to run? –Input is unknown –Don’t want to trace all possible paths of execution For different input, can I determine how an algorithm’s runtime changes?

Measuring the Growth of Work or Hardness of a Problem While it is possible to measure the work done by an algorithm for a given set of input, we need a way to: Measure the rate of growth of an algorithm based upon the size of the input (or output) Compare algorithms to determine which is better for the situation Compare and analyze for large problems –Examples of large problems?

Time vs. Space Very often, we can trade space for time: For example: maintain a collection of students’ with ID information. –Use an array of a billion elements and have immediate access (better time) –Use an array of number of students and have to search (better space)

Introducing Big O Notation Will allow us to evaluate algorithms and understand scaling. Has precise mathematical definition Used in a sense to put algorithms into families Worst case scenario –What does this mean? –Other types of cases?

Why Use Big-O Notation Used when we only know the asymptotic upper bound. –What does asymptotic mean? –What does upper bound mean? If you are not guaranteed certain input, then it is a valid upper bound that even the worst-case input will be below. Why worst-case? May often be determined by inspection of an algorithm.

Size of Input (measure of work) In analyzing rate of growth based upon size of input, we’ll use a variable Why? –For each factor in the size, use a new variable –n is most common… Examples: –A linked list of n elements –A 2D array of n x m elements –A Binary Search Tree of p elements

Formal Definition of Big-O For a given function g(n), O(g(n)) is defined to be the set of functions O(g(n)) = {f(n) : there exist positive constants c and n 0 such that 0  f(n)  cg(n) for all n  n 0 }

Visual O( ) Meaning f(n) cg(n) n0n0 f(n) = O(g(n)) Size of input Work done Our Algorithm Upper Bound

Simplifying O( ) Answers We say Big O complexity of 3n = O(n 2 )  drop constants! because we can show that there is a n 0 and a c such that: 0  3n  cn 2 for n  n 0 i.e. c = 4 and n 0 = 2 yields: 0  3n  4n 2 for n  2 What does this mean?

Simplifying O( ) Answers We say Big O complexity of 3n 2 + 2n = O(n 2 ) + O(n) = O(n 2 )  drop smaller!

Correct but Meaningless You could say 3n = O(n 6 ) or 3n = O(n 7 ) But this is like answering: What’s the world record for the mile? –Less than 3 days. How long does it take to drive to Chicago? –Less than 11 years.

Measuring the Growth of Work As input size N increases, how well does our automated system work? –Depends on what you want to do! Use algorithmic complexity theory: –Use measure big o: O(N) which means worst case Important for –Search engines –Databases –Social networks –Crime/terrorism Sub-linear O(Log N) Linear O(N) Nearly linear O(N Log N) Quadratic O(N 2 ) Exponential O(2 N ) O(N!) O(N N ) Performance classes Polynomial Usually death to scaling MapReduce may help

Two Categories of Algorithms Size of Input (N) trillion billion million N N5N5 2N2N N Unreasonable Don’t Care! Reasonable Runtime sec Lifetime of the universe years = sec

Reasonable vs. Unreasonable Reasonable algorithms have polynomial factors –O (Log N) –O (N) –O (N K ) where K is a constant Unreasonable algorithms have exponential factors –O (2 N ) –O (N!) –O (N N )

Reasonable vs. Unreasonable Reasonable algorithms May be usable depending upon the input size Unreasonable algorithms Are impractical and useful to theorists Demonstrate need for approximate solutions Remember we’re dealing with large N (input size)