MA/CSSE 473 Day 17 Permutations by lexicographic order number.

Slides:



Advertisements
Similar presentations
Algorithm Design Techniques
Advertisements

Number Theory Algorithms and Cryptography Algorithms Prepared by John Reif, Ph.D. Analysis of Algorithms.
COMP 170 L2 Page 1 L06: The RSA Algorithm l Objective: n Present the RSA Cryptosystem n Prove its correctness n Discuss related issues.
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
MS 101: Algorithms Instructor Neelima Gupta
Introduction to Algorithms Jiafen Liu Sept
CS4413 Divide-and-Conquer
Introduction to Algorithms Rabie A. Ramadan rabieramadan.org 6 Ack : Carola Wenk nad Dr. Thomas Ottmann tutorials.
Lecture 8 Jianjun Hu Department of Computer Science and Engineering University of South Carolina CSCE350 Algorithms and Data Structure.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Midterm Review Fri. Oct 26.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Spring, 2009 Tuesday, 28 April Number-Theoretic Algorithms Chapter 31.
Algorithm Design Techniques: Induction Chapter 5 (Except Section 5.6)
6/20/2015 5:05 AMNumerical Algorithms1 x x1x
Chapter 10: Algorithm Design Techniques
1 Review for Midterm Exam Andreas Klappenecker. 2 Topics Covered Finding Primes in the Digits of Euler's Number Asymptotic Notations: Big Oh, Big Omega,
Discrete Structures for Computer Science Ruoming Jin MW 5:30 – 6:45pm Fall 2009 rm MSB115.
Unit 1. Sorting and Divide and Conquer. Lecture 1 Introduction to Algorithm and Sorting.
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
Divide-and-Conquer 7 2  9 4   2   4   7
MA/CSSE 473 Day 22 Binary Heaps Heapsort Answers to student questions Exam 2 Tuesday, Nov 4 in class.
MA/CSSE 473 Day 13 Permutation Generation. MA/CSSE 473 Day 13 HW 6 due Monday, HW 7 next Thursday, Student Questions Tuesday’s exam Permutation generation.
MA/CSSE 473 Day 17 Divide-and-conquer Convex Hull Strassen's Algorithm: Matrix Multiplication.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
CS 3610 Midterm Review.
MA/CSSE 473 Day 02 Some Numeric Algorithms and their Analysis.
Midterm Review CSE 2011 Winter October 2015.
CSC401: Analysis of Algorithms CSC401 – Analysis of Algorithms Chapter 5 – 2. Divide-and-Conquer Objectives: Introduce the Divide-and-conquer paradigm.
Introduction to Algorithms 6.046J/18.401J/SMA5503 Lecture 3 Prof. Erik Demaine.
Project 2 due … Project 2 due … Project 2 Project 2.
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch]
MA/CSSE 473 Day 11 Primality testing summary Data Encryption RSA.
MA/CSSE 473 Day 14 Permutations wrap-up Subset generation (Horner’s method)
MA/CSSE 473 Day 18 Permutations by lexicographic order number.
MA/CSSE 473 Day 10 Primality testing summary Data Encryption RSA.
INTRODUCTION. What is an algorithm? What is a Problem?
MA/CSSE 473 Day 19 Exam Prep. MA/CSSE 473 Day 19 If you want additional practice problems for Tuesday's exam: –The "not to turn in" problems from various.
1 Programming for Engineers in Python Autumn Lecture 12: Dynamic Programming.
CS 61B Data Structures and Programming Methodology July 21, 2008 David Sun.
MA/CSSE 473 Day 02 Some Numeric Algorithms and their Analysis.
Fermat’s Little Theorem Fibonacci Numbers Shirley Moore CS4390/5390 Fall September 10,
Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2.Solve smaller instances.
MA/CSSE 473 Day 08 Extended Euclid's Algorithm Modular Division Fermat's little theorem.
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch]
CSE 340: Review (at last!) Measuring The Complexity Complexity is a function of the size of the input O() Ω() Θ() Complexity Analysis “same order” Order.
CES 592 Theory of Software Systems B. Ravikumar (Ravi) Office: 124 Darwin Hall.
Course Review Fundamental Structures of Computer Science Margaret Reid-Miller 28 April 2005.
MA/CSSE 473 Day 07 Euclid's Algorithm. MA/CSSE 473 Day 07 Student Questions Review topics not covered in class Euclid's algorithm (if there is time) extended.
Exam 2 Review CS 3358 Data Structures. 90 Total Points – 50 Points Writing Programs – 25 Points Tracing Algorithms, determining results, and drawing pictures.
MA/CSSE 473 Day 16 Combinatorial Object Generation Permutations.
Chapter 1 Algorithms with Numbers. Bases and Logs How many digits does it take to represent the number N >= 0 in base 2? With k digits the largest number.
MA/CSSE 473 Day 09 Modular Division Revisited Fermat's Little Theorem Primality Testing.
MA/CSSE 473 Day 12 Amortization (growable Array) Knuth interview Brute Force Examples.
MA/CSSE 473 Day 14 Strassen's Algorithm: Matrix Multiplication Decrease and Conquer DFS.
MA/CSSE 473 Day 05 More induction Factors and Primes Recursive division algorithm.
MA/CSSE 473 Day 11 Knuth interview Amortization (growable Array) Brute Force Examples.
MA/CSSE 473 Day 05 Factors and Primes Recursive division algorithm.
1 i206: Lecture 17: Exam 2 Prep ; Intro to Regular Expressions Marti Hearst Spring 2012.
MA/CSSE 473 Day 9 Primality Testing Encryption Intro.
MA/CSSE 473 Day 15 Return Exam Student questions Towers of Hanoi
MA/CSSE 473 Day 05 Factors and Primes Recursive division algorithm.
Midterm Review.
MA/CSSE 473 Day 17 Divide-and-conquer Convex Hull
MA/CSSE 473 Day 13 Finish Topological Sort Permutation Generation
MA/CSSE 473 Day 16 Answers to your questions Divide and Conquer
MA/CSSE 473 Day 10 Data Encryption RSA.
MA/CSSE 473 Day 02 Some Numeric Algorithms and their Analysis
Lecture 4 Divide-and-Conquer
CSCE 411 Design and Analysis of Algorithms
Cryptography Lecture 18.
INTRODUCTION TO ALOGORITHM DESIGN STRATEGIES
Presentation transcript:

MA/CSSE 473 Day 17 Permutations by lexicographic order number

MA/CSSE 473 Day 17 Student Questions on Exam Permutations recursively Permutations by lexicographic order number Exam/HW8 reschedule!

About the exam Mostly it will test your understanding of things in the textbook and things we have discussed in class. Will not require a lot of creativity (it's hard to do much of that in 50 minutes). Many short questions, a few calculations. –Perhaps some T/F/IDK questions (3/-1/1) You may bring a calculator. Open book, but beware of time! –No time to read new stuff –First do the questions you can do quickly

Possible Topics for Exam Formal definitions of O, , . Master Theorem Fibonacci algorithms and their analysis Efficient numeric multiplication Proofs by induction (ordinary, strong) Trominoes Extended Binary Trees Modular multiplication, exponentiation Extended Euclid algorithm Modular inverse Fermat's little theorem Rabin-Miller test Random Prime generation RSA encryption What would Donald (Knuth) say?

Possible Topics for Exam Brute Force algorithms Selection sort Insertion Sort Amortized efficiency analysis Analysis of growable array algorithms Divide-and-conquer Closest Points QuickHull Merge Sort Quicksort Binary Search Binary Tree Traversals Strassen's Matrix Multiplication algorithm Basic Data Structures (Section 1.4) Graph representations

Permutations and order Given a permutation of 0, 1, …, n-1, can we directly find the next permutation in the lexicographic sequence? Given a permutation of 0..n-1, can we determine its permutation sequence number? numberpermutationnumberpermutation Given n and i, can we directly generate the i th permutation of 0, …, n-1?

Discovery time (with a partner) Which permutation follows each of these in lexicographic order? – –Try to write an algorithm for generating the next permutation, with only the current permutation as input. If the lexicographic permutations of the numbers [0, 1, 2, 3, 4, 5] are numbered starting with 0, what is the number of the permutation 14032? –General form? How to calculate efficiency? In the lexicographic ordering of permutations of [0, 1, 2, 3, 4, 5], which permutation is number 541? –How to calculate efficiently?

Horner's method code Don't publish this slide (or any of the later ones) on-line until after class.

Lexicographic Permutation class These are the basics of the class setup. The next() method provides an iterator over the permutations. How should it get from one permutation to the next?

Main permutation method

Memoized factorial function

Find a permutation's sequence #