Chapter 5: Algorithms
|
|
- Sherilyn Morton
- 6 years ago
- Views:
Transcription
1 Chapter 5: Algorithms Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Presentation files modified by Farn Wang Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
2 Chapter 5: Algorithms 5.1 The Concept of an Algorithm 5.2 Algorithm Representation 5.3 Algorithm Discovery 5.4 Iterative Structures 5.5 Recursive Structures 5.6 Efficiency and Correctness Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-2
3 Definition of Algorithm An algorithm is an ordered set of unambiguous, executable steps that defines a terminating process. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-3
4 Algorithm Representation Requires well-defined primitives A collection of primitives constitutes a programming language. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-4
5 Folding a bird from a square piece of paper Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-5
6 Origami primitives 折 り 紙 Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-6
7 Problem Solving Steps Designed the method in Hungary teaching the son of a baron. 1. Understand the problem. 2. Devise a plan for solving the problem. 3. Carry out the plan. 4. Evaluate the solution for accuracy and its potential as a tool for solving other problems. George Pólya ( ) Stanford, ETH-Zurich Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-7
8 Getting a Foot in the Door Basic approaches: Try working the problem backwards Solve an easier related problem Relax some of the problem constraints Solve pieces of the problem first (bottom up methodology) Stepwise refinement: Divide the problem into smaller problems (top-down methodology) Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-8
9 A trial case study in solving problems - Ages of Children Problem Person A is charged with the task of determining the ages of B s three children. B tells A that the product of the children s ages is 36. A replies that another clue is required. B tells A the sum of the children s ages. A replies that another clue is needed. B tells A that the oldest child plays the piano. A tells B the ages of the three children. How old are the three children? Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-9
10 Understanding the domain instances for a solution You can spend all the time fretting without a clue. Or you can start to play with the numbers. The only pair that needs clue 3 to distinguish. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-10
11 Representation of algorithms - Pseudocode Primitives Assignment name expression Conditional selection if condition then action Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-11
12 Representation of algorithms - Pseudocode Primitives (continued) Repeated execution while condition do activity Procedure procedure name (generic names) Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-12
13 Representation of algorithms - The procedure Greetings in pseudocode Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-13
14 Iterative Structures Pretest loop: while (condition) do (loop body) Posttest loop: repeat (loop body) until(condition) Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-14
15 The sequential search algorithm in pseudocode Assumption: sorted list. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-15
16 Components of repetitive control Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-16
17 Representation of algorithms - flowchart The while loop structure: Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-17
18 Representation of algorithms - flowchart The repeat-until loop structure Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-18
19 How to design an algorithm? - Intuition behind a sorting algorithm Given a data item b and a sorted list d 1,,d k, we can easily insert b into d 1,,d k. sort d 1 sort d 1, d 2 Insert d 1 to the right position in. Insert d 2 to the right position in d 1. sort d 1, d 2, d 3 Insert d 3 to the right position in d 1,d 2. sort d 1, d 2,., d n Insert d n to the right position in d 1,,d n-1. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-19
20 Test run of the algorithm in mind: Sorting the list Fred, Alex, Diana, Byron, and Carol alphabetically Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-20
21 Pseudo-code for insertion sort - an example of loop algorithms This is the pseudocode in the textbook. I think it is a bad example. Why? Too close to the real code. Too many details. Difficult to understand. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-21
22 A better pseudo-code for insertion sort High-level mathematical notations. Procedure sort(list) { } Loop for N = 2 to List { Insert List[N] to the right position in List[1..N-1] to make List[1..N] sorted; High-level and intuitive operations in natural languages. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-22
23 Recursion The execution of a procedure leads to another execution of the procedure. Multiple activations of the procedure are formed, all but one of which are waiting for other activations to complete. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-23
24 Recursion F(n) = F(n-1) + F(n-2) F(0) = 0 F(1) = 1 F(n) { } if (n <= 0) return(0); else if (n == 1) return 1; else return F(n-1)+F(n-2); How many times F() is called? f(n) = 1+f(n-1)+f(n-2); f(0)=1, f(1)=1; Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-24
25 Recursion - implemented with iteration F(n) = F(n-1) + F(n-2) F(0) = 0 F(1) = 1 F(n) { } F(0) = 0; F(1) = 1; k = 2; while (k <= n) { F(k)=F(k-1)+F(k-2); k=k+1;} return (F(n)); How many steps? f (n) = 1 + n; Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-25
26 2013/04/17 stopped here. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-26
27 Recursion - with improved performance F(n) = F(n-1) + F(n-2) ; F(0) = 1; F(1) = 1 F(n) { if (n < 0) exit(0); else if (n == 0 n == 1) return n; else if (D[n] == -1) D[n] = F(n-1)+F(n-2); return(d[n]); } Main (n) { } k=0; while (k<=n) {D[k]=-1; k=k+1;} return F(n); Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Initialize the D array. 5-27
28 Recursion for search? - Trying out an example for the entry John Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-28
29 Binary search technique - A first draft Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-29
30 Binary search algorithm - pseudocode with recursion concept Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-30
31 Binary search in recursion bsearch(l[j,k], t) { if (j>k) return search failure. m = (j+k)/2 ; if (t==l[m]) return m; else (t<l[m]) return bsearch(l[j,m-1],t); else return bsearch(l[m+1,k], t); } Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-31
32 Binary search in recursion bsearch(l[j,k], t) { while (j<=k) { m = (j+k)/2 ; if (t==l[m]) return m; else (t<l[m]) k = m-1; else j=m+1; } return search failure. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley } 5-32
33 Conceptualizing the recursion (I/III) Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-33
34 Conceptualizing the recursion (II/III) Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-34
35 Conceptualizing the recursion (III/III) Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-35
36 Algorithm Efficiency Measured as number of instructions executed Big O notation: Used to represent efficiency classes. Examples: Insertion sort for n elements is in O(n 2 ) binary search for n elements is in O(log n) F(n) iterative: O(n) F(n) purely recurisive: O(f(n)), f(n)=1+f(n-1)+f(n-2). Best, worst, and average case analysis Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-36
37 Applying the insertion sort in a worstcase situation Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-37
38 Graph of the worst-case analysis of the insertion sort algorithm Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-38
39 Graph of the worst-case analysis of the binary search algorithm Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-39
40 Algorithm Efficiency Big O concepts for worst-case analysis Insertion sort for n elements is in O(n 2 ) n n sec with efficient compiler & CPU binary search for n elements is in O(log n) log n sec with lousy compiler & CPU As n becomes bigger and bigger, n n >> log n sec Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-40
41 The lower-bound for worst cases? - An example Chain Separating Problem A traveler has a gold chain of seven links. He must stay at an isolated hotel for seven nights. The rent each night consists of one link from the chain. What is the fewest number of links that must be cut so that the traveler can pay the hotel one link of the chain each morning without paying for lodging in advance? Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-41
42 Separating the chain using only three cuts Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-42
43 Solving the problem with only one cut Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-43
44 Lower-bound of worst-case efficiency How do we know if an algorithm is good enough for a task? What is the assumptions of basic operations? Have we tied up ourselves? Lemma: One cut is the minimum. Proof: At least one chain is given in the first morning. So one cut is the least. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-44
45 Lower-bound of worst-case efficiency other techniques reduction: translate any instance of a problem A with known lower-bound to the given problem B. Then we can show B s lower-bound is no lower than A s. information theory: Is log(n) the best lower-bound for the worst case of searching algorithms? Is n log(n) the best for sorting algorithms? Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-45
46 Software Verification Proof of correctness Assertions Preconditions Loop invariants Testing send testcases to SW check the SW behavior or output Verification analysis of models of SW Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-46
47 The assertions associated with a typical while structure Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-47
48 Assertions - an example on recursive code. F(n) = F(n-1) + F(n-2), F(0) =0, F(1) = 1 F(n) { } F(0) = 0; F(1) = 1; k = 2; while (k <= n) { } F(k)=F(k-1)+F(k-2); k=k+1; return (F(n)); Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley precondition: true precondition: k=2 Loop invariants: k<=n, i<k, F(i)=F(i-1)+F(i-2) can be proved with mathematical induction. precondition: F(n)=F(n-1)+F(n-2) 5-48
49 Various algorithms (I) Numerical factorization, prime number testing, Constraint solving equations, inequalities, differential systems Sequence: Sorting, searching, merging, pattern matching, data mining Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-49
50 Various algorithms (II) Graph algorithms searching, traversal, critical paths, flow analysis,. structure identification, spanning trees Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-50
51 Various algorithms (III) Graph algorithms searching, traversal, critical paths, flow analysis,. structure identification, spanning trees Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-51
52 Various algorithms (III) Logics solutions, Boolean operations, greatest fixpoint, least fixpoint Distributed algorithms leader elections, snapshots, deadlock detection, consensus. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-52
53 Algorithms for nonterminating systems Operating systems deadlock mutual exclusion security Medical systems Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-53
54 When there is no algorithm genetic algorithm swamp intelligence ant intelligence machine learning heuristics solution as proofs.. Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-54
55 Complexities Average case? Worst case? Algorithms: time complexities space complexities Problems: How efficient can we make the program run? Is there an algorithm? Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-55
56 Data structures linear structures arrays, sequence, stacks, queues tree-structures binary trees, 2-3 trees, splay trees general graphs DAG (directed acyclic graphs) directed, undirected, multigraphs Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 5-56
Chapter 11: Artificial Intelligence
Chapter 11: Artificial Intelligence Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Presentation files modified by Farn Wang Copyright 2008 Pearson Education, Inc. Publishing as Pearson
More informationChapter wise Question bank
GOVERNMENT ENGINEERING COLLEGE - MODASA Chapter wise Question bank Subject Name Analysis and Design of Algorithm Semester Department 5 th Term ODD 2015 Information Technology / Computer Engineering Chapter
More informationCOSC160: Data Structures Binary Trees. Jeremy Bolton, PhD Assistant Teaching Professor
COSC160: Data Structures Binary Trees Jeremy Bolton, PhD Assistant Teaching Professor Outline I. Binary Trees I. Implementations I. Memory Management II. Binary Search Tree I. Operations Binary Trees A
More informationBasic Data Structures. Figure 8.1 Lists, stacks, and queues. Terminology for Stacks. Terminology for Lists. Chapter 8: Data Abstractions
Chapter 8: Data Abstractions Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Chapter 8: Data Abstractions 8.1 Data Structure Fundamentals 8.2 Implementing Data Structures 8.3 A Short
More informationFundamental Algorithms - Surprise Test
Technische Universität München Fakultät für Informatik Lehrstuhl für Effiziente Algorithmen Dmytro Chibisov Sandeep Sadanandan Winter Semester 007/08 Sheet Model Test January 16, 008 Fundamental Algorithms
More informationSublinear Time Algorithms Oct 19, Lecture 1
0368.416701 Sublinear Time Algorithms Oct 19, 2009 Lecturer: Ronitt Rubinfeld Lecture 1 Scribe: Daniel Shahaf 1 Sublinear-time algorithms: motivation Twenty years ago, there was practically no investigation
More informationDesign and Analysis of Algorithms. Lecture 9 November 20, 2013 洪國寶
Design and Analysis of Algorithms 演算法設計與分析 Lecture 9 November 20, 2013 洪國寶 1 Outline Advanced data structures Binary heaps (review) Binomial heaps Fibonacci heaps Dt Data structures t for disjoint dijitsets
More informationCSE 21 Winter 2016 Homework 6 Due: Wednesday, May 11, 2016 at 11:59pm. Instructions
CSE 1 Winter 016 Homework 6 Due: Wednesday, May 11, 016 at 11:59pm Instructions Homework should be done in groups of one to three people. You are free to change group members at any time throughout the
More informationDesign and Analysis of Algorithms 演算法設計與分析. Lecture 9 November 19, 2014 洪國寶
Design and Analysis of Algorithms 演算法設計與分析 Lecture 9 November 19, 2014 洪國寶 1 Outline Advanced data structures Binary heaps(review) Binomial heaps Fibonacci heaps Data structures for disjoint sets 2 Mergeable
More informationLecture 4: Divide and Conquer
Lecture 4: Divide and Conquer Divide and Conquer Merge sort is an example of a divide-and-conquer algorithm Recall the three steps (at each level to solve a divideand-conquer problem recursively Divide
More informationChapter 16. Binary Search Trees (BSTs)
Chapter 16 Binary Search Trees (BSTs) Search trees are tree-based data structures that can be used to store and search for items that satisfy a total order. There are many types of search trees designed
More informationPRIORITY QUEUES. binary heaps d-ary heaps binomial heaps Fibonacci heaps. Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley
PRIORITY QUEUES binary heaps d-ary heaps binomial heaps Fibonacci heaps Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley http://www.cs.princeton.edu/~wayne/kleinberg-tardos Last updated
More informationThe Traveling Salesman Problem. Time Complexity under Nondeterminism. A Nondeterministic Algorithm for tsp (d)
The Traveling Salesman Problem We are given n cities 1, 2,..., n and integer distances d ij between any two cities i and j. Assume d ij = d ji for convenience. The traveling salesman problem (tsp) asks
More informationAlgorithms PRIORITY QUEUES. binary heaps d-ary heaps binomial heaps Fibonacci heaps. binary heaps d-ary heaps binomial heaps Fibonacci heaps
Priority queue data type Lecture slides by Kevin Wayne Copyright 05 Pearson-Addison Wesley http://www.cs.princeton.edu/~wayne/kleinberg-tardos PRIORITY QUEUES binary heaps d-ary heaps binomial heaps Fibonacci
More informationCOMP Analysis of Algorithms & Data Structures
COMP 3170 - Analysis of Algorithms & Data Structures Shahin Kamali Binomial Heaps CLRS 6.1, 6.2, 6.3 University of Manitoba Priority queues A priority queue is an abstract data type formed by a set S of
More informationRecall: Data Flow Analysis. Data Flow Analysis Recall: Data Flow Equations. Forward Data Flow, Again
Data Flow Analysis 15-745 3/24/09 Recall: Data Flow Analysis A framework for proving facts about program Reasons about lots of little facts Little or no interaction between facts Works best on properties
More informationTHE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE
THE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE GÜNTER ROTE Abstract. A salesperson wants to visit each of n objects that move on a line at given constant speeds in the shortest possible time,
More informationSET 1C Binary Trees. 2. (i) Define the height of a binary tree or subtree and also define a height balanced (AVL) tree. (2)
SET 1C Binary Trees 1. Construct a binary tree whose preorder traversal is K L N M P R Q S T and inorder traversal is N L K P R M S Q T 2. (i) Define the height of a binary tree or subtree and also define
More informationA Semantic Framework for Program Debugging
A Semantic Framework for Program Debugging State Key Laboratory of Software Development Environment Beihang University July 3, 2013 Outline 1 Introduction 2 The Key Points 3 A Structural Operational Semantics
More informationDecidability and Recursive Languages
Decidability and Recursive Languages Let L (Σ { }) be a language, i.e., a set of strings of symbols with a finite length. For example, {0, 01, 10, 210, 1010,...}. Let M be a TM such that for any string
More informationUNIT 2. Greedy Method GENERAL METHOD
UNIT 2 GENERAL METHOD Greedy Method Greedy is the most straight forward design technique. Most of the problems have n inputs and require us to obtain a subset that satisfies some constraints. Any subset
More informationCTL Model Checking. Goal Method for proving M sat σ, where M is a Kripke structure and σ is a CTL formula. Approach Model checking!
CMSC 630 March 13, 2007 1 CTL Model Checking Goal Method for proving M sat σ, where M is a Kripke structure and σ is a CTL formula. Approach Model checking! Mathematically, M is a model of σ if s I = M
More informationDesign and Analysis of Algorithms 演算法設計與分析. Lecture 8 November 16, 2016 洪國寶
Design and Analysis of Algorithms 演算法設計與分析 Lecture 8 November 6, 206 洪國寶 Outline Review Amortized analysis Advanced data structures Binary heaps Binomial heaps Fibonacci heaps Data structures for disjoint
More informationMaximum Contiguous Subsequences
Chapter 8 Maximum Contiguous Subsequences In this chapter, we consider a well-know problem and apply the algorithm-design techniques that we have learned thus far to this problem. While applying these
More informationHeaps
AdvancedAlgorithmics (4AP) Heaps Jaak Vilo 2009 Spring Jaak Vilo MTAT.03.190 Text Algorithms 1 Heaps http://en.wikipedia.org/wiki/category:heaps_(structure) Binary heap http://en.wikipedia.org/wiki/binary_heap
More informationPARELLIZATION OF DIJKSTRA S ALGORITHM: COMPARISON OF VARIOUS PRIORITY QUEUES
PARELLIZATION OF DIJKSTRA S ALGORITHM: COMPARISON OF VARIOUS PRIORITY QUEUES WIKTOR JAKUBIUK, KESHAV PURANMALKA 1. Introduction Dijkstra s algorithm solves the single-sourced shorest path problem on a
More informationPriority Queues 9/10. Binary heaps Leftist heaps Binomial heaps Fibonacci heaps
Priority Queues 9/10 Binary heaps Leftist heaps Binomial heaps Fibonacci heaps Priority queues are important in, among other things, operating systems (process control in multitasking systems), search
More informationMarkov Decision Processes
Markov Decision Processes Robert Platt Northeastern University Some images and slides are used from: 1. CS188 UC Berkeley 2. RN, AIMA Stochastic domains Image: Berkeley CS188 course notes (downloaded Summer
More informationQ1. [?? pts] Search Traces
CS 188 Spring 2010 Introduction to Artificial Intelligence Midterm Exam Solutions Q1. [?? pts] Search Traces Each of the trees (G1 through G5) was generated by searching the graph (below, left) with a
More informationProject Management Professional (PMP) Exam Prep Course 06 - Project Time Management
Project Management Professional (PMP) Exam Prep Course 06 - Project Time Management Slide 1 Looking Glass Development, LLC (303) 663-5402 / (888) 338-7447 4610 S. Ulster St. #150 Denver, CO 80237 information@lookingglassdev.com
More informationOn the Optimality of a Family of Binary Trees Techical Report TR
On the Optimality of a Family of Binary Trees Techical Report TR-011101-1 Dana Vrajitoru and William Knight Indiana University South Bend Department of Computer and Information Sciences Abstract In this
More informationHeaps. Heap/Priority queue. Binomial heaps: Advanced Algorithmics (4AP) Heaps Binary heap. Binomial heap. Jaak Vilo 2009 Spring
.0.00 Heaps http://en.wikipedia.org/wiki/category:heaps_(structure) Advanced Algorithmics (4AP) Heaps Jaak Vilo 00 Spring Binary heap http://en.wikipedia.org/wiki/binary_heap Binomial heap http://en.wikipedia.org/wiki/binomial_heap
More informationLecture 5: Tuesday, January 27, Peterson s Algorithm satisfies the No Starvation property (Theorem 1)
Com S 611 Spring Semester 2015 Advanced Topics on Distributed and Concurrent Algorithms Lecture 5: Tuesday, January 27, 2015 Instructor: Soma Chaudhuri Scribe: Nik Kinkel 1 Introduction This lecture covers
More informationData Structures and Algorithms February 10, 2007 Pennsylvania State University CSE 465 Professors Sofya Raskhodnikova & Adam Smith Handout 10
Data Structures and Algorithms February 10, 2007 Pennsylvania State University CSE 465 Professors Sofya Raskhodnikova & Adam Smith Handout 10 Practice Exam 1 Do not open this exam booklet until you are
More informationHeap Building Bounds
Heap Building Bounds Zhentao Li 1 and Bruce A. Reed 2 1 School of Computer Science, McGill University zhentao.li@mail.mcgill.ca 2 School of Computer Science, McGill University breed@cs.mcgill.ca Abstract.
More informationLecture 14: Basic Fixpoint Theorems (cont.)
Lecture 14: Basic Fixpoint Theorems (cont) Predicate Transformers Monotonicity and Continuity Existence of Fixpoints Computing Fixpoints Fixpoint Characterization of CTL Operators 1 2 E M Clarke and E
More informationAdvanced Algorithmics (4AP) Heaps
Advanced Algorithmics (4AP) Heaps Jaak Vilo 2009 Spring Jaak Vilo MTAT.03.190 Text Algorithms 1 Heaps http://en.wikipedia.org/wiki/category:heaps_(structure) Binary heap http://en.wikipedia.org/wiki/binary
More informationDecision Trees with Minimum Average Depth for Sorting Eight Elements
Decision Trees with Minimum Average Depth for Sorting Eight Elements Hassan AbouEisha, Igor Chikalov, Mikhail Moshkov Computer, Electrical and Mathematical Sciences and Engineering Division, King Abdullah
More informationNode betweenness centrality: the definition.
Brandes algorithm These notes supplement the notes and slides for Task 11. They do not add any new material, but may be helpful in understanding the Brandes algorithm for calculating node betweenness centrality.
More informationPrinciples of Program Analysis: Algorithms
Principles of Program Analysis: Algorithms Transparencies based on Chapter 6 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag 2005. c
More informationMax Registers, Counters and Monotone Circuits
James Aspnes 1 Hagit Attiya 2 Keren Censor 2 1 Yale 2 Technion Counters Model Collects Our goal: build a cheap counter for an asynchronous shared-memory system. Two operations: increment and read. Read
More informationOutline for this Week
Binomial Heaps Outline for this Week Binomial Heaps (Today) A simple, flexible, and versatile priority queue. Lazy Binomial Heaps (Today) A powerful building block for designing advanced data structures.
More informationFMCAD 2011 Effective Word-Level Interpolation for Software Verification
FMCAD 2011 Effective Word-Level Interpolation for Software Verification Alberto Griggio FBK-IRST Motivations Craig interpolation applied succesfully for Formal Verification of both hardware and software
More informationLecture l(x) 1. (1) x X
Lecture 14 Agenda for the lecture Kraft s inequality Shannon codes The relation H(X) L u (X) = L p (X) H(X) + 1 14.1 Kraft s inequality While the definition of prefix-free codes is intuitively clear, we
More informationIEOR E4004: Introduction to OR: Deterministic Models
IEOR E4004: Introduction to OR: Deterministic Models 1 Dynamic Programming Following is a summary of the problems we discussed in class. (We do not include the discussion on the container problem or the
More informationFibonacci Heaps Y Y o o u u c c an an s s u u b b m miitt P P ro ro b blle e m m S S et et 3 3 iin n t t h h e e b b o o x x u u p p fro fro n n tt..
Fibonacci Heaps You You can can submit submit Problem Problem Set Set 3 in in the the box box up up front. front. Outline for Today Review from Last Time Quick refresher on binomial heaps and lazy binomial
More informationIntroduction to Fall 2007 Artificial Intelligence Final Exam
NAME: SID#: Login: Sec: 1 CS 188 Introduction to Fall 2007 Artificial Intelligence Final Exam You have 180 minutes. The exam is closed book, closed notes except a two-page crib sheet, basic calculators
More informationThe potential function φ for the amortized analysis of an operation on Fibonacci heap at time (iteration) i is given by the following equation:
Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 01 Advanced Data Structures
More informationFinding optimal arbitrage opportunities using a quantum annealer
Finding optimal arbitrage opportunities using a quantum annealer White Paper Finding optimal arbitrage opportunities using a quantum annealer Gili Rosenberg Abstract We present two formulations for finding
More informationYao s Minimax Principle
Complexity of algorithms The complexity of an algorithm is usually measured with respect to the size of the input, where size may for example refer to the length of a binary word describing the input,
More informationOptimal Satisficing Tree Searches
Optimal Satisficing Tree Searches Dan Geiger and Jeffrey A. Barnett Northrop Research and Technology Center One Research Park Palos Verdes, CA 90274 Abstract We provide an algorithm that finds optimal
More informationThe Software Engineering Discipline. Computer Aided Software Engineering (CASE) tools. Chapter 7: Software Engineering
Chapter 7: Software Engineering Computer Science: An Overview Tenth Edition by J. Glenn Brookshear Chapter 7: Software Engineering 7.1 The Software Engineering Discipline 7.2 The Software Life Cycle 7.3
More informationAlgorithmic Game Theory and Applications. Lecture 11: Games of Perfect Information
Algorithmic Game Theory and Applications Lecture 11: Games of Perfect Information Kousha Etessami finite games of perfect information Recall, a perfect information (PI) game has only 1 node per information
More informationHomework #4. CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class
Homework #4 CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class o Grades depend on neatness and clarity. o Write your answers with enough detail about your approach and concepts
More informationEssays on Some Combinatorial Optimization Problems with Interval Data
Essays on Some Combinatorial Optimization Problems with Interval Data a thesis submitted to the department of industrial engineering and the institute of engineering and sciences of bilkent university
More informationAn Optimal Algorithm for Finding All the Jumps of a Monotone Step-Function. Stutistics Deportment, Tel Aoio Unioersitv, Tel Aoiu, Isrue169978
An Optimal Algorithm for Finding All the Jumps of a Monotone Step-Function REFAEL HASSIN AND NIMROD MEGIDDO* Stutistics Deportment, Tel Aoio Unioersitv, Tel Aoiu, Isrue169978 Received July 26, 1983 The
More informationSemantics and Verification of Software
Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ws-1718/sv-sw/ Recap: CCPOs and Continuous Functions
More informationSAT and DPLL. Introduction. Preliminaries. Normal forms DPLL. Complexity. Espen H. Lian. DPLL Implementation. Bibliography.
SAT and Espen H. Lian Ifi, UiO Implementation May 4, 2010 Espen H. Lian (Ifi, UiO) SAT and May 4, 2010 1 / 59 Espen H. Lian (Ifi, UiO) SAT and May 4, 2010 2 / 59 Introduction Introduction SAT is the problem
More informationOutline for this Week
Binomial Heaps Outline for this Week Binomial Heaps (Today) A simple, fexible, and versatile priority queue. Lazy Binomial Heaps (Today) A powerful building block for designing advanced data structures.
More informationWhite-Box Testing Techniques I
White-Box Testing Techniques I Software Testing and Verification Lecture 7 Prepared by Stephen M. Thebaut, Ph.D. University of Florida Definition of White-Box Testing Testing based on analysis of internal
More informationLecture 8 Feb 16, 2017
CS 4: Advanced Algorithms Spring 017 Prof. Jelani Nelson Lecture 8 Feb 16, 017 Scribe: Tiffany 1 Overview In the last lecture we covered the properties of splay trees, including amortized O(log n) time
More informationCEC login. Student Details Name SOLUTIONS
Student Details Name SOLUTIONS CEC login Instructions You have roughly 1 minute per point, so schedule your time accordingly. There is only one correct answer per question. Good luck! Question 1. Searching
More informationWhite-Box Testing Techniques I
White-Box Testing Techniques I Software Testing and Verification Lecture 7 Prepared by Stephen M. Thebaut, Ph.D. University of Florida Definition of White-Box Testing Testing based on analysis of internal
More informationCSCE 750, Fall 2009 Quizzes with Answers
CSCE 750, Fall 009 Quizzes with Answers Stephen A. Fenner September 4, 011 1. Give an exact closed form for Simplify your answer as much as possible. k 3 k+1. We reduce the expression to a form we ve already
More informationIntroduction to Greedy Algorithms: Huffman Codes
Introduction to Greedy Algorithms: Huffman Codes Yufei Tao ITEE University of Queensland In computer science, one interesting method to design algorithms is to go greedy, namely, keep doing the thing that
More informationIteration. The Cake Eating Problem. Discount Factors
18 Value Function Iteration Lab Objective: Many questions have optimal answers that change over time. Sequential decision making problems are among this classification. In this lab you we learn how to
More informationIssues. Senate (Total = 100) Senate Group 1 Y Y N N Y 32 Senate Group 2 Y Y D N D 16 Senate Group 3 N N Y Y Y 30 Senate Group 4 D Y N D Y 22
1. Every year, the United States Congress must approve a budget for the country. In order to be approved, the budget must get a majority of the votes in the Senate, a majority of votes in the House, and
More informationuseful than solving these yourself, writing up your solution and then either comparing your
CSE 441T/541T: Advanced Algorithms Fall Semester, 2003 September 9, 2004 Practice Problems Solutions Here are the solutions for the practice problems. However, reading these is far less useful than solving
More informationPractical SAT Solving
Practical SAT Solving Lecture 1 Carsten Sinz, Tomáš Balyo April 18, 2016 NSTITUTE FOR THEORETICAL COMPUTER SCIENCE KIT University of the State of Baden-Wuerttemberg and National Laboratory of the Helmholtz
More informationSingle Machine Inserted Idle Time Scheduling with Release Times and Due Dates
Single Machine Inserted Idle Time Scheduling with Release Times and Due Dates Natalia Grigoreva Department of Mathematics and Mechanics, St.Petersburg State University, Russia n.s.grig@gmail.com Abstract.
More informationCS 106X Lecture 11: Sorting
CS 106X Lecture 11: Sorting Friday, February 3, 2017 Programming Abstractions (Accelerated) Winter 2017 Stanford University Computer Science Department Lecturer: Chris Gregg reading: Programming Abstractions
More informationSAT and DPLL. Espen H. Lian. May 4, Ifi, UiO. Espen H. Lian (Ifi, UiO) SAT and DPLL May 4, / 59
SAT and DPLL Espen H. Lian Ifi, UiO May 4, 2010 Espen H. Lian (Ifi, UiO) SAT and DPLL May 4, 2010 1 / 59 Normal forms Normal forms DPLL Complexity DPLL Implementation Bibliography Espen H. Lian (Ifi, UiO)
More informationCOMP251: Amortized Analysis
COMP251: Amortized Analysis Jérôme Waldispühl School of Computer Science McGill University Based on (Cormen et al., 2009) T n = 2 % T n 5 + n( What is the height of the recursion tree? log ( n log, n log
More informationThe suffix binary search tree and suffix AVL tree
Journal of Discrete Algorithms 1 (2003) 387 408 www.elsevier.com/locate/jda The suffix binary search tree and suffix AVL tree Robert W. Irving, Lorna Love Department of Computing Science, University of
More informationPASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year
PASS4TEST IT Certification Guaranteed, The Easy Way! \ http://www.pass4test.com We offer free update service for one year Exam : BH0-010 Title : BCS Certified Tester Foundation Level 2011 syllabus Vendors
More informationMAC Learning Objectives. Learning Objectives (Cont.)
MAC 1140 Module 12 Introduction to Sequences, Counting, The Binomial Theorem, and Mathematical Induction Learning Objectives Upon completing this module, you should be able to 1. represent sequences. 2.
More informationRecitation 1. Solving Recurrences. 1.1 Announcements. Welcome to 15210!
Recitation 1 Solving Recurrences 1.1 Announcements Welcome to 1510! The course website is http://www.cs.cmu.edu/ 1510/. It contains the syllabus, schedule, library documentation, staff contact information,
More information1 Binomial Tree. Structural Properties:
Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 0 Advanced Data Structures
More informationAction Selection for MDPs: Anytime AO* vs. UCT
Action Selection for MDPs: Anytime AO* vs. UCT Blai Bonet 1 and Hector Geffner 2 1 Universidad Simón Boĺıvar 2 ICREA & Universitat Pompeu Fabra AAAI, Toronto, Canada, July 2012 Online MDP Planning and
More informationSemantics with Applications 2b. Structural Operational Semantics
Semantics with Applications 2b. Structural Operational Semantics Hanne Riis Nielson, Flemming Nielson (thanks to Henrik Pilegaard) [SwA] Hanne Riis Nielson, Flemming Nielson Semantics with Applications:
More informationLattice-Theoretic Framework for Data-Flow Analysis. Defining Available Expressions Analysis. Reality Check! Reaching Constants
Lattice-Theoretic Framework for Data-Flow Analysis Defining Available Expressions Analysis Last time Generalizing data-flow analysis Today Finish generalizing data-flow analysis Reaching Constants introduction
More informationWhat is Greedy Approach? Control abstraction for Greedy Method. Three important activities
0-0-07 What is Greedy Approach? Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each decision is locally optimal. These locally optimal solutions will finally
More informationThe exam is closed book, closed calculator, and closed notes except your three crib sheets.
CS 188 Spring 2016 Introduction to Artificial Intelligence Final V2 You have approximately 2 hours and 50 minutes. The exam is closed book, closed calculator, and closed notes except your three crib sheets.
More information2 all subsequent nodes. 252 all subsequent nodes. 401 all subsequent nodes. 398 all subsequent nodes. 330 all subsequent nodes
¼ À ÈÌ Ê ½¾ ÈÊÇ Ä ÅË ½µ ½¾º¾¹½ ¾µ ½¾º¾¹ µ ½¾º¾¹ µ ½¾º¾¹ µ ½¾º ¹ µ ½¾º ¹ µ ½¾º ¹¾ µ ½¾º ¹ µ ½¾¹¾ ½¼µ ½¾¹ ½ (1) CLR 12.2-1 Based on the structure of the binary tree, and the procedure of Tree-Search, any
More informationFE501 Stochastic Calculus for Finance 1.5:0:1.5
Descriptions of Courses FE501 Stochastic Calculus for Finance 1.5:0:1.5 This course introduces martingales or Markov properties of stochastic processes. The most popular example of stochastic process is
More informationTesting Systematic Code Coverage Techniques
Testing Systematic Code Coverage Techniques By Linda Westfall www.westfallteam.com When performing structural testing of the code, the term paths refer to control flow sequences through the internal structure
More informationLecture 5 Leadership and Reputation
Lecture 5 Leadership and Reputation Reputations arise in situations where there is an element of repetition, and also where coordination between players is possible. One definition of leadership is that
More informationMSU CSE Spring 2011 Exam 2-ANSWERS
MSU CSE 260-001 Spring 2011 Exam 2-NSWERS Name: This is a closed book exam, with 9 problems on 5 pages totaling 100 points. Integer ivision/ Modulo rithmetic 1. We can add two numbers in base 2 by using
More informationSequential Decision Making
Sequential Decision Making Dynamic programming Christos Dimitrakakis Intelligent Autonomous Systems, IvI, University of Amsterdam, The Netherlands March 18, 2008 Introduction Some examples Dynamic programming
More informationCOST MANAGEMENT IN CONSTRUCTION PROJECTS WITH THE APPROACH OF COST-TIME BALANCING
ISSN: 0976-3104 Lou et al. ARTICLE OPEN ACCESS COST MANAGEMENT IN CONSTRUCTION PROJECTS WITH THE APPROACH OF COST-TIME BALANCING Ashkan Khoda Bandeh Lou *, Alireza Parvishi, Ebrahim Javidi Faculty Of Engineering,
More informationUNIT VI TREES. Marks - 14
UNIT VI TREES Marks - 14 SYLLABUS 6.1 Non-linear data structures 6.2 Binary trees : Complete Binary Tree, Basic Terms: level number, degree, in-degree and out-degree, leaf node, directed edge, path, depth,
More informationTo earn the extra credit, one of the following has to hold true. Please circle and sign.
CS 188 Fall 2018 Introduction to Artificial Intelligence Practice Midterm 1 To earn the extra credit, one of the following has to hold true. Please circle and sign. A I spent 2 or more hours on the practice
More informationDiscrete Mathematics for CS Spring 2008 David Wagner Final Exam
CS 70 Discrete Mathematics for CS Spring 2008 David Wagner Final Exam PRINT your name:, (last) SIGN your name: (first) PRINT your Unix account login: Your section time (e.g., Tue 3pm): Name of the person
More informationAVL Trees. The height of the left subtree can differ from the height of the right subtree by at most 1.
AVL Trees In order to have a worst case running time for insert and delete operations to be O(log n), we must make it impossible for there to be a very long path in the binary search tree. The first balanced
More informationStochastic Approximation Algorithms and Applications
Harold J. Kushner G. George Yin Stochastic Approximation Algorithms and Applications With 24 Figures Springer Contents Preface and Introduction xiii 1 Introduction: Applications and Issues 1 1.0 Outline
More information6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE
6.21 DYNAMIC PROGRAMMING LECTURE LECTURE OUTLINE Deterministic finite-state DP problems Backward shortest path algorithm Forward shortest path algorithm Shortest path examples Alternative shortest path
More informationCopyright 1973, by the author(s). All rights reserved.
Copyright 1973, by the author(s). All rights reserved. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are
More informationTDT4171 Artificial Intelligence Methods
TDT47 Artificial Intelligence Methods Lecture 7 Making Complex Decisions Norwegian University of Science and Technology Helge Langseth IT-VEST 0 helgel@idi.ntnu.no TDT47 Artificial Intelligence Methods
More information2) What is algorithm?
2) What is algorithm? Step by step procedure designed to perform an operation, and which (like a map or flowchart) will lead to the sought result if followed correctly. Algorithms have a definite beginning
More informationDynamic Programming: An overview. 1 Preliminaries: The basic principle underlying dynamic programming
Dynamic Programming: An overview These notes summarize some key properties of the Dynamic Programming principle to optimize a function or cost that depends on an interval or stages. This plays a key role
More information