Not a lot of updates for today. This morning I worked through a little bit of the algorithm course, including coding a very sloppy version of binary search. The Java...I'm still learning the Java. But the main problem I was having was my binary search getting stuck in an endless loop. It was because I was updating my high and low values improperly. What was happening was that I was setting my low as the average of the difference between high and low, rather than setting my low as the current low plus the average of the difference between high and low. But once I figured that out I saw a much nicer implementation from the course instructor himself. The big take away from the lesson, though, was that you can use binary search, which is pretty efficient (I forget exactly how efficient -- something something log N), to make the three-sum algorithm much more efficient. Instead of searching through loops j, k, and l, for every unique pair j and k, you should do a binary search for an l such that
j + k + l = 0
or, equivalently,
j + k = -l
So that's the big idea that helps make the three-sum algorithm much more efficient.
Other than that, had lunch with some tech leads via networking (TM). But it was just a meet and greet (with expensive wine that I didn't have to pay for thank the lord). They remarked in passing after I'd introduced myself, to the man who introduced me, "Oh but we need senior developers!" Just a little joke -- but I think I took it in stride. And I talked a lot. Maybe too much. At least I got lunch out of the deal...and met a developer who is also reading Das Kapital -- which is something you don't find everyday, I think.
Turning in. See you next time.
j + k + l = 0
or, equivalently,
j + k = -l
So that's the big idea that helps make the three-sum algorithm much more efficient.
Other than that, had lunch with some tech leads via networking (TM). But it was just a meet and greet (with expensive wine that I didn't have to pay for thank the lord). They remarked in passing after I'd introduced myself, to the man who introduced me, "Oh but we need senior developers!" Just a little joke -- but I think I took it in stride. And I talked a lot. Maybe too much. At least I got lunch out of the deal...and met a developer who is also reading Das Kapital -- which is something you don't find everyday, I think.
Turning in. See you next time.
Comments
Post a Comment