Improving the operation of the StringSorter implementations may be accomplished by developing a Python function to compare two strings rather than relying directly upon Python’s intrinsic operators to compare strings.

I’m stuck on a Python question and need an explanation.

Week 6 Assignment: String Sorter Part 1

Additional and Optional:

Improving the operation of the StringSorter implementations may be accomplished by developing a Python function to compare two strings rather than relying directly upon Python’s intrinsic operators to compare strings.

Such a function could then implement its own algorithm to compare two strings interpreting lower and uppercase in a more natural way. Consider the following table that presents the strings from medications1.txt in their original order and also in the order obtained by having Microsoft Word sort them. This result is considered to be such a more natural ordering and you are to develop your algorithm to accomplish this ordering.

Such a function would return true if and only if a given second string is considered to be “greater than” (i.e. appears alphabetically after) a given first string according to this algorithm.

For this additional and optional part of this assignment you are to develop this function and then refactor each of the four StringSorter implementations in the corresponding Python source code files to use this function.

Again, please do not change the name of the other methods, but do rename your modified files by appending a ‘AO’ to each filename; thus StringSorterV1R.py becomes StringSorterV1RAO.py, etc. Along with submitting these two Python source code files, you are to prepare and submit a document in which you illustrate (through screenshots) the execution of these refactored implementations, with accompanying narrative explanations as appropriate.

String Sorter Part 2

Additional and Optional:

Improving the operation of the StringSorter implementations may be accomplished by developing a Python function to compare two strings rather than relying directly upon Python’s intrinsic operators to compare strings.

Such a function could then implement its own algorithm to compare two strings interpreting lower and uppercase in a more natural way. Consider the following table that presents the strings from medications1.txt in their original order and also in the order obtained by having Microsoft Word sort them. This result is considered to be such a more natural ordering and you are to develop your algorithm to accomplish this ordering.

Such a function would return true if and only if a given second string is considered to be “greater than” (i.e. appears alphabetically after) a given first string according to this algorithm.

For this additional and optional part of this assignment you are to develop this function and then refactor each of the four StringSorter implementations in the corresponding Python source code files to use this function.

Again, please do not change the name of the other methods, but do rename your modified files by appending a ‘AO’ to each filename; thus StringSorterV3R.py becomes StringSorterV3RAO.py, etc. Along with submitting these two Python source code files, you are to prepare and submit a document in which you illustrate (through screenshots) the execution of these refactored implementations, with accompanying narrative explanations as appropriate.

Assignment: Chapters 10 & 12 Questions

Prepare written answers to, and be prepared to discuss each of the following questions, each of which is taken from, is an extension of, or is inspired by the correspondingly numbered exercise question from the Computational Thinking for the Modern Problem Solver text.

Chapter 10:

Exercise Question 3. Classify each of the following algorithms as linear, polynomial (but slower than linear), or exponential. Consider the algorithmic growth relative to N. That is, as N grows how does the algorithm grow?

  1. Surveying N people in a room to find out the political affiliation of each.
  2. Recording each score for a round robin tournament for N teams (in a round robin tournament each team must play against every other team)
  3. Counting how many credit cards have a negative balance from a collection of N credit cards
  4. Filling in each two-dimensional table that shows the distance between each pair of airports for a total of N airports
  5. Listing all possible automobile license plates of length N letters

Exercise Question 4. What is the exact number of different combinations for a padlock, like the one described in Section 10.5, but having only 20 different numbers around the dial?

Exercise Question 7. Which of the following is the best way to explain the significance of the halting problem?

  1. The halting problem shows that it is possible to solve any problem with a computer program.
  2. The halting problem shows that determining whether a computer program halts can be translated into a computer program.
  3. The halting problem demonstrates that some algorithms cannot be solved by today’s computers, but may be solved by faster computers in the future.
  4. The halting problem results in a proof that three are some problems that can never be solved be a computer program.

Exercise Question 9. Identify each of the following algorithms as possible (this algorithm could be executed on a computer), noncomputable (this algorithm can never be written or executed by any computer), or impractical (this algorithm has exponential run time and requires too long for computers to execute, except in restricted cases).

  1. A program to crack any decryption scheme a terrorist could use.
  2. A program to analyze any other program and tell you if it solved your particular problem.
  3. A program to calculate the census for the United States.
  4. A program to analyze traffic flow through a city by examining every possible combination of possible turns for every automobile in the city.
  5. A program to print all of the words in an English dictionary.
  6. A program to explore every possible search engine expression compared to a single web page. (You may assume that the search expression is limited to say 256 characters in length.)

__________________________________________________________________________________________________________________

Chapter 12:

Exercise Question 1. Following is a list of specific mitigation strategies discussed in this chapter. For the threats explained in parts (a) through (d) list all of these mitigations strategies that can significantly improve security and justify your choices.

antivirus software, callback, digital signature, file backup, firewall, log files, one-way encryption, two-way encryption, spam filter

  1. You are a reported working in a country known to harbor terrorists and you need to exchange e-mail that preserves both confidentiality and integrity with your home office.
  2. You work for the government and your machine stores information that is highly classified. You do not use this computer for e-mail, but it is connected to the Internet. Not only are you expected to maintain confidentiality of the classified information, but it is also expected anyone attempting an attack must be caught and prosecuted.
  3. You are writing the computer program to store personal identification numbers (PINs) for an ATM company.
  4. Your work for a financial company and your boss frequently e-mails you instructions to make large, expensive stock purchases and sales. If you get the instructions wrong, you could lose your job.

Exercise Question 4. Label each of parts (a) through (e) with all of the following authorization types that are required in order to accomplish the specified task: read, own, execute, write.

  1. You wish to create and empty file.
  2. You have a directory of employees, and without altering the rest of the directory you merely want to add a new employee to the end.
  3. You need to understand a file of instruction but also to edit any misspellings in the file.
  4. A file, consisting of your e-mail client program, needs to be run.
  5. You wish to delete a file.

Exercise Question 6. Make a list of specific suggestions that would be good advice for anyone using a personal computer who is worried about identity theft.

Exercise Question 7. How many keys in total are needed for four people to be able to communicate securely, that is, each person can communicate securely with any other person? Explain your answer.


Order the answer to view it

Assignment Solutions


Assignment Solutions

ORDER THIS OR A SIMILAR PAPER AND GET 20% DICOUNT. USE CODE: GET2O