8.Permutations

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

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

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!!!

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

View Full Document
Number of recursive calls Often times, when recursion is taught, a rule of thumb given is,
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
Ask a homework question - tutors are online