# Permutation and Bit Strings

a) Write a program to compute and print the time and height of the rocket from t = 0 to the time that it hits the ground, in increments of 2 secs. If the rocket has not hit the ground within 100 secs, stop the program. b) Modify the program such that instead of a table, the program prints the time at which the rocket begins falling back to the ground and time at which the rocket impacts.

2. Given a string of characters, we can permute the individual characters to make new strings. If we can impose an ordering on the characters (say alphabetic sequence),then the strings themselves can be ordered and any given permutation can be given a unique number designating its position in that ordering. For example the string `acab' gives rise to the following 12 distinct permutations: Thus the string `acab' can be characterized in this sequence as 5. Write a MATLAB program that will read in a string and determine its position in the ordered sequence of permutations of its constituent characters. Input and Output

Input will consist of a series of lines, each line containing one string. Each string will consist of up to 30 lower case letters, not necessarily distinct. Output will consist of a series of lines, one for each line of the input. Each line will consist of the position of the string in its sequence. Sample input

bacaa

abc

cba

Sample output

15

1

6

3 The Hamming distance between two strings of bits (binary integers)...

Please join StudyMode to read the full document