COMPUTER SCIENCE 20, SPRING 2014 Homework Problems Recursive Definitions, Structural Induction, States and Invariants

Size: px
Start display at page:

Download "COMPUTER SCIENCE 20, SPRING 2014 Homework Problems Recursive Definitions, Structural Induction, States and Invariants"

Transcription

1 COMPUTER SCIENCE 20, SPRING 2014 Homework Problems Recursive Definitions, Structural Induction, States and Invariants Due Wednesday March 12, CS 20 students should bring a hard copy to class. CSCI E-120 students should submit an electronic copy. Note: Use the following definition of the set of valid integer binary trees T. Base Cases: ɛ T Constructor Case: If x Z, l T, r T, then (x, l, r) T A node of a tree is any element in T that is a three-tuple, that is, it is of the form (x, l, r). This means that ɛ T is not a node. If z = (x, l, r) is a node, then l and r are child nodes of z, if they are non-empty. 1. The nodes in a tree obey the heap property if, for every node z in the tree, the value in z, that is x, is at least as big as the value in each of z s children (the tree in module 15 obeys the heap property). Prove that if a binary tree has the heap property, then the value in the root of the tree is at least as large as the value in any node of the tree. Proof by induction: Base Case: A tree of size 1, for which this property is trivially true. (It is also possible to induct on the empty tree) Inductive Hypothesis: For all trees with n nodes in it, the claim in question holds. Now we want to show that the claim holds for a tree T of size n+1 that has the heap property. Any such tree can be written as (x, l, r) by definition, with x being the root node. For the rest of this proof, we are assuming l and r are non-empty (if one or both is empty, we may ignore them as then there are no values to compare our root node to). Since T has the heap property, the trees l and r must also have the heap property. We also know that l and r are both at most size n, since T itself is only size n

2 By the inductive hypothesis, we know that the root nodes l 0 and r 0 are at least as large as any other nodes in l and r respectively. Then by the heap property, x l 0 and x r 0, so x must also be at least as large as any other nodes in l and r. Thus the root of the tree T is at least as large as any value in any of its nodes. 2. A complete binary tree (example below) is a binary tree in which every level, except possibly the last level, is completely filled, and all nodes are as far left as possible. Also, remember that an internal node is a node that has children. Prove that the number of internal nodes in a complete binary tree with n nodes is n/2 where x equals the largest integer that is not greater than x. Base case: A tree of size 1, for which there are 1/2 = 0 internal nodes. Inductive Hypothesis: A complete binary tree with n nodes has n/2 internal nodes. We will consider two cases: n is odd and n is even. First we shall prove that n is odd if and only if every node has either 0 or 2 children, and n is even iff there is one node with one child. Note that in a complete binary tree, there can be at most one node with only one child. Then, proof: Suppose our tree s nodes each have either 0 or 2 children. We can count the number of nodes in a tree by starting at the root and adding in its number of children, and then proceeding as such with each of those children. However, since every node can only have 2 or 0 children, we will only ever add 2 or 0 to our initial root count of 1, and so n is odd. If the tree has one node with one child, then we can apply the same process, but at one point we will only add 1 node, and so n will be even. Now consider the two cases n odd and n even: n is odd. Since every node in the tree with n nodes has 0 or 2 children, the complete tree of size n + 1 will create a node with 1 child, creating 2

3 one more internal node. Since by the inductive hypothesis a tree of size n has n/2 = (n 1)/2 internal nodes for odd n, the tree of size n + 1 will have (n 1)/2 + 1 = (n + 1)/2 = (n + 1)/2 internal nodes, as n + 1 is even. n is even. Then the complete tree of size n + 1 will add on another child to the node that only has 1 child, so no new internal nodes are created. Then it will still have n/2 internal nodes by the inductive hypothesis. However, this is equal to (n + 1)/2 for even n, which is our desired result. Since we have showed the tree of size n + 1 has (n + 1)/2 internal nodes, we see by induction that the claim is true for all n. 3. (From Meyer, problem 6.6) Let m, n Z where m 0 and n 0. Then, let s define a set of integers, L m,n, recursively as follows: Base cases: m, n L m,n Constructor cases: If j, k L m,n, then (a) j L m,n. and (b) j + k L m,n Let L be an abbreviation for L m,n for the rest of this problem. (a) Prove by structural induction that every common divisor of m and n also divides every member of L. (b) Prove that any integer multiple of an element of L is also in L. (c) Show that if j, k L and k 0 then the remainder of j divided by k is also in L; that is, that rem(j, k) L. (a) Proof by induction. Base case: m, n L m,n. m and n are obviously both divisible by all of their common divisors. For the induction, assume all current members of L m,n are divisible by all common divisors of m and n, and then show that for any new element we can add, this property still holds. The constructor cases are then: j for j L m,n. j is divisible by anything j is. By the inductive hypothesis, j is divisible by all common divisors of m and n, and so j is as well. 3

