Scalability for Search

Slides:



Advertisements
Similar presentations
Intro to Analysis of Algorithms. Algorithm “A sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any.
Advertisements

Razdan with contribution from others 1 Algorithm Analysis What is the Big ‘O Bout? Anshuman Razdan Div of Computing.
Analysys & Complexity of Algorithms Big Oh Notation.
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 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.
Lecture 3 Feb 7, 2011 Goals: Chapter 2 (algorithm analysis) Examples: Selection sorting rules for algorithm analysis Image representation Image processing.
Algorithm Analysis (Big O)
Algorithm Cost Algorithm Complexity. Algorithm Cost.
Week 2 CS 361: Advanced Data Structures and Algorithms
Algorithm Efficiency CS 110: Data Structures and Algorithms First Semester,
Mathematics Review and Asymptotic Notation
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.
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.
Program Efficiency & Complexity Analysis. Algorithm Review An algorithm is a definite procedure for solving a problem in finite number of steps Algorithm.
Chapter 5 Algorithms (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
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.
Algorithm Analysis (Big O)
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.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
GC 211:Data Structures Week 2: Algorithm Analysis Tools Slides are borrowed from Mr. Mohammad Alqahtani.
Data Structures I (CPCS-204) Week # 2: Algorithm Analysis tools Dr. Omar Batarfi Dr. Yahya Dahab Dr. Imtiaz Khan.
CMPT 438 Algorithms.
Analysis of Algorithms
GC 211:Data Structures Week 2: Algorithm Analysis Tools
COMP108 Algorithmic Foundations Algorithm efficiency
Last time More and more information born digital
Asymptotic Notations Algorithms perform f(n) basic operations to accomplish task Identify that function Identify size of problem (n) Count number of operations.
Introduction to Algorithms
GC 211:Data Structures Algorithm Analysis Tools
Big-O notation.
What is an Algorithm? Algorithm Specification.
Complexity analysis.
Growth of functions CSC317.
Analysis of Algorithms
CS 3343: Analysis of Algorithms
The Pennsylvania State University, University Park, PA, USA
Algorithm design and Analysis
Scalability for Search and Big O
GC 211:Data Structures Algorithm Analysis Tools
CSC 413/513: Intro to Algorithms
Introduction to Algorithms Analysis
Asymptotic Notations Algorithms perform f(n) basic operations to accomplish task Identify that function Identify size of problem (n) Count number of operations.
CSI Growth of Functions
Analysis of Algorithms
Analysis of Algorithms
CS 201 Fundamental Structures of Computer Science
Analysys & Complexity of Algorithms
Advanced Analysis of Algorithms
DS.A.1 Algorithm Analysis Chapter 2 Overview
Analysis of Algorithms II
GC 211:Data Structures Algorithm Analysis Tools
CSE 2010: Algorithms and Data Structures Algorithms
Scalability for Search and Big O
Searching, Sorting, and Asymptotic Complexity
Asst. Dr.Surasak Mungsing
Searching, Sorting, and Asymptotic Complexity
Analysis of Algorithms II
Algorithms Analysis Algorithm efficiency can be measured in terms of:
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
David Kauchak cs161 Summer 2009
Big-O & Asymptotic Analysis
Analysis of Algorithms
Algorithm Analysis How can we demonstrate that one algorithm is superior to another without being misled by any of the following problems: Special cases.
CMPT 225 Lecture 6 – Review of Complexity Analysis using the Big O notation + Comparing List ADT class implementations.
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 various ways: Number of things searched – N Number of searchers – M Algorithms for indexing, ranking, etc.

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 inputs, 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.

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 n0 such that 0  f(n)  cg(n) for all n  n0}

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

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

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

Correct but Meaningless You could say 3n2 + 2 = O(n6) or 3n2 + 2 = O(n7) 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.

Big O issues Useful for scaling Sometimes constants matter for real problems c is .0001 vs c is 106 Use Big O carefully

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 Performance classes Polynomial Sub-linear O(Log N) Linear O(N) Nearly linear O(N Log N) Quadratic O(N2) Exponential O(2N) O(N!) O(NN) practical Usually death to scaling impractical MapReduce may help

Two Categories of Algorithms Lifetime of the universe 1010 years = 1017 sec Unreasonable 1035 1030 1025 1020 1015 trillion billion million 1000 100 10 NN 2N Reasonable Runtime sec N5 N Don’t Care! 2 4 8 16 32 64 128 256 512 1024 Size of Input (N)

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

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)