W2D4 - Theta and Data
Math Day
We wandered into some mathematical territory today. It’s comforting to be back here on familiar ground. Starting algorithms and data structures this early in the curriculum is new with our cohort. We saw some “epsilon-delta”-ish definitions today, and we’re only mid-way through week 2! Then again, they have selected a talented group, and it looks like most people are able to understand it and apply it in the exercises. I can tell that the App Academy instructors and T.A’s are excited about the change.
Anagrams
This afternoon, my pair and I wrote 4 different versions of a method to check whether two words are anagrams. As per the instructions, we started with an inefficient implementation, and wrote progressively more efficient versions. The first was not only the worst, but also the most difficult to write. For this version, we used both iteration and recursion to create a list of all possible anagrams for a given word, then check the list for inclusion of the second word. Of course, there are n! ways to arrange the letters of a word without repeats...if you've ever looked at a graph of the factorial function (or the Gamma function) superimposed on a graph of a quadratic or even an exponential function, you'll know that's bad.
The final version used a hash, which has constant time 'get' and 'set' methods. I'm not quite sure how that works. We'll be implementing a hash map tomorrow, so I'll find out!














