LMU ☀️ CMSI 2130
ALGORITHMS
HOMEWORK #2

Instructions

Turn in all solutions (including those requiring code) neatly typeset on 8.5" × 11" paper, with a staple in the upper left corner.

Store your files in a private GitHub repository named <yourgithubname>/cmsi282. At the top level of this repository create a folder called homework2 in which your files will be placed. During grading, I may clone your repository and run my own test suite on your code, so don’t forget to give me access to your repo. My github name is rtoal. I will be looking for your code in the branch master, of course. Problems that do not involve code should be answered in the file README.md; problems involving code should be placed in properly named files according to the convention of your chosen implementation language (which may be JavaScript, CoffeeScript, Java, or Python).

I encourage you to work in pairs. Please submit only one solution set for your team.

This is due at the beginning of class on Tuesday, February 23, 2016.

Readings, Videos, and Practice

Just read, watch, and do. You do not have to take notes or write reports on them; however, don’t cheat yourself by skipping them. These independent learning units must be done individually, but please feel free to discuss these items with your partner, your friends, or even with the rest of the class on the Discussion Boards.

Problems To Turn In

Please note that this is an unusual assignment because I will sometimes (but not always) be prescribing an approach for a problem, rather than letting you solve it any way you want to.

  1. Write a Bozosort implementation in Python or Java. Perform some empirical runtime studies on your method. That is, for list sizes of 2, 3, 4, 5, 6, ... (to as high as you want to go), give the average runtime of your method over several trial runs. Present your results in a nicely formatted table.
  2. Implement the Autokey Vigenere cipher, from scratch, in Java, JavaScript, or Python. Treat characters as codepoints.
  3. The following ciphertext was intercepted. You know the message is in English and that the sender used a monoalphabetic substitution cipher. What is the plaintext?
    RYW QVKOVWPP KT KLV FVBP, LQKU DYZIY FEE WEPW IYZWTEG HWQWUHP, ZP FP
    DWEE AUKDU RK RYW QLXEZI FP RK BGPWET, FUH ZR ZP, Z RVLPR, VWFPKUFXEG
    PFRZPTFIRKVG FUH WUIKLVFOZUO RK FEE. DZRY YZOY YKQW TKV RYW TLRLVW,
    UK QVWHZIRZKU ZU VWOFVH RK ZR ZP JWURLVWH.
    
  4. Decrypt the following ciphertext, given that you know it was encrypted with the bifid algorithm in which the Polybius square was laid out in the usual fashion using the keyphrase "Darn, not another cryptanalysis question".
    TWBTLLAEPODTUBTWBTLTDLDDVSNNHEETLSKDDSIFGIIMWLYDKDDSPHBPQKOFHMDLSKRS
    
  5. What are the RSA's public and private keys generated from $$ p = 23847623789462398745236743254827634647 $$ $$ q = 80147623789462398745236743254827634711 $$
  6. If someone's RSA public key is (729880581317, 5), what is her private key? Give a detailed derivation, showing all work.
  7. Dasgupta Problem 1.45
  8. Dasgupta Problem 1.46
  9. Dasgupta Problem 2.12
  10. Dasgupta Problem 2.23