Question: For matlab please help! Function Name: anagram Inputs: ( char ) String representing the anagram ( char ) Name of text file to write to

For matlab please help!

Function Name: anagram

Inputs:

(char) String representing the anagram

(char) Name of text file to write to

Outputs:

none

File Outputs:

1. A text file containing all the permutations of the anagram

Banned Functions:

 perms(), permute(), ipermute(), nchoosek(), combnk() 

Background:

You guys know what do. You are professional MATLAB now, you got this!

Function Description:

Given a string, recursively determine all the unique ways to rearrange the letters. (i.e all the unique permutations). For example, if the string was 'abc', the list of permutations would be {'abc','acb','bac','bca','cab','cba'}.

Write each permutation as a separate line in a text file, in alphabetical order. Case should be ignored and all letters should be lowercase in the output text file. Non-letter characters may occur in the string and should not be included. Characters may be repeated multiple times. There should be no newline character at the end of your file.

Notes:

Do not attempt to run this function with char vecs longer than about 10. If you do, you may be sitting around waiting a while.

The fourth test case will likely take a while, but all grading test cases will be shorter.

Hints:

The unique() function will be useful.

You may need a wrapper function.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!