Algorithms and Data Structures


 Norah King
 3 years ago
 Views:
Transcription
1 Algorithm Analysis Page 1 BFHTI: Softwareschule Schweiz Algorithm Analysis Dr. CAS SD01
2 Algorithm Analysis Page 2 Outline Course and Textbook Overview Analysis of Algorithm PseudoCode and Primitive Operations BigOh Notation and Complexity
3 Algorithm Analysis Course and Textbook Overview Page 3 Outline Course and Textbook Overview Analysis of Algorithm PseudoCode and Primitive Operations BigOh Notation and Complexity
4 Algorithm Analysis Course and Textbook Overview Page 4
5 Algorithm Analysis Course and Textbook Overview Page 5 Algorithm Design I Part I. Fundamental Tools 1. Algorithm Analysis 1.1 Methodologies for Analyzing Algorithms 1.2 Asymptotic Notation 1.3 A Quick Mathematical Review 1.4 Case Studies in Algorithm Analysis 1.5 Amortization 1.6 Experimentation 1.7 Exercises 2. Basic Data Structures 2.1 Stacks and Queues 2.2 Vectors, Lists, and Sequences 2.3 Trees 2.4 Priority Queues and Heaps 2.5 Dictionaries and Hash Tables
6 Algorithm Analysis Course and Textbook Overview Page 6 Algorithm Design II 2.6 Java Example: Heap 2.7 Exercises 3. Search Trees and Skip Lists 3.1 Ordered Dictionaries and Binary Search Trees 3.2 AVL Trees 3.3 BoundedDepth Search Trees 3.4 Splay Trees 3.5 Skip Lists 3.6 Java Example: AVL and RedBlack Trees 3.7 Exercises 4. Sorting, Sets, and Selection 4.1 MergeSort 4.2 The Set Abstract Data Type 4.3 QuickSort 4.4 A Lower Bound on ComparisonBased Sorting 4.5 BucketSort and RadixSort
7 Algorithm Analysis Course and Textbook Overview Page 7 Algorithm Design III 4.6 Comparison of Sorting Algorithms 4.7 Selection 4.8 Java Example: InPlace QuickSort 4.9 Exercises 5. Fundamental Techniques 5.1 The Greedy Method 5.2 DivideandConquer 5.3 Dynamic Programming 5.4 Exercises Part II. Graph Algorithms 1. Graphs 1.1 The Graph Abstract Data Type 1.2 Data Structures for Graphs 1.3 Graph Traversal 1.4 Directed Graphs
8 Algorithm Analysis Course and Textbook Overview Page 8 Algorithm Design IV 1.5 Java Example: DepthFirst Search 1.6 Exercises 2. Weighted Graphs 2.1 SingleSource Shortest Paths 2.2 AllPairs Shortest Paths 2.3 Minimum Spanning Trees 2.4 Java Example: Dijkstra s Algorithm 2.5 Exercises 3. Network Flow and Matching 3.1 Flows and Cuts 3.2 Maximum Flow 3.3 Maximum Bipartite Matching 3.4 MinimumCost Flow 3.5 Java Example: MinimumCost Flow 3.6 Exercises
9 Algorithm Analysis Course and Textbook Overview Page 9 Algorithm Design V Part III. Internet Algorithmics 1. Text Processing 1.1 Strings and Pattern Matching Algorithms 1.2 Tries 1.3 Text Compression 1.4 Text Similarity Testing 1.5 Exercises 2. Number Theory and Cryptography 2.1 Fundamental Algorithms Involving Numbers 2.2 Cryptographic Computations 2.3 Information Security Algorithms and Protocols 2.4 The Fast Fourier Transform 2.5 Java Example: FFT 2.6 Exercises 3. Network Algorithms
10 Algorithm Analysis Course and Textbook Overview Page 10 Algorithm Design VI 3.1 Complexity Measures and Models 3.2 Fundamental Distributed Algorithms 3.3 Broadcast and Unicast Routing 3.4 Multicast Routing 3.5 Exercises Part IV. Additional Topics 1. Computational Geometry 1.1 Range Trees 1.2 Priority Search Trees 1.3 Quadtrees and kd Trees 1.4 The Plane Sweep Technique 1.5 Convex Hulls 1.6 Java Example: Convex Hull 1.7 Exercises 2. NPCompleteness
11 Algorithm Analysis Course and Textbook Overview Page 11 Algorithm Design VII 2.1 P and NP 2.2 NPCompleteness 2.3 Important NPComplete Problems 2.4 Approximation Algorithms 2.5 Backtracking and BranchandBound 2.6 Exercises 3. Algorithmic Frameworks 3.1 ExternalMemory Algorithms 3.2 Parallel Algorithms 3.3 Online Algorithms 3.4 Exercises
12 Algorithm Analysis Analysis of Algorithm Page 12 Outline Course and Textbook Overview Analysis of Algorithm PseudoCode and Primitive Operations BigOh Notation and Complexity
13 Algorithm Analysis Analysis of Algorithm Page 13 Algorithms An algorithm is a stepbystep procedure for solving a problem in a finite amount of time Most algorithms transform input objects into output objects The running time (and the memory consumption) of an algorithm typically grows with the input size The average case running time is often difficult to determine We focus on the worst case running time Easier to analyse Crucial to applications such as games, finance, robotics Sometimes, it is also worth to study the best case running time
14 Algorithm Analysis Analysis of Algorithm Page 14 Running Time: Example Running Time Best case Average case Worst case Input Size
15 Algorithm Analysis Analysis of Algorithm Page 15 Problem Classes I There are feasible problems, which can be solved by an algorithm efficiently Examples: sorting a list, draw a line between two points, decide whether n is prime, etc. There are computable problems, which can be solved by an algorithm, but not efficiently Example: finding the shortest solution for large sliding puzzles There are undecidable problems, which can not be solved by an algorithm Example: for a given a description of a program and an input, decide whether the program finishes running or will run forever (halting problem)
16 Algorithm Analysis Analysis of Algorithm Page 16 Problem Classes II All Problems Computable Problems Feasible Problems
17 Algorithm Analysis Analysis of Algorithm Page 17 Experimental Studies There are two ways to analyse the running time (complexity) of an algorithm: Experimental studies Theoretical analysis Experiments usually involve the following major steps: Write a program implementing the algorithm Run the program with inputs of varying size and composition Use a method like System.currentTimeMillis() to get an accurate measure of the actual running time Plot the results
18 Algorithm Analysis Analysis of Algorithm Page 18 Experimental Studies: Example Running Time (ms) Input Size
19 Algorithm Analysis Analysis of Algorithm Page 19 Limits of Experiments It is necessary to implement the algorithm, which may be difficult Results may not be indicative of the running time on other inputs not included in the experiment The running times may depend strongly on the chosen setting (hardware, software, programming language) In order to compare two algorithms, the same hardware and software environments must be used
20 Algorithm Analysis Analysis of Algorithm Page 20 Theoretical Analysis Uses a highlevel description of the algorithm instead of an implementation Describes the running time (complexity) as a function of the input size n: T (n) = number of primitive operations Allows to evaluate the speed of an algorithm independent of hardware software programming language actual implementation Takes into account all possible inputs
21 Algorithm Analysis PseudoCode and Primitive Operations Page 21 Outline Course and Textbook Overview Analysis of Algorithm PseudoCode and Primitive Operations BigOh Notation and Complexity
22 Algorithm Analysis PseudoCode and Primitive Operations Page 22 PseudoCode Pseudocode allows a highlevel description of an algorithm More structured than English prose, but less detailed than a program Preferred notation for describing algorithms Hides program design issues and details of a particular language
23 Algorithm Analysis PseudoCode and Primitive Operations Page 23 PseudoCode: Example Find the maximum element of an array: Algorithm arraymax(a, n) Input array A of n integers Output maximum element of A currentmax A[0] for i 1 to n 1 do if A[i] > currentmax then currentmax A[i] return currentmax
24 Algorithm Analysis PseudoCode and Primitive Operations Page 24 Details of PseudoCode I The rules of using pseudocode are very flexible, but following some guidelines is recommended Method/function declaration Algorithm method or function(arg 1, arg 2,...) Input... Output... Control flow if... then... [else...] while... do... repeat... until... for... do... Indentation replaces braces {} resp. begin...end
25 Algorithm Analysis PseudoCode and Primitive Operations Page 25 Details of PseudoCode II Expressions Assignments: (like = in Java) Equality testing: = (like == in Java) Superscript like n 2 and other mathematical notation is allowed Array access: A[i 1] Function/method call function(arg 1, arg 2,...) object.method(arg 1, arg 2,...) Return value return expression
26 Algorithm Analysis PseudoCode and Primitive Operations Page 26 The Random Access Machine Model To study algorithms in pseudocode analytically, we need a theoretical model of a computing machine A random access machine consists of a CPU a bank of memory cells, each of which can hold an arbitrary number (of any size) or character The size of the memory is unlimited Memory cells are numbered and accessing any cell in memory takes 1 unit time (= random access) All primitive operations of the CPU take 1 unit time
27 Algorithm Analysis PseudoCode and Primitive Operations Page 27 Primitive Operations The primitive operations of a random access machine are the once we allow in a pseudocode algorithm Evaluating an expression (arithmetic operations, comparisons) Assigning a value to a variable Indexing into an array Calling a method/function Returning from a method/function Largely independent from the programming language By inspecting the pseudocode, we can count the maximum (or minimum) number of primitive operations executed by an algorithm, as a function of the input size T (n) = Running time for input of size n
28 Algorithm Analysis PseudoCode and Primitive Operations Page 28 Primitive Operations: Example Algorithm arraymax(a, n) currentmax A[0] for i 1 to n 1 do {i > n 1} if A[i] > currentmax then currentmax A[i] {i i + 1} return currentmax # Operations 2 1 2n 2(n 1) 2(n 1) 2(n 1) 1 Hence, the running time of arraymax is T (n) = 8n 2.
29 Algorithm Analysis PseudoCode and Primitive Operations Page 29 Worst Case vs. Best Case For a given input size n, the running time of an algorithm may still depend on the input Sorting a list of size n (the list may already be sorted) Finding an element in a list of size n (the element may be at the beginning of the list) Usually, if an algorithm contains ifthenelse statements, it can have different running times Worst case: maximal number of primitive operations Best case: minimal number of primitive operations Example: arraymax Worst case: T (n) = 8n 2 Best case: T (n) = 6n
30 Algorithm Analysis BigOh Notation and Complexity Page 30 Outline Course and Textbook Overview Analysis of Algorithm PseudoCode and Primitive Operations BigOh Notation and Complexity
31 Algorithm Analysis BigOh Notation and Complexity Page 31 Running Time Examples n 2n 2 10n log(n) n n log(n)
32 Algorithm Analysis BigOh Notation and Complexity Page 32 Polynomial Running Times Feasible algorithms are those with polynomial (or better) running times: T (n) n d, d > 0 Linear: T (n) n Quadratic: T (n) n 2 Cubic: T (n) n 3 The asymptotic growth rate is not affected by constants, factors, or lowerorder terms T (n) = 15n + 8 is linear T (n) = 100n is quadratic T (n) = 5n 3 + 5n 2 2n + 35 is cubic In a loglog chart, a polynomial running time turns out to be a straight line (its slope corresponds to the highestorder exponent of the polynom)
33 Algorithm Analysis BigOh Notation and Complexity Page 33 LogLog Chart superpolynomial cubic Running Time T(n) quadratic linear sub Polynomial Input Size n
34 Algorithm Analysis BigOh Notation and Complexity Page 34 Constants and Factors Running Time T(n) n n Input Size n
35 Algorithm Analysis BigOh Notation and Complexity Page 35 BigOh Notation The socalled bigoh notation is useful to better compare and classify the growth rates of different functions Given functions f (n) and g(n), we say that f (n) is O(g(n)), if there is a constant c > 0 and an integer n 0 1 such that Example 1: 2n + 10 is O(n) f (n) c g(n), for n n 0 2n + 10 c n n 10/(c 2), e.g. pick c = 3 and n 0 = 10 Example 2: n 2 is not O(n) n 2 c n n c, which can not be satisfied since c is a constant
36 Algorithm Analysis BigOh Notation and Complexity Page 36 BigOh Example Running Time T(n) n +10 3n n Input Size n
37 Algorithm Analysis BigOh Notation and Complexity Page 37 BigOh Example n n 1000 Running Time T(n) n n Input Size n
38 Algorithm Analysis BigOh Notation and Complexity Page 38 Simplification Rules If f is a function f and c a constant, then O(c f ) = O(f ) If f and g are functions, then O(f + g) = max(o(f ), O(g)) If f (n) is a polynomial of degree d, i.e. then f (n) is O(n d ) f (n) = a d n d a 2 n 2 + a 1 n + a 0 drop lowerorder terms, factors, and constants e.g. 5n 4 + 2n 2 3 is O(n 4 ) Use the smallest possible equivalence class say 2n is O(n) instead of 2n is O(n 2 ) say 3n + 5 is O(n) instead of 3n + 5 is O(3n)
39 Algorithm Analysis BigOh Notation and Complexity Page 39 BigOh Ordering The statement f (n) is O(g(n)) means that the growth rate of f (n) is no more than the growth rate of g(n) We can use the bigoh notation to order functions according to their growth rate f (n) is O(g(n)) g(n) is O(f (n)) f (n) g(n) Yes No f (n) g(n) No Yes f (n) g(n) Yes Yes The set Θ(f (n)) = {g(n) : f (n) g(n)} denotes the equivalence class of functions with growth rates equal to f (n)
40 Algorithm Analysis BigOh Notation and Complexity Page 40 Typical Running Times Constant: O(1) Logarithmic: O(log n) Linear: O(n) Quadratic: O(n 2 ) Cubic: O(n 3 ) Polynomial: O(n d ), d > 0 Exponential: O(b n ), b > 1 Others: O( n), O(n log n) Growth rate order: 1 log n n n n log n n 2 n 3 2 n 3 n
41 Algorithm Analysis BigOh Notation and Complexity Page 41 Growth Rate Comparison n log n n n n log n n 2 n 3 2 n ,096 65, ,024 32, , , ,384 2,097, ,048 65,536 16,777, , , , ,024 10,240 1,048, Atoms in the universe: ca
42 Algorithm Analysis BigOh Notation and Complexity Page 42 The Importance of Asymptotics 1 operation/µs 256 ops./µs Running Time Maximum Problem Size n New Size 400n 2, , 000 9, 000, n 20n log n 4, , 666 7, 826, n log n 7+log n 2n , , n n n 2 n n second 1 minute 1 hour
Analysis of Computer Algorithms. Algorithm. Algorithm, Data Structure, Program
Analysis of Computer Algorithms Hiroaki Kobayashi Input Algorithm Output 12/13/02 Algorithm Theory 1 Algorithm, Data Structure, Program Algorithm Welldefined, a finite stepbystep computational procedure
More informationDiscrete Mathematics, Chapter 3: Algorithms
Discrete Mathematics, Chapter 3: Algorithms Richard Mayr University of Edinburgh, UK Richard Mayr (University of Edinburgh, UK) Discrete Mathematics. Chapter 3 1 / 28 Outline 1 Properties of Algorithms
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies ( 3.1.1) Limitations of Experiments. Pseudocode ( 3.1.2) Theoretical Analysis
Ruig Time ( 3.) Aalysis of Algorithms Iput Algorithm Output A algorithm is a stepbystep procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationCSE373: 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 informationCS/COE 1501 http://cs.pitt.edu/~bill/1501/
CS/COE 1501 http://cs.pitt.edu/~bill/1501/ Lecture 01 Course Introduction Metanotes These notes are intended for use by students in CS1501 at the University of Pittsburgh. They are provided free of charge
More informationWhy? A central concept in Computer Science. Algorithms are ubiquitous.
Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online
More informationO(n) linear time This means that the algorithm requires a number of steps proportional to the size of the task.
Time complexity : Big O notation f(n) = O(g(n)) means There are positive constants c and k such that: 0
More informationAP Computer Science AB Syllabus 1
AP Computer Science AB Syllabus 1 Course Resources Java Software Solutions for AP Computer Science, J. Lewis, W. Loftus, and C. Cocking, First Edition, 2004, Prentice Hall. Video: Sorting Out Sorting,
More informationIntroduction to Algorithms. Part 3: P, NP Hard Problems
Introduction to Algorithms Part 3: P, NP Hard Problems 1) Polynomial Time: P and NP 2) NPCompleteness 3) Dealing with Hard Problems 4) Lower Bounds 5) Books c Wayne Goddard, Clemson University, 2004 Chapter
More informationSoftware: how we tell the machine what to do
Software: how we tell the machine what to do hardware is a general purpose machine capable of doing instructions repetitively and very fast doesn't do anything itself unless we tell it what to do software:
More informationSIMS 255 Foundations of Software Design. Complexity and NPcompleteness
SIMS 255 Foundations of Software Design Complexity and NPcompleteness Matt Welsh November 29, 2001 mdw@cs.berkeley.edu 1 Outline Complexity of algorithms Space and time complexity ``Big O'' notation Complexity
More informationExam study sheet for CS2711. List of topics
Exam study sheet for CS2711 Here is the list of topics you need to know for the final exam. For each data structure listed below, make sure you can do the following: 1. Give an example of this data structure
More informationEfficiency of algorithms. Algorithms. Efficiency of algorithms. Binary search and linear search. Best, worst and average case.
Algorithms Efficiency of algorithms Computational resources: time and space Best, worst and average case performance How to compare algorithms: machineindependent measure of efficiency Growth rate Complexity
More information2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]
Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)
More informationIn mathematics, it is often important to get a handle on the error term of an approximation. For instance, people will write
Big O notation (with a capital letter O, not a zero), also called Landau's symbol, is a symbolism used in complexity theory, computer science, and mathematics to describe the asymptotic behavior of functions.
More informationCSE 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 informationCS5310 Algorithms 3 credit hours 2 hours lecture and 2 hours recitation every week
CS5310 Algorithms 3 credit hours 2 hours lecture and 2 hours recitation every week This course is a continuation of the study of data structures and algorithms, emphasizing methods useful in practice.
More informationEastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students
Eastern Washington University Department of Computer Science Questionnaire for Prospective Masters in Computer Science Students I. Personal Information Name: Last First M.I. Mailing Address: Permanent
More informationSorting 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 informationAssignment 3 (concept) Solutions
CS10b Data Structures and Algorithms Assignment 3 (concept) Solutions Due: Friday, February 18th 1. (0%) Consider the following algorithm: Algorithm Power(x, n) Input: A number x and integer n 0 Output:
More information2 Exercises and Solutions
2 Exercises and Solutions Most of the exercises below have solutions but you should try first to solve them. Each subsection with solutions is after the corresponding subsection with exercises. 2.1 Sorting
More informationTwo General Methods to Reduce Delay and Change of Enumeration Algorithms
ISSN 13465597 NII Technical Report Two General Methods to Reduce Delay and Change of Enumeration Algorithms Takeaki Uno NII2003004E Apr.2003 Two General Methods to Reduce Delay and Change of Enumeration
More informationClass Overview. CSE 326: Data Structures. Goals. Goals. Data Structures. Goals. Introduction
Class Overview CSE 326: Data Structures Introduction Introduction to many of the basic data structures used in computer software Understand the data structures Analyze the algorithms that use them Know
More informationCSC148 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 informationData Structures and Algorithms. with ObjectOriented Design Patterns in C++
Data Structures and Algorithms with ObjectOriented Design Patterns in C++ Data Structures and Algorithms with ObjectOriented Design Patterns in C++ Bruno R. Preiss B.A.Sc., M.A.Sc., Ph.D., P.Eng. Associate
More informationThe divide and conquer strategy has three basic parts. For a given problem of size n,
1 Divide & Conquer One strategy for designing efficient algorithms is the divide and conquer approach, which is also called, more simply, a recursive approach. The analysis of recursive algorithms often
More informationTextbook: Data Structures and Algorithm Analysis in C++ (3rd edition), by M. A. Weiss. AddisonWesley, ISBN10: X & ISBN13:
SYLLABUS: Data Structures, Algorithms, and Generic Programming COP4530/CGS5425 Fall 2006 Mon./Wed. 3:354:50pm @ 301 LOVE BLDG Thu. 11:00am12:15pm (sec. 01) and 12:301:45pm (sec. 02) @ 202 Carothers
More informationMerge Sort. 2004 Goodrich, Tamassia. Merge Sort 1
Merge Sort 7 2 9 4 2 4 7 9 7 2 2 7 9 4 4 9 7 7 2 2 9 9 4 4 Merge Sort 1 DivideandConquer Divideand conquer is a general algorithm design paradigm: Divide: divide the input data S in two disjoint subsets
More informationTheoretical Computer Science (Bridging Course) Complexity
Theoretical Computer Science (Bridging Course) Complexity Gian Diego Tipaldi A scenario You are a programmer working for a logistics company Your boss asks you to implement a program that optimizes the
More informationPersistent 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 informationAlgorithms. 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 bigo
More informationState Space Problem Definition
Blind Search State Space Problem Definition One widely used way to describe problems is by listing or describing all possible states. Solving a problem means moving through the state space from a start
More informationAlgorithms and recursion
Read: Chapter 13 from textbook Algorithms and recursion What programs implement is recipes for solving problems. These recipes are called algorithms. We have already seen (in the practice problems from
More informationLECTURE NOTES ON DESIGN AND ANALYSIS OF ALGORITHMS
LECTURE NOTES ON DESIGN AND ANALYSIS OF ALGORITHMS INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal 500 043, Hyderabad CONTENTS UNIT 1 BASIC CONCEPTS Algorithm Performance of Programs Algorithm Design Goals
More informationWriting programs to solve problem consists of a large. how to represent aspects of the problem for solution
Algorithm Efficiency & Sorting Algorithm efficiency BigO notation Searching algorithms Sorting algorithms 1 Overview 2 If a given ADT (i.e. stack or queue) is attractive as part of a solution How will
More informationCSC 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 timeefficient, and to be able to compare different algorithms. 2 Linear
More informationComputer Algorithms. NPComplete Problems. CISC 4080 Yanjun Li
Computer Algorithms NPComplete Problems NPcompleteness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order
More information12 Abstract Data Types
12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).
More informationToday s Outline. Exercise. Binary Search Analysis. Linear Search Analysis. Asymptotic Analysis. Analyzing Code. Announcements. Asymptotic Analysis
Today s Outline Announcements Assignment #1 due Thurs, Oct 7 at 11:45pm Asymptotic Analysis Asymptotic Analysis CSE 7 Data Structures & Algorithms Ruth Anderson Autumn 2010 Exercise Analyzing Code bool
More informationUninformed Search. Chapter 3. (Based on slides by Stuart Russell, Dan Weld, Oren Etzioni, Henry Kautz, and other UWAI faculty)
Uninformed Search Chapter 3 (Based on slides by Stuart Russell, Dan Weld, Oren Etzioni, Henry Kautz, and other UWAI faculty) What is Search? Search is a class of techniques for systematically finding
More information6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 2008
MIT OpenCourseWare http://ocw.mit.edu 6.080 / 6.089 Great Ideas in Theoretical Computer Science Spring 008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
More informationBinary 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 informationTo My Parents Laxmi and Modaiah. To My Family Members. To My Friends. To IIT Bombay. To All Hard Workers
To My Parents Laxmi and Modaiah To My Family Members To My Friends To IIT Bombay To All Hard Workers Copyright 2010 by CareerMonk.com All rights reserved. Designed by Narasimha Karumanchi Printed in
More informationCS2223 Algorithms B Term 2013 Exam 2 Solutions
CS2223 Algorithms B Term 2013 Exam 2 Solutions Dec. 3, 2013 By Prof. Carolina Ruiz Dept. of Computer Science WPI PROBLEM 1: Solving Recurrences (15 points) Solve the recurrence T (n) = 2T (n/3) + n using
More informationALGEBRA 1/ALGEBRA 1 HONORS
ALGEBRA 1/ALGEBRA 1 HONORS CREDIT HOURS: 1.0 COURSE LENGTH: 2 Semesters COURSE DESCRIPTION The purpose of this course is to allow the student to gain mastery in working with and evaluating mathematical
More informationAnswers to Homework 1
Answers to Homework 1 p. 13 1.2 3 What is the smallest value of n such that an algorithm whose running time is 100n 2 runs faster than an algorithm whose running time is 2 n on the same machine? Find the
More information1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.
1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. base address 2. The memory address of fifth element of an array can be calculated
More informationAlgebraic Computation Models. Algebraic Computation Models
Algebraic Computation Models Ζυγομήτρος Ευάγγελος ΜΠΛΑ 201118 Φεβρουάριος, 2013 Reasons for using algebraic models of computation The Turing machine model captures computations on bits. Many algorithms
More informationCPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]
CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313] File Structures A file is a collection of data stored on mass storage (e.g., disk or tape) Why on mass storage? too big to fit
More informationThe Selection Problem
The Selection Problem The selection problem: given an integer k and a list x 1,..., x n of n elements find the kth smallest element in the list Example: the 3rd smallest element of the following list
More informationOpen Data Structures (in pseudocode)
Open Data Structures (in pseudocode) Edition 0.1Gβ Pat Morin Contents Acknowledgments Why This Book? ix xi 1 Introduction 1 1.1 The Need for Efficiency..................... 2 1.2 Interfaces.............................
More informationFundamental Computer Science Concepts Sequence TCSU CSCI SEQ A
Fundamental Computer Science Concepts Sequence TCSU CSCI SEQ A A. Description Introduction to the discipline of computer science; covers the material traditionally found in courses that introduce problem
More informationSorting algorithms. Mergesort and Quicksort. Merge Sort. Partitioning Choice 1. Partitioning Choice 3. Partitioning Choice 2 2/5/2015
Sorting algorithms Mergesort and Quicksort Insertion, selection and bubble sort have quadratic worst case performance The faster comparison based algorithm? O(nlogn) Mergesort and Quicksort Merge Sort
More informationCMSC 451: Graph Properties, DFS, BFS, etc.
CMSC 451: Graph Properties, DFS, BFS, etc. Slides By: Carl Kingsford Department of Computer Science University of Maryland, College Park Based on Chapter 3 of Algorithm Design by Kleinberg & Tardos. Graphs
More information4. Factor polynomials over complex numbers, describe geometrically, and apply to realworld situations. 5. Determine and apply relationships among syn
I The Real and Complex Number Systems 1. Identify subsets of complex numbers, and compare their structural characteristics. 2. Compare and contrast the properties of real numbers with the properties of
More informationData Structure. Lecture 3
Data Structure Lecture 3 Data Structure Formally define Data structure as: DS describes not only set of objects but the ways they are related, the set of operations which may be applied to the elements
More informationLecture 4: Properties of and Rules for
Lecture 4: Properties of and Rules for Asymptotic BigOh, BigOmega, and BigTheta Notation Georgy Gimel farb COMPSCI 220 Algorithms and Data Structures 1 / 13 1 Time complexity 2 BigOh rules Scaling
More informationProgramming Using Python
Introduction to Computation and Programming Using Python Revised and Expanded Edition John V. Guttag The MIT Press Cambridge, Massachusetts London, England CONTENTS PREFACE xiii ACKNOWLEDGMENTS xv 1 GETTING
More informationBinary Search. Search for x in a sorted array A.
Divide and Conquer A general paradigm for algorithm design; inspired by emperors and colonizers. Threestep process: 1. Divide the problem into smaller problems. 2. Conquer by solving these problems. 3.
More informationAnalysis of Algorithms: The Nonrecursive Case
Analysis of Algorithms: The Nonrecursive Case Key topics: * Introduction * Generalizing Running Time * Doing a Timing Analysis * BigOh Notation * BigOh Operations * Analyzing Some Simple Programs 
More informationData Structures. Algorithm Performance and Big O Analysis
Data Structures Algorithm Performance and Big O Analysis What s an Algorithm? a clearly specified set of instructions to be followed to solve a problem. In essence: A computer program. In detail: Defined
More informationCSC 143. Two important problems. Searching and Sorting. Review: Linear Search. Example. Review: Binary Search. How Efficient Is Linear Search?
CSC 43 Searching and Sorting [Chapter 9, pp. 402432] Two important problems Search: finding something in a set of data Sorting: putting a set of data in order Both very common, very useful operations
More informationSEARCHING AND SORTING
SEARCHING AND SORTING Searching A basic operation in computer science Problem formulation Given: Collection (array) of values A property on values Find: a value having the property in the array Examples
More informationCS420/520 Algorithm Analysis Spring 2010 Lecture 04
CS420/520 Algorithm Analysis Spring 2010 Lecture 04 I. Chapter 4 Recurrences A. Introduction 1. Three steps applied at each level of a recursion a) Divide into a number of subproblems that are smaller
More informationBasic Programming and PC Skills: Basic Programming and PC Skills:
Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of
More informationZabin 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 informationCOMPUTER SCIENCE SUBGROUP
1 P a g e http://cs.stormingrobots.com Computer Science skill should go beyond just programming itself but much more importantly in problems solving skill with computational thinking even for grade schools.
More informationArithmetic Coding: Introduction
Data Compression Arithmetic coding Arithmetic Coding: Introduction Allows using fractional parts of bits!! Used in PPM, JPEG/MPEG (as option), Bzip More time costly than Huffman, but integer implementation
More informationEastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students
Eastern Washington University Department of Computer Science Questionnaire for Prospective Masters in Computer Science Students I. Personal Information Name: Last First M.I. Mailing Address: Permanent
More informationThe Running Time of Programs
CHAPTER 3 The Running Time of Programs In Chapter 2, we saw two radically different algorithms for sorting: selection sort and merge sort. There are, in fact, scores of algorithms for sorting. This situation
More informationAlgorithms and data structures
Algorithms and data structures This course will examine various data structures for storing and accessing information together with relationships between the items being stored, and algorithms for efficiently
More information2) What is the structure of an organization? Explain how IT support at different organizational levels.
(PGDIT 01) Paper  I : BASICS OF INFORMATION TECHNOLOGY 1) What is an information technology? Why you need to know about IT. 2) What is the structure of an organization? Explain how IT support at different
More informationFaster deterministic integer factorisation
David Harvey (joint work with Edgar Costa, NYU) University of New South Wales 25th October 2011 The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers
More informationApproximation Algorithms
Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NPCompleteness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms
More informationDivision of Mathematical Sciences
Division of Mathematical Sciences Chair: Mohammad Ladan, Ph.D. The Division of Mathematical Sciences at Haigazian University includes Computer Science and Mathematics. The Bachelor of Science (B.S.) degree
More informationSample Questions Csci 1112 A. Bellaachia
Sample Questions Csci 1112 A. Bellaachia Important Series : o S( N) 1 2 N N i N(1 N) / 2 i 1 o Sum of squares: N 2 N( N 1)(2N 1) N i for large N i 1 6 o Sum of exponents: N k 1 k N i for large N and k
More informationComputer. Course Description
Computer Science Computer Science A Computer Science AB Course Description May 2009 The College Board: Connecting Students to College Success The College Board is a notforprofit membership association
More informationCurriculum Reform. Department of Computer Sciences University of Texas at Austin 7/10/08 UTCS
Curriculum Reform Department of Computer Sciences University of Texas at Austin 7/10/08 1 CS Degrees BA with a major in CS BS, Option I: Computer Sciences BS, Option II: Turing Scholars Honors BS, Option
More informationInteger Factorization using the Quadratic Sieve
Integer Factorization using the Quadratic Sieve Chad Seibert* Division of Science and Mathematics University of Minnesota, Morris Morris, MN 56567 seib0060@morris.umn.edu March 16, 2011 Abstract We give
More informationAnnouncements. CSE332: Data Abstractions. Lecture 9: B Trees. Today. Our goal. Mary Search Tree. Mary Search Tree. Ruth Anderson Winter 2011
Announcements CSE2: Data Abstractions Project 2 posted! Partner selection due by 11pm Tues 1/25 at the latest. Homework due Friday Jan 28 st at the BEGINNING of lecture Lecture 9: B Trees Ruth Anderson
More informationAlgorithm Homework and Test Problems
Algorithm Homework and Test Problems Steven S. Skiena Department of Computer Science State University of New York Stony Brook, NY 117944400 skiena@cs.sunysb.edu January 29, 2006 All of the midterm and
More informationIMPROVING PERFORMANCE OF RANDOMIZED SIGNATURE SORT USING HASHING AND BITWISE OPERATORS
Volume 2, No. 3, March 2011 Journal of Global Research in Computer Science RESEARCH PAPER Available Online at www.jgrcs.info IMPROVING PERFORMANCE OF RANDOMIZED SIGNATURE SORT USING HASHING AND BITWISE
More informationCourse Descriptions for 7 th & 8 th Grade Mathematics
Course Descriptions for 7 th & 8 th Grade Mathematics 7 th Grade Academic Math This course is based upon the 7 th grade PA core standards to prepare students for future algebra based understandings. The
More informationData Structures Using Java
Data Structures Using Java D. S. Malik P. S. Nair THOMSON COURSE TECHNOLOGY Australia Canada Mexico Singapore Spain United Kingdom United States TABLE OF Contents PREFACE XXV 1.Software Engineering Principles
More informationData Structures and Algorithms
Data Structures and Algorithms Computational Complexity Escola Politècnica Superior d Alcoi Universitat Politècnica de València Contents Introduction Resources consumptions: spatial and temporal cost Costs
More informationIntroduction to Programming System Design. CSCI 455x (4 Units)
Introduction to Programming System Design CSCI 455x (4 Units) Description This course covers programming in Java and C++. Topics include review of basic programming concepts such as control structures,
More informationData Structures and Algorithms Written Examination
Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where
More informationChapter 1. Computation theory
Chapter 1. Computation theory In this chapter we will describe computation logic for the machines. This topic is a wide interdisciplinary field, so that the students can work in an interdisciplinary context.
More informationESIEE Paris International Master of Computer Science DMC (Diplôme National de Master) Official program for years 2016 to 2018
ESIEE Paris International Master of Computer Science DMC (Diplôme National de Master) Official program for years 2016 to 2018 International Master of Computer Science DMC DMC Programme The DMC programme
More informationPart VII Conclusion: Computer Science
Part VII Conclusion: Computer Science This is the end of the technical material in this book. We ve explored the big ideas of composition of functions, functions as data, recursion, abstraction, and sequential
More informationDiagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, 2009. Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.
Diagonalization Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach. Ahto Buldas Ahto.Buldas@ut.ee Background One basic goal in complexity theory is to separate interesting complexity
More informationDepartment of Industrial Engineering
Department of Industrial Engineering Master of Engineering Program in Industrial Engineering (International Program) M.Eng. (Industrial Engineering) Plan A Option 2: Total credits required: minimum 39
More informationComputer Science III
Computer Science III Dr. Chris Bourke Department of Computer Science & Engineering University of Nebraska Lincoln Lincoln, NE 68588, USA http://cse.unl.edu/~cbourke cbourke@cse.unl.edu 2015/08/13 14:38:26
More informationInternational 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 informationdef: A worstcase complexity measure estimates the time required for the most timeconsuming
Section 2.3 Complexity 2.3.1 2.3 COMPLEXITY disambiguation: In the early 1960 s, Chaitin and Kolmogorov used complexity to mean measures of complicatedness. However, most theoretical computer scientists
More informationTheory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras
Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding
More informationOn the effect of forwarding table size on SDN network utilization
IBM Haifa Research Lab On the effect of forwarding table size on SDN network utilization Rami Cohen IBM Haifa Research Lab Liane Lewin Eytan Yahoo Research, Haifa Seffi Naor CS Technion, Israel Danny Raz
More informationFinal Exam Solutions
Introduction to Algorithms May 19, 2011 Massachusetts Institute of Technology 6.006 Spring 2011 Professors Erik Demaine, Piotr Indyk, and Manolis Kellis Final Exam Solutions Problem 1. Final Exam Solutions
More informationCS 2302 Data Structures Spring 2015
1. General Information Instructor: CS 2302 Data Structures Spring 2015 Olac Fuentes Email: ofuentes@utep.edu Web: www.cs.utep.edu/ofuentes Office hours: Tuesdays and Thursdays 2:003:30, or by appointment,
More informationAlgorithms. Theresa MiglerVonDollen CMPS 5P
Algorithms Theresa MiglerVonDollen CMPS 5P 1 / 32 Algorithms Write a Python function that accepts a list of numbers and a number, x. If x is in the list, the function returns the position in the list
More information