4 j + k for j, k L m,n. For any common divisor x of m and n, we can write j = ax, k = bx for some integers a, b, since j and k are both divisible by x. Then j +k = x(a+b), and so j +k is divisible by x as well. This holds for any common divisor x, so j + k is divisible by any common divisor of m and n Thus any element of L m,n is divisible by all common divisors of m and n. (b) Consider any element x L. We wish to show that for any integer a, ax L. We can do a proof by induction here: Base case: x, x L. This can also be written as 1 x and 1 x are in L. Inductive hypothesis: nx L for some integer n. We then see (n 1)x = nx + ( x) and (n + 1)x = nx + x. Since nx, x, x L by the inductive hypothesis and base case, it follows that (n 1)x, (n + 1)x L. We can reach every integer multiple of x in this fashion, and so the claim holds. (c) The value rem(j, k) is defined such that j = nk + rem(j, k) for some integer n such that 0 < rem(j, k) < k. We already showed in part b that nk L if k L, and so j nk L by the second constructor case. This is equal to rem(j, k), and so rem(j, k) L. 4. (From Sipser, exercise 1.6) Draw state machines that only accept strings in the following set. Assume that the alphabet is Σ = {0, 1}; that is, that all strings s Σ. (Bonus point(s) if you draw your raw state machines in LaTeX; check out the TikZ package to do this.) {w : w contains the substring 0101, i.e. w = x0101y for some x and y} 4

5 Note: this is a nondeterministic machine, meaning that it accepts a string as long as there exists a path from the start state to the accept state. The arrow indicates the start state, and the double-circles indicate the accept state. 5. (From Meyer, problem 5.29) A robot named Wall-E wanders around a twodimensional grid. He starts at (0,0) and is allowed to take four different types of steps: (a) (+2,-1) (b) (+1, -2) (c) (+1, +1) (d) (-3, 0) For example, Wall-E might take the following stroll. The types of his steps are denoted by each arrow s subscript: (0, 0) a (2, 1) c (3, 0) b (4, 2) d (1, 2)... Wall-E s true love, the fashionable and high-powered robot, Eve, awaits at (0,2). (a) Describe a state machine model of this problem. (b) Will Wall-E ever find his true love? Either find a path from Wall-E to Eve or use the Invariant Principle to prove that no such path exists. (a) In our state machine model, every state takes the form (x, y). The start state is (0, 0), and the possible transitions out of a state (x, y) are to (x + 2, y 1), (x + 1, y 2), (x + 1, y + 1), (x 3, y). (b) He will not. Consider if we take all of the possible states and take the x and y coordinates mod 3. Then the possible transitions are equivalent to: i. (+2, 1) (+2, +2) (mod 3) ii. (+1, 2) (+1, +1) (mod 3) iii. (+1, +1) (+1, +1) (mod 3) iv. ( 3, +0) (+0, +0) (mod 3) We then propose the following invariant: for any state (x, y) x mod 3 = y mod 3 We see that it is true for the start state (0, 0), and all of the transitions preserve this invariant, as they add the same amount to both the x and y coordinates mod 3. However, our desired state (0, 2) does not satisfy this invariant, and so it must be impossible to reach. 5

Structural Induction

Structural Induction Structural Induction Jason Filippou CMSC250 @ UMCP 07-05-2016 Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 1 / 26 Outline 1 Recursively defined structures 2 Proofs Binary Trees Jason

More information

Lecture 5: Tuesday, January 27, Peterson s Algorithm satisfies the No Starvation property (Theorem 1)

Lecture 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 information

1 Solutions to Tute09

1 Solutions to Tute09 s to Tute0 Questions 4. - 4. are straight forward. Q. 4.4 Show that in a binary tree of N nodes, there are N + NULL pointers. Every node has outgoing pointers. Therefore there are N pointers. Each node,

More information

AVL Trees. The height of the left subtree can differ from the height of the right subtree by at most 1.

AVL 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 information

MSU CSE Spring 2011 Exam 2-ANSWERS

MSU 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 information

CSE 21 Winter 2016 Homework 6 Due: Wednesday, May 11, 2016 at 11:59pm. Instructions

CSE 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 information

Introduction to Greedy Algorithms: Huffman Codes

Introduction 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 information

Practice Second Midterm Exam II

Practice Second Midterm Exam II CS13 Handout 34 Fall 218 November 2, 218 Practice Second Midterm Exam II This exam is closed-book and closed-computer. You may have a double-sided, 8.5 11 sheet of notes with you when you take this exam.

More information

Notes on Natural Logic

Notes on Natural Logic Notes on Natural Logic Notes for PHIL370 Eric Pacuit November 16, 2012 1 Preliminaries: Trees A tree is a structure T = (T, E), where T is a nonempty set whose elements are called nodes and E is a relation

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 3 Tuesday, February 2, 2016 1 Inductive proofs, continued Last lecture we considered inductively defined sets, and

More information

SET 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. 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 information

Stanford University, CS 106X Homework Assignment 5: Priority Queue Binomial Heap Optional Extension

Stanford University, CS 106X Homework Assignment 5: Priority Queue Binomial Heap Optional Extension Stanford University, CS 106X Homework Assignment 5: Priority Queue Binomial Heap Optional Extension Extension description by Jerry Cain. This document describes an optional extension to the assignment.

More information

Homework #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 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 information

Decidability and Recursive Languages

Decidability 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 information

Heap Building Bounds

Heap 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 information

CS360 Homework 14 Solution

CS360 Homework 14 Solution CS360 Homework 14 Solution Markov Decision Processes 1) Invent a simple Markov decision process (MDP) with the following properties: a) it has a goal state, b) its immediate action costs are all positive,

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 3 Tuesday, January 30, 2018 1 Inductive sets Induction is an important concept in the theory of programming language.

More information

Lecture l(x) 1. (1) x X

Lecture 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 information

On the Optimality of a Family of Binary Trees Techical Report TR

On 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 information

An effective perfect-set theorem

An effective perfect-set theorem An effective perfect-set theorem David Belanger, joint with Keng Meng (Selwyn) Ng CTFM 2016 at Waseda University, Tokyo Institute for Mathematical Sciences National University of Singapore The perfect

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms Instructor: Sharma Thankachan Lecture 9: Binomial Heap Slides modified from Dr. Hon, with permission 1 About this lecture Binary heap supports various operations quickly:

More information

Initializing A Max Heap. Initializing A Max Heap

Initializing A Max Heap. Initializing A Max Heap Initializing A Max Heap 3 4 5 6 7 8 70 8 input array = [-,,, 3, 4, 5, 6, 7, 8,, 0, ] Initializing A Max Heap 3 4 5 6 7 8 70 8 Start at rightmost array position that has a child. Index is n/. Initializing

More information

Binary and Binomial Heaps. Disclaimer: these slides were adapted from the ones by Kevin Wayne

Binary and Binomial Heaps. Disclaimer: these slides were adapted from the ones by Kevin Wayne Binary and Binomial Heaps Disclaimer: these slides were adapted from the ones by Kevin Wayne Priority Queues Supports the following operations. Insert element x. Return min element. Return and delete minimum

More information

Math 546 Homework Problems. Due Wednesday, January 25. This homework has two types of problems.

Math 546 Homework Problems. Due Wednesday, January 25. This homework has two types of problems. Math 546 Homework 1 Due Wednesday, January 25. This homework has two types of problems. 546 Problems. All students (students enrolled in 546 and 701I) are required to turn these in. 701I Problems. Only

More information

1 Binomial Tree. Structural Properties:

1 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 information

Algebra homework 8 Homomorphisms, isomorphisms

Algebra homework 8 Homomorphisms, isomorphisms MATH-UA.343.005 T.A. Louis Guigo Algebra homework 8 Homomorphisms, isomorphisms For every n 1 we denote by S n the n-th symmetric group. Exercise 1. Consider the following permutations: ( ) ( 1 2 3 4 5

More information

> asympt( ln( n! ), n ); n 360n n

> asympt( ln( n! ), n ); n 360n n 8.4 Heap Sort (heapsort) We will now look at our first (n ln(n)) algorithm: heap sort. It will use a data structure that we have already seen: a binary heap. 8.4.1 Strategy and Run-time Analysis Given

More information

The potential function φ for the amortized analysis of an operation on Fibonacci heap at time (iteration) i is given by the following equation:

The 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 information

Heaps. c P. Flener/IT Dept/Uppsala Univ. AD1, FP, PK II Heaps 1

Heaps. c P. Flener/IT Dept/Uppsala Univ. AD1, FP, PK II Heaps 1 Heaps (Version of 21 November 2005) A min-heap (resp. max-heap) is a data structure with fast extraction of the smallest (resp. largest) item (in O(lg n) time), as well as fast insertion (also in O(lg

More information

Priority Queues. Fibonacci Heap

Priority Queues. Fibonacci Heap ibonacci Heap hans to Sartaj Sahni for the original version of the slides Operation mae-heap insert find-min delete-min union decrease-ey delete Priority Queues Lined List Binary Binomial Heaps ibonacci

More information

Algorithmic Game Theory and Applications. Lecture 11: Games of Perfect Information

Algorithmic 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 information

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 15 Adaptive Huffman Coding Part I Huffman code are optimal for a

More information

Outline for this Week

Outline 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 information

NOTES ON FIBONACCI TREES AND THEIR OPTIMALITY* YASUICHI HORIBE INTRODUCTION 1. FIBONACCI TREES

NOTES ON FIBONACCI TREES AND THEIR OPTIMALITY* YASUICHI HORIBE INTRODUCTION 1. FIBONACCI TREES 0#0# NOTES ON FIBONACCI TREES AND THEIR OPTIMALITY* YASUICHI HORIBE Shizuoka University, Hamamatsu, 432, Japan (Submitted February 1982) INTRODUCTION Continuing a previous paper [3], some new observations

More information

Lecture 2: The Simple Story of 2-SAT

Lecture 2: The Simple Story of 2-SAT 0510-7410: Topics in Algorithms - Random Satisfiability March 04, 2014 Lecture 2: The Simple Story of 2-SAT Lecturer: Benny Applebaum Scribe(s): Mor Baruch 1 Lecture Outline In this talk we will show that

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 2 Thursday, January 30, 2014 1 Expressing Program Properties Now that we have defined our small-step operational

More information

Discrete Mathematics for CS Spring 2008 David Wagner Final Exam

Discrete 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 information

*****CENTRAL LIMIT THEOREM (CLT)*****

*****CENTRAL LIMIT THEOREM (CLT)***** Sampling Distributions and CLT Day 5 *****CENTRAL LIMIT THEOREM (CLT)***** (One of the MOST important theorems in Statistics - KNOW AND UNDERSTAND THIS!!!!!!) Draw an SRS of size n from ANY population

More information

IEOR E4004: Introduction to OR: Deterministic Models

IEOR 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 information

Proof Techniques for Operational Semantics. Questions? Why Bother? Mathematical Induction Well-Founded Induction Structural Induction

Proof Techniques for Operational Semantics. Questions? Why Bother? Mathematical Induction Well-Founded Induction Structural Induction Proof Techniques for Operational Semantics Announcements Homework 1 feedback/grades posted Homework 2 due tonight at 11:55pm Meeting 10, CSCI 5535, Spring 2010 2 Plan Questions? Why Bother? Mathematical

More information

Outline for this Week

Outline 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 information

LECTURE 2: MULTIPERIOD MODELS AND TREES

LECTURE 2: MULTIPERIOD MODELS AND TREES LECTURE 2: MULTIPERIOD MODELS AND TREES 1. Introduction One-period models, which were the subject of Lecture 1, are of limited usefulness in the pricing and hedging of derivative securities. In real-world

More information

Design and Analysis of Algorithms 演算法設計與分析. Lecture 9 November 19, 2014 洪國寶

Design 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 information

Mathematics Notes for Class 12 chapter 1. Relations and Functions

Mathematics Notes for Class 12 chapter 1. Relations and Functions 1 P a g e Mathematics Notes for Class 12 chapter 1. Relations and Functions Relation If A and B are two non-empty sets, then a relation R from A to B is a subset of A x B. If R A x B and (a, b) R, then

More information

We begin, however, with the concept of prime factorization. Example: Determine the prime factorization of 12.

We begin, however, with the concept of prime factorization. Example: Determine the prime factorization of 12. Chapter 3: Factors and Products 3.1 Factors and Multiples of Whole Numbers In this chapter we will look at the topic of factors and products. In previous years, we examined these with only numbers, whereas

More information

5 Deduction in First-Order Logic

5 Deduction in First-Order Logic 5 Deduction in First-Order Logic The system FOL C. Let C be a set of constant symbols. FOL C is a system of deduction for the language L # C. Axioms: The following are axioms of FOL C. (1) All tautologies.

More information

A relation on 132-avoiding permutation patterns

A relation on 132-avoiding permutation patterns Discrete Mathematics and Theoretical Computer Science DMTCS vol. VOL, 205, 285 302 A relation on 32-avoiding permutation patterns Natalie Aisbett School of Mathematics and Statistics, University of Sydney,

More information

COMP Analysis of Algorithms & Data Structures

COMP 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 information

CS 4110 Programming Languages & Logics. Lecture 2 Introduction to Semantics

CS 4110 Programming Languages & Logics. Lecture 2 Introduction to Semantics CS 4110 Programming Languages & Logics Lecture 2 Introduction to Semantics 29 August 2012 Announcements 2 Wednesday Lecture Moved to Thurston 203 Foster Office Hours Today 11a-12pm in Gates 432 Mota Office

More information

Course Information and Introduction

Course Information and Introduction August 20, 2015 Course Information 1 Instructor : Email : arash.rafiey@indstate.edu Office : Root Hall A-127 Office Hours : Tuesdays 12:00 pm to 1:00 pm in my office (A-127) 2 Course Webpage : http://cs.indstate.edu/

More information

The Binomial Theorem and Consequences

The Binomial Theorem and Consequences The Binomial Theorem and Consequences Juris Steprāns York University November 17, 2011 Fermat s Theorem Pierre de Fermat claimed the following theorem in 1640, but the first published proof (by Leonhard

More information

CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS

CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS November 17, 2016. Name: ID: Instructions: Answer the questions directly on the exam pages. Show all your work for each question.

More information

2 Deduction in Sentential Logic

2 Deduction in Sentential Logic 2 Deduction in Sentential Logic Though we have not yet introduced any formal notion of deductions (i.e., of derivations or proofs), we can easily give a formal method for showing that formulas are tautologies:

More information

Binary Tree Applications

Binary Tree Applications Binary Tree Applications Lecture 32 Section 19.2 Robb T. Koether Hampden-Sydney College Wed, Apr 17, 2013 Robb T. Koether (Hampden-Sydney College) Binary Tree Applications Wed, Apr 17, 2013 1 / 46 1 Expression

More information

Fibonacci 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 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 information

Design and Analysis of Algorithms. Lecture 9 November 20, 2013 洪國寶

Design 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 information

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract Tug of War Game William Gasarch and ick Sovich and Paul Zimand October 6, 2009 To be written later Abstract Introduction Combinatorial games under auction play, introduced by Lazarus, Loeb, Propp, Stromquist,

More information

Optimal Satisficing Tree Searches

Optimal 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 information

3/7/13. Binomial Tree. Binomial Tree. Binomial Tree. Binomial Tree. Number of nodes with respect to k? N(B o ) = 1 N(B k ) = 2 N(B k-1 ) = 2 k

3/7/13. Binomial Tree. Binomial Tree. Binomial Tree. Binomial Tree. Number of nodes with respect to k? N(B o ) = 1 N(B k ) = 2 N(B k-1 ) = 2 k //1 Adapted from: Kevin Wayne B k B k B k : a binomial tree with the addition of a left child with another binomial tree Number of nodes with respect to k? N(B o ) = 1 N(B k ) = 2 N( ) = 2 k B 1 B 2 B

More information

Fibonacci Heaps CLRS: Chapter 20 Last Revision: 21/09/04

Fibonacci Heaps CLRS: Chapter 20 Last Revision: 21/09/04 Fibonacci Heaps CLRS: Chapter 20 Last Revision: 21/09/04 1 Binary heap Binomial heap Fibonacci heap Procedure (worst-case) (worst-case) (amortized) Make-Heap Θ(1) Θ(1) Θ(1) Insert Θ(lg n) O(lg n) Θ(1)

More information

MAT385 Final (Spring 2009): Boolean Algebras, FSM, and old stuff

MAT385 Final (Spring 2009): Boolean Algebras, FSM, and old stuff MAT385 Final (Spring 2009): Boolean Algebras, FSM, and old stuff Name: Directions: Problems are equally weighted. Show your work! Answers without justification will likely result in few points. Your written

More information

Q1. [?? pts] Search Traces

Q1. [?? 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 information

On the Optimality of a Family of Binary Trees

On the Optimality of a Family of Binary Trees On the Optimality of a Family of Binary Trees Dana Vrajitoru Computer and Information Sciences Department Indiana University South Bend South Bend, IN 46645 Email: danav@cs.iusb.edu William Knight Computer

More information

arxiv: v1 [math.co] 31 Mar 2009

arxiv: v1 [math.co] 31 Mar 2009 A BIJECTION BETWEEN WELL-LABELLED POSITIVE PATHS AND MATCHINGS OLIVIER BERNARDI, BERTRAND DUPLANTIER, AND PHILIPPE NADEAU arxiv:0903.539v [math.co] 3 Mar 009 Abstract. A well-labelled positive path of

More information

Fundamental Algorithms - Surprise Test

Fundamental 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 information

Sequential allocation of indivisible goods

Sequential allocation of indivisible goods 1 / 27 Sequential allocation of indivisible goods Thomas Kalinowski Institut für Mathematik, Universität Rostock Newcastle Tuesday, January 22, 2013 joint work with... 2 / 27 Nina Narodytska Toby Walsh

More information

1.6 Heap ordered trees

1.6 Heap ordered trees 1.6 Heap ordered trees A heap ordered tree is a tree satisfying the following condition. The key of a node is not greater than that of each child if any In a heap ordered tree, we can not implement find

More information

Lecture 14: Basic Fixpoint Theorems (cont.)

Lecture 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 information

Data Structures. Binomial Heaps Fibonacci Heaps. Haim Kaplan & Uri Zwick December 2013

Data Structures. Binomial Heaps Fibonacci Heaps. Haim Kaplan & Uri Zwick December 2013 Data Structures Binomial Heaps Fibonacci Heaps Haim Kaplan & Uri Zwick December 13 1 Heaps / Priority queues Binary Heaps Binomial Heaps Lazy Binomial Heaps Fibonacci Heaps Insert Find-min Delete-min Decrease-key

More information

The exam is closed book, closed calculator, and closed notes except your three crib sheets.

The 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 information

CS792 Notes Henkin Models, Soundness and Completeness

CS792 Notes Henkin Models, Soundness and Completeness CS792 Notes Henkin Models, Soundness and Completeness Arranged by Alexandra Stefan March 24, 2005 These notes are a summary of chapters 4.5.1-4.5.5 from [1]. 1 Review indexed family of sets: A s, where

More information

Basic Data Structures. Figure 8.1 Lists, stacks, and queues. Terminology for Stacks. Terminology for Lists. Chapter 8: Data Abstractions

Basic 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 information

Ch 10 Trees. Introduction to Trees. Tree Representations. Binary Tree Nodes. Tree Traversals. Binary Search Trees

Ch 10 Trees. Introduction to Trees. Tree Representations. Binary Tree Nodes. Tree Traversals. Binary Search Trees Ch 10 Trees Introduction to Trees Tree Representations Binary Tree Nodes Tree Traversals Binary Search Trees 1 Binary Trees A binary tree is a finite set of elements called nodes. The set is either empty

More information

The Traveling Salesman Problem. Time Complexity under Nondeterminism. A Nondeterministic Algorithm for tsp (d)

The 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 information

TR : Knowledge-Based Rational Decisions and Nash Paths

TR : Knowledge-Based Rational Decisions and Nash Paths City University of New York (CUNY) CUNY Academic Works Computer Science Technical Reports Graduate Center 2009 TR-2009015: Knowledge-Based Rational Decisions and Nash Paths Sergei Artemov Follow this and

More information

CSCI 104 B-Trees (2-3, 2-3-4) and Red/Black Trees. Mark Redekopp David Kempe

CSCI 104 B-Trees (2-3, 2-3-4) and Red/Black Trees. Mark Redekopp David Kempe 1 CSCI 104 B-Trees (2-3, 2-3-4) and Red/Black Trees Mark Redekopp David Kempe 2 An example of B-Trees 2-3 TREES 3 Definition 2-3 Tree is a tree where Non-leaf nodes have 1 value & 2 children or 2 values

More information

The Turing Definability of the Relation of Computably Enumerable In. S. Barry Cooper

The Turing Definability of the Relation of Computably Enumerable In. S. Barry Cooper The Turing Definability of the Relation of Computably Enumerable In S. Barry Cooper Computability Theory Seminar University of Leeds Winter, 1999 2000 1. The big picture Turing definability/invariance

More information

Algebra and Number Theory Exercise Set

Algebra and Number Theory Exercise Set Algebra and Number Theory Exercise Set Kamil Niedzia lomski 1 Algebra 1.1 Complex Numbers Exercise 1. Find real and imaginary part of complex numbers (1) 1 i 2+i (2) (3 + 7i)( 3 + i) (3) ( 3+i)( 1+i 3)

More information

Realizability of n-vertex Graphs with Prescribed Vertex Connectivity, Edge Connectivity, Minimum Degree, and Maximum Degree

Realizability of n-vertex Graphs with Prescribed Vertex Connectivity, Edge Connectivity, Minimum Degree, and Maximum Degree Realizability of n-vertex Graphs with Prescribed Vertex Connectivity, Edge Connectivity, Minimum Degree, and Maximum Degree Lewis Sears IV Washington and Lee University 1 Introduction The study of graph

More information

Equational reasoning. Equational reasoning. Equational reasoning. EDAN40: Functional Programming On Program Verification

Equational reasoning. Equational reasoning. Equational reasoning. EDAN40: Functional Programming On Program Verification Equational reasoning EDAN40: Functional Programming On Program Jacek Malec Dept. of Computer Science, Lund University, Sweden May18th, 2017 xy = yx x +(y + z) =(x + y)+z x(y + z) =xy + xz (x + y)z = xz

More information

PRIORITY 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 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 information

TABLEAU-BASED DECISION PROCEDURES FOR HYBRID LOGIC

TABLEAU-BASED DECISION PROCEDURES FOR HYBRID LOGIC TABLEAU-BASED DECISION PROCEDURES FOR HYBRID LOGIC THOMAS BOLANDER AND TORBEN BRAÜNER Abstract. Hybrid logics are a principled generalization of both modal logics and description logics. It is well-known

More information

Binomial Coefficient

Binomial Coefficient Binomial Coefficient This short text is a set of notes about the binomial coefficients, which link together algebra, combinatorics, sets, binary numbers and probability. The Product Rule Suppose you are

More information

Design and Analysis of Algorithms 演算法設計與分析. Lecture 8 November 16, 2016 洪國寶

Design 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 information

Algorithms PRIORITY QUEUES. binary heaps d-ary heaps binomial heaps Fibonacci heaps. binary heaps d-ary heaps binomial heaps Fibonacci heaps

Algorithms 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 information

Problem Set 2: Answers

Problem Set 2: Answers Economics 623 J.R.Walker Page 1 Problem Set 2: Answers The problem set came from Michael A. Trick, Senior Associate Dean, Education and Professor Tepper School of Business, Carnegie Mellon University.

More information

Swaps and Inversions

Swaps and Inversions Swaps and Inversions I explained in class why every permutation can be obtained as a product [composition] of swaps and that there are multiple ways to do this. In class, I also mentioned, without explaining

More information

Gödel algebras free over finite distributive lattices

Gödel algebras free over finite distributive lattices TANCL, Oxford, August 4-9, 2007 1 Gödel algebras free over finite distributive lattices Stefano Aguzzoli Brunella Gerla Vincenzo Marra D.S.I. D.I.COM. D.I.C.O. University of Milano University of Insubria

More information

Arborescent Architecture for Decentralized Supervisory Control of Discrete Event Systems

Arborescent Architecture for Decentralized Supervisory Control of Discrete Event Systems Arborescent Architecture for Decentralized Supervisory Control of Discrete Event Systems Ahmed Khoumsi and Hicham Chakib Dept. Electrical & Computer Engineering, University of Sherbrooke, Canada Email:

More information

Microeconomics of Banking: Lecture 5

Microeconomics of Banking: Lecture 5 Microeconomics of Banking: Lecture 5 Prof. Ronaldo CARPIO Oct. 23, 2015 Administrative Stuff Homework 2 is due next week. Due to the change in material covered, I have decided to change the grading system

More information

A Testing Read-Once Formula Satisfaction

A Testing Read-Once Formula Satisfaction A Testing Read-Once Formula Satisfaction ELDAR FISCHER and YONATAN GOLDHIRSH, Technion, Israel Institute of Technology ODED LACHISH, Birkbeck, University of London We study the query complexity of testing

More information

June 11, Dynamic Programming( Weighted Interval Scheduling)

June 11, Dynamic Programming( Weighted Interval Scheduling) Dynamic Programming( Weighted Interval Scheduling) June 11, 2014 Problem Statement: 1 We have a resource and many people request to use the resource for periods of time (an interval of time) 2 Each interval

More information

Sublinear Time Algorithms Oct 19, Lecture 1

Sublinear 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 information

The Real Numbers. Here we show one way to explicitly construct the real numbers R. First we need a definition.

The Real Numbers. Here we show one way to explicitly construct the real numbers R. First we need a definition. The Real Numbers Here we show one way to explicitly construct the real numbers R. First we need a definition. Definitions/Notation: A sequence of rational numbers is a funtion f : N Q. Rather than write

More information

Priority 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 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 information

Experimental Mathematics with Python and Sage

Experimental Mathematics with Python and Sage Experimental Mathematics with Python and Sage Amritanshu Prasad Chennaipy 27 February 2016 Binomial Coefficients ( ) n = n C k = number of distinct ways to choose k out of n objects k Binomial Coefficients

More information

FDPE Microeconomics 3 Spring 2017 Pauli Murto TA: Tsz-Ning Wong (These solution hints are based on Julia Salmi s solution hints for Spring 2015.

FDPE Microeconomics 3 Spring 2017 Pauli Murto TA: Tsz-Ning Wong (These solution hints are based on Julia Salmi s solution hints for Spring 2015. FDPE Microeconomics 3 Spring 2017 Pauli Murto TA: Tsz-Ning Wong (These solution hints are based on Julia Salmi s solution hints for Spring 2015.) Hints for Problem Set 2 1. Consider a zero-sum game, where

More information

Abstract stack machines for LL and LR parsing

Abstract stack machines for LL and LR parsing Abstract stack machines for LL and LR parsing Hayo Thielecke August 13, 2015 Contents Introduction Background and preliminaries Parsing machines LL machine LL(1) machine LR machine Parsing and (non-)deterministic

More information

Syllogistic Logics with Verbs

Syllogistic Logics with Verbs Syllogistic Logics with Verbs Lawrence S Moss Department of Mathematics Indiana University Bloomington, IN 47405 USA lsm@csindianaedu Abstract This paper provides sound and complete logical systems for

More information

Data Structures, Algorithms, & Applications in C++ ( Chapter 9 )

Data Structures, Algorithms, & Applications in C++ ( Chapter 9 ) ) Priority Queues Two kinds of priority queues: Min priority queue. Max priority queue. Min Priority Queue Collection of elements. Each element has a priority or key. Supports following operations: isempty

More information