Before you tackle the homework, remind yourself of our general hw policies. Tweaks/clarifications shown in purple.
(4pts) You have accepted a job at the startup KaZoo, whose rad new product lets you both text-message and instant-message buddies with whom you file-share, all the while searching for extra-terrestial life
Their current version works, but unfortunately is too slow: because of all the network traffic it generates, the program becomes bogged down after only 100 buddies. (It is the amount of network traffic that dominates the running time -- the local processing time is negligible.) "Unacceptable!" your boss cries. "We need to support at least 5000 buddies!"
Indeed, you work day and night, and a week later report to your overjoyed boss, that you have cut the amount of network traffic generated by a factor of 64. (Or equivalently -- network/compression technology improves 64x.) Your boss is overjoyed, and marketing promptly announces "Now, supports 64 times as many buddies!"
How many buddies can a user now have, before the system bogs down, if the n buddies induces f(n) traffic, for the following functions f.
Hint: rather than a function runtime-KaZoo(), consider the function nettraffic-KaZoo() [you may give it a shorter name]. The particular number nettraffic-KaZoo(100) is a constant benchmark you'll compare your new version against.
(3pts) Write a function to encode messages by the shift-cipher, as described in Rosen.
;; shift: string/lowercase, number --> string/lowercase
;; (Where "string/lowercase" means "{a,...,z}*".)
;; Encode lower-case strings by the shift cipher, as sketched in Rosen.
;; Output not specified, for other inputs, e.g. upper case, spaces, punctuation.
;;
(define (shift msg offset) ...)
;Examples:
(shift "pizza" 1) = "qjaab"
(shift "bialy" -2) = "zgyjw"
(shift "pez" 52) = "pez"
(shift (shift "indecipherable" 17) -17) = "indecipherable"
You may use any language,
though your solution should be well-written.
(The solution set's version is 8 lines, plus comments and test cases).
You may use the provided
teachpack,
(w/ has some scheme-specific notes at the end).
Note that in ASCII, unlike Rosen, the numeric value corresponding to
the character #\a isn't 0, but some positive integer constant.
(As always in your programs, don't use magic numbers.)
expt").