| goat-banging avl tree god. |
[Mar. 15th, 2002|05:43 am] |
| [ | mood |
| | ecstatic | ] |
| [ | music |
| | Rammstein | ] | I've done all-nighters far too frequently this semester. None of them, however, have been quite like this one.
I thought I was doing all right. Other people had been doing the lab. But all was not well. Brett was shocked to learn that we were doing an AVL tree, not just a BST. (A Binary Search Tree just has to find a place for each element that's placed in it---simple. An AVL tree is a BST that automatically rebalances itself.) We've done BSTs many times before. they're a simple data abstraction. AVL trees, on the other hand, while not too complicated to do on paper, require funky pointer juggling to implement in code.
It came to pass that around three in the morning, I junked most of my code for the second time and started to panic. I had no idea where to even start. I had been copying pieces of the ANSI C reference implementation of the data type, but to no avail---it just segfaulted at me.
I decided I needed some Code Red if I was to keep going. I went over to the store. Nicole met me there. [see anecdote] I was jumpy and queasy from being so nervous. I got some Code Red (which will turn my stomach into some Gordian contortions in a few hours) and sat outside in the cold, trying to slow down the panic. (At this point, I'd been coding for two hours and had essentially nothing.)
Nicole rubbed my back (mentioning how bony I am, thppt) and tried to calm me down. It actually worked. I felt a little better spending a half-hour outside the dorm, away from the code. I relaxed, talked. got a few giggles out of me. I was still scared, but I wasn't on the verge of panic anymore.
When I went back to the dorm, I reimplemented my original design. I'd had problems with reassigning the root pointer (which I didn't think I should have had to do), and lo and behold, the code started working without me implementing the kludge!
(04:01:59) Adam: Oh my god, a simple case works. (04:03:27) Adam: I didn't even expect it to compile.
Now that I had something to work from, everything sped up. Everything started working. Once the basic code was reliable, it was almost trivial to add more and more functionality until it was... done. Actually done. The project that had filled me with fear and trepidation two hours before was... done.
I still can't believe that it actually worked. Not only does it work, it's robust and stable. It's well-commented. It's well-organized. It's clean. It's not particularly fast, but that's what happens when algorithms are made up on the spot. (Besides, speed for this kind of implementation is a silly thing to worry about---any modern machine could run an algorithm three orders of magnitude slower and not notice the difference.)
I thanked Nicole profusely for helping me out there. I don't know why the codebase miraculously started working, but it did. I had actually been considering giving up and turning it in late or not at all; my exam went well enough that I felt okay doing that.
But nay! I, alone and in the dead of night, have brought forth a marvel of self-balancing righteousness! Though the comments are written in the Sumerian spider-goddess's simply yet beautiful dialect, it is a marvel of... of me staying up all night and having something damned nice and well-tweaked to show for it. As I said to Brett's sleeping instant messenger...
(05:25:34) Adam: I AM THE GOAT-BANGING LORD OF ALL THE AVL TREES I SEE BEFORE ME!
Goat-banging lord or the AVL trees, that's me...
[anecdote!] About meeting Nicole: I tried her dorm first. I'm not supposed to be allowed in there, being male and all: it's an all-female dorm, and I'm assumed to be a rapist unless I have a woman coming down to meet me. There were two girls coming back (yes, at three in the morning.) They tried to hold the door for me. I protested, saying that I'd gotten the third degree from the RA the last time I'd done that (it was true, I'd given her lip and she'd torn me a new one). They'd have none of it and walked me over to the elevator.
Girl: Oh, and if you rape anyone, I'll rip your balls off. Me: Okay.
Nicole wasn't there, but it was an interesting little journey away from the code.
Ooh, it's getting light outside! Soon, the sun will come up!
Die Sonne scheint mir aus den H?nden kann verbrennen kann euch blenden wenn sie aus den F?usten bricht legt sich heiss auf das Gesicht sie wird heut nacht nicht untergehen und die Welt z?hlt laut bis zehn --Rammstein, "Sonne"
Hmm. It's probably not nearly as good when you don't have the tune in your head. Probably looks like a bunch of German. Well, it made me think of the sun. And that's good enough.
After a week of neglected homework, iffy exams and a postponed project, it's so fucking good to finish it off with a bang. My code works. I know my code. I went under a lot of pressure, but I prevailed. The soul still burns. Time to go toast CDs in my "office" until it's time to impress the hell out of everyone at the lab with my amazing code.
Feel free to tell me how much I rock, 'cause I'm feeling a lot of "rock" right now. And a lot of "run off at the mouth and write an obscenely long livejournal entry". That too. |
|
|
| about to leave. |
[Mar. 15th, 2002|04:22 pm] |
*yawn*.
Well, my father said he'd be here around two, then IM'd be to say he'd be here around four. Hopefully he'll get here before everything closes at six.
Turning in my work was curiously anticlimactic... but I'm sure the payoff will be soon. A lot of other people didn't have it done for this morning, and I had to stay quiet in order to not gloat.
The probability exam... I stopped in for a second and picked it up before heading back to the dorm. Somehow a fifty-six was curved up to a seventy-six, which turned into a B-. This doesn't mean I get to slack off on the rest of the exams, no sir. I mean, if I actually studied, imagine how far I could go...
Bah, time to think of more stuff to pack before my father gets here. The dorms close in an hour and a half...
Hmm. I'm feeling pretty excited about going on vacation soon. Yeah. This should be good. |
|
|
|
|