8.Permutations - Permutations The permutation problem is as...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Permutations The permutation problem is as follows: Given a list of items, list all the possible orderings of those items. We typically list permutations of letters. For example, here are all the permutations of CAT: CAT CTA ACT ATC TAC TCA There are several different permutation algorithms, but since recursion an emphasis of the course, a recursive algorithm to solve this problem will be presented. (Feel free to come up with an iterative algorithm on your own.) The idea is as follows: In order to list all the permutations of CAT, we can split our work into three groups of permutations: 1) Permutations that start with C. 2) Permutations that start with A. 3) Permutations that start with T. The other nice thing to note is that when we list all permutations that start with C, they are nothing put strings that are formed by attaching C to the front of ALL permutations of "AT". This is nothing but another permutation problem!!!
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Number of recursive calls Often times, when recursion is taught, a rule of thumb given is,
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/22/2010 for the course EECS COP 3502 taught by Professor Guha during the Fall '09 term at University of Central Florida.

Page1 / 3

8.Permutations - Permutations The permutation problem is as...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online