Question
The following set of questions will test your problem solving abilities. For each question, work some examples, write your algorithm in psuedocode (a simplified Python
The following set of questions will test your problem solving abilities. For each question, work some examples, write your algorithm in psuedocode (a simplified Python - it isnt anything official, just write sentences instead of code), then finally write your implementation (there is no need to write an entire program, each question is accompanied with predefined variables containing input). Lastly, try and optimize your solution. How many times are you iterating over structures? Is there some strategy you can deploy that would speed up to your code? Describe your code and why your solution solves the problem. Use only the Python structures discussed in class, on slides, or on homework.
1. Generate all permutations of a given string. Example: for string abc , generate the list [abc, acb, bac, bca, cab, cba] . Assumea a variable my_string exists and contains the string to permute. Assign your result to a variable result.
2. Given two strings, determine if they are anagrams of each other. Ignore spaces, punctuation, and capitalization. Assume the existence of two variables string1 and string2 holding the input strings. Assign your result to a variable result.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started