I would like to go on record…

•November 3, 2009 • 2 Comments

…with the following statement. AHEM!

Though I am a student of the sciences; though I am a pupil of technology and a patron of theory; though I relish immersing myself into the latest and greatest advances and leaps in the cutting edge of research, nothing will ever rival the sheer utility of this, the greatest resource a graduate student could possibly have at his/her disposal:

Seriously. My beautiful and fabulous girlfriend bought me one for my 24th birthday, and it’s seen an unbelievable amount of action since this fall semester began. It’s truly the shining beacon of human ingenuity.

What’s in a name?

•October 26, 2009 • 2 Comments

“A rose by any other name would smell as sweet.”
-William Shakespeare’s Romeo and Juliet

There are some things that we, as human beings, are inherently better at doing than others. We’re masters of survival, brilliant at short-term planning, extremely efficient at categorization of previously uncatalogued experiences, and without any doubt the most intelligent and intuitive species to ever grace the surface of the planet.

Unfortunately, where there are strengths, there are also weaknesses. We’re not too hot at long-term planning. We tend to fear the unknown. When we’re uncomfortable, violence tends to be our first recourse. And we’re way too efficient at categorizing.

We love labels. In a sense, it simplifies things to slap a name on it – the name always carries implications that we can assume about something by the name alone. To (wildly varying) degrees, there is some amount of accuracy to this strategy. Coffee houses (from where I type this :) ), males and females, democrats and republicans, sisters and brothers…all these names have meanings far more intricate than their one-word labels. Even the term “human” carries with it much, much more than the few aforementioned assertions.

And while this certainly has its advantages, it is simultaneously misleading, and often flat-out wrong. This is, for instance, how stereotyping arises. One of humans’ all-time favorite logical fallacies is to encounter one belligerent, violent man at a bar and immediately classify all other males as such. Or to discover a republican is racist and from then on classify all conservatives as bigots.

Obviously these are also oversimplified examples, but we all do it to some extent. Whether that limit before stereotyping takes over is one person, ten people, one hundred individuals, or more, there comes a point when our Monkeysphere becomes saturated and we have to make a sweeping generalization.

monkeysphere1

ZOMG! TEH MONKEH 3D CIRCLE!

Both the strength and the weakness of this approach is, in fact, simplicity. The person often has a very reasonable set of “requirements” before placing a given label on something. “Coffee house” usually requires only that the establishment has built itself around the sale of coffee (hence why Dunkin Donuts probably wouldn’t typically come to someone’s mind first when thinking of coffee houses), and “male” and “female” are often classified simply by vision alone.

“Democrat” and “Republican” are a bit more challenging, though the most simple definitions remain “liberal-leaning” and “conservative-leaning”, respectively. However, depending on who you speak to, there may be additional requirements involved. “Tree-huggers”, “hippies”, “bigots”, and “fear-mongerers” are among the more endearing.

If anyone is a step ahead of me here, they’ll have been pointing out that the requirements themselves are also categories that are up for interpretation as well. And thus my main point here is, at least from a somewhat sideways perspective, revealed:

Labels, and especially their prerequisites, are transient.

You can throw any cliche you want about “nothing endures but change” or “nothing is certain but death and taxes”, but it all equates to the same. Obviously some labels are less transient than others, but these days you’d be hard-pressed to find something that isn’t up for debate; even some of the most passionate feminists view gender as the ultimate form of sexual discrimination.

In my humble opinion, the ultimate label here is human. It implies countless descriptors, not the least of which is how it is both transient and perpetual. Our puny little lives don’t last very long, and yet we change so much in that time, individually and as a whole – look where society was just 500 years ago, a period of time that barely registers as a blip on the cosmic scale. Definitions and categories have a way of changing dramatically over that time. Still, we are all irrevocably human, and all that label implies.

Anyway. I suppose that’s enough of a philosophical waxing for one day. Back to bioimage informatics research!

funny-pictures-cat-plots-for-cat-treats

The next step

•October 19, 2009 • Leave a Comment

It seems like I was only just applying to graduate programs in anticipation of leaving the familiar surroundings of Georgia Tech to go gallivanting off to my next academic adventure. And yet, here I am again: with my M.S. degree only a handful of months away, I am once more submitting applications not only for PhD programs, but also to jobs (as alluded to in a previous entry of mine).

I would also like to briefly point out that this blog was originally devised as a way for prospective Georgia Tech computer scientists to peer into the life of a current (and now former) College of Computing student; it was linked for over two years from their student bloggers page. Recently, however (and curiously enough, coinciding very closely with the posting of this entry), the link to this specific blog has vanished.

Regardless of the reason it was taken down (I have many speculations that are likely not far from the truth), this blog has a purpose independent of its former reason for inception: it’s where I geek out. :)

So let it be said that the possibilities for this time next year are incredibly exciting. Here, I am going to delve into the application process for PhD programs (applications for CMU’s CS program, CMU-Pitt’s CompBio program, Pitt’s CS program, and MIT’s CS program are all currently underway), with specific attention on that wonderful essay section that can make or break one’s application: the Personal/Research/Purpose Statement.

Here’s basically what they’re looking for:

Tell us what you’d like to research and what your motivations are. Also tell us your qualifications for pursuing your field of research, and how those qualification will further develop the field and the university.

Pretty straightforward in theory. But here’s the rub: this isn’t some undergraduate application for someone coming out of high school. This is where grizzled veterans apply; the pool of applicants consists of the best looking to become better. Everyone is qualified. How, then, to stand out?

What field?

Pretty simple: computational biology. But from a computer scientist’s perspective.

Why?

It’s a brand-new field, it’s wide open for innovators and trailblazers, and it’s poised to become a huge presence all across the research and industrial landscape (it’s already blossoming with the pharmaceutical industry). But really, these reasons are fairly standard. I suppose the most important reasons I want to conduct research in computational biology are because it’s a pretty non-”pedestrian” (as Dr Merrick Furst once said) way of applying computer science concepts, and biology is an area I have always had somewhat of a past-time-ish passion for it, starting with 8th grade when I conducted science fair research at the CDC and ended up taking 2nd at the state competition at UGA.

Qualifications?

Here’s where I run into problems: I’ve never been very good at bragging about myself. I feel like I am definitely qualified (else I would not be applying…), but how do I convince the readers (fellow professors and researchers with whom I would most likely work, if accepted) of this?

Like I said before, I’m definitely passionate about the field: I’m a huge computer science nut with a degree from Georgia Tech, two internships and a co-op under my belt, and a pretty decent amount of experience with open source coding and applications (I picked up these skills through a lot of freelance work for friends, family, and acquaintances). In my first year as a master’s student, I amassed almost a 3.4 GPA (after tackling my first-ever collegiate-level courses in Biology, Chemistry, and Biochemistry…no small feat, I can assure you), and am not only working on a master’s thesis regarding high-throughput generative image analysis of fluorescence microscopy to identify and pinpoint subcellular protein patterns (with Dr Murphy, a trailblazer of the field in his own right), but I also wrote an informal research paper on the distribution of tuberculosis genomes across varying geographic locations, and participated in a bioinformatics data practicum with a company called Cognition Therapeutics in refining their own image analysis techniques (we focused largely on feature selection).

There’s other stuff, too, that I feel like I’m forgetting.

Consequences?

Probably the hardest part of all. Not only do I need to brag about myself, but I need to envision how those qualities will improve both the field itself and the university’s standing within that field (which, of course, doesn’t hurt its overall standing either).

And I’m honestly short on ideas here. The question sounds almost as though it’s expecting someone to come in and change the face of the field for which they’re applying; kind of a daunting task. Perhaps that’s the intent: it’s always better to aim high and miss. But I also don’t want to sound overly presumptuous – they and I all know that (almost) no one can possibly know at this point what sort of impact their proposed work could possibly have on the university and the field of research itself.

I don’t half-ass my work; it’s a sure bet that I’ll put my heart and soul into my research. It’s always possible my research will fail – that’s the risk I take by pursuing this vocation (in fact, a very large percentage of proposed and initially explored research leads to a dead-end). But it’s all a learning experience; even the failures teach me, teach my research group, the university, and the research community at large something new. I think my record speaks for myself in this regard, but were I to be accepted into a PhD program, I can’t guarantee success in all my endeavors; I can, however, guarantee unrelenting devotion to my craft. It’s what I love doing.

Anywho. lolcat tiem.

funny-pictures-kittens-are-in-o-shape

It’s fall: must be time to Hibernate

•October 14, 2009 • 2 Comments

So I’m taking this web apps course, where we’re making use of Apache Tomcat, J2EE, and generally learning how to employ the MVC framework in a modern web application (which we call “Fakebook”. Yeah I know, lollercoptorz, rite?). On the first three homework assignments, I have collectively received: 103, 100, 100. So I figured, on this fourth assignment (and with 34+ hours of built-up “penalty-less late time” with which to turn in the assignment), I had a little elbow room to experiment.

I decided to use the Struts2 and Hibernate frameworks.

Yeah, insane. Especially the latter, considering I have ZIP/ZERO/NADA/ZILCH experience with either one.

It took about a day to get the hang of how Struts organizes the MVC framework. The most difficult part, as usual, was setting up the XML configuration file. Luckily, it doesn’t require too many dependencies and is fairly straightforward to install and incorporate. It took another day to figure out the notion of Interceptors for the purpose of implementing authenticated resources, and also installing a database schema when the server was started.

Then came Hibernate. Holy Halloween, Batman.

This is seriously the most complex framework I have ever worked with. Each “module” beyond the core requires a heinous number of dependencies, some of which are optional, and woe is you if you mess them up. Supposedly v2.5 will incorporate a lot of the dependencies into a single package, but that’s still in Beta as of this post.

Maven can be effectively used to mitigate some of the difficulties in satisfying dependencies, but it’s still largely up to the user to figure out what packages are required if you want to use the Core, Search, or any of the other “modules.”

Once the dependencies are satisfied, then the real fun begins: configuring Hibernate.

The number of configuration options is mind-boggling; I feel like I’m installing Gentoo. I ended up making a post on StackOverflow when I reached a point where I could actually attempt flipping the “on” switch, and was greeted by cascading 50-level exceptions. The single response ended up being the right one (it was a simple “class” configuration option I thought wouldn’t have any effect, since – let’s face it – I have no idea what half the specified configuration options do, and the documentation isn’t much help), though it only revealed yet another exception.

Fixing that yielded another, and so on, and so on…literally at least a dozen more exceptions that were somewhat more straightforward, but revealed 1) just how little I knew how to use Hibernate, and 2) how so many different configuration options need to be perfectly specified for the damn thing to work.

But as of about an hour ago, I am proud to say that after three days of pouring through PDF documentation, Googling the hell out of phrases like “hibernate arrays” and “one-to-many hibernate exception” and “WHY WOULD ANYONE EVER USE HIBERNATE”, banging my head on the desk when the editor swore I had a phantom error in my XML config file, and satisfying concrete and transitive dependencies, my server BREATHED today by successfully executing an action within the Struts framework, which also contained a database access through Hibernate.

It’s WORKING. It’s ACTUALLY WORKING. HOLY CRAP. …and it’s due by 11:59pm tonight. WHEEE.

Also, I wanted to give a shout-out to my main man V2 (my MacBook), for whom earlier this week I purchased a new battery after the previous one lasted 511 recharge/discharge cycles without ever offering less than 2+ hours of continuous use. Interestingly, the battery was beginning to bow outward (never a good sign) around the same time that OS X itself informed me that the battery needed to be replaced “soon”. So after more than three years and well over twice the average lifespan of these batteries, I dropped $130 on a new one.

V2 paid for himself a long, long time ago. The new MacBook Pros are certainly the sexiest ones to hit the market so far, but this guy is a trooper. I purchased him in September of 2006, and the only expenditures I’ve had are a $150 mainboard/DVD drive/Bluetooth repair job, a $200 hard drive/RAM upgrade, and now a $130 battery replacement. Not too shabby at all for three years (and I didn’t even purchase the extended warranty!).

Anywho. Busy weekend ahead. I’ve had several more interviews, many of which have gone exceedingly well, and PhD and fellowship applications are going smoothly. Two big assignments due this week, lots of research work to be done over the weekend, and Cathryn will also be in town tomorrow night. :)

funny-pictures-cat-sees-computer-forcefield

We’ll beam you up to our ship

•October 4, 2009 • 5 Comments

I interrupt my regularly scheduled blogging drivel to bring you this discussion on the StarGate: Universe premier that aired this past Friday night.

stargate_universe_gate_room

It was, in a single word, awesome. I want to touch on the characters and my thoughts on what I liked, didn’t like, and general notes of interest. So, without further adieu:

SPOILERS! SPOILERS! SPOILERS!

Dr Nicholas Rush is going to be quite a handful. The guy is obviously brilliant, but he has absolutely no regard for authority: he has his own agenda, and that agenda is exploration at any cost. While I think he’s a total asshole, I’m simultaneously drawn to him because I empathize with the passion for discovery for its own sake, even at the cost of one’s life. Dr Rush is thrilled at the prospect of what discoveries he could make at the opposite side of the known universe, and truthfully is in no hurry to return home (just watch the grin on his face when he first arrives on board the Destiny). He an explorer in the purest and most extreme sense, and I suspect that passion will come into conflict with the more practical needs of everyone else over the course of their journey.

Eli Wallace complements Dr Rush very well, but whether because of a subtle lack of self-confidence simply by virtue of Dr Rush handling everything so far, I’m not convinced of his abilities yet. I like how well he relates to other people with his easygoing demeanor, but that will get him into trouble if he continues to allow Dr Rush to essentially run the show.

Colonel Young is an obviously capable leader, and a very by-the-book soldier. I’m interested to see what went on between him and Lt Johansen in the two weeks prior to Icarus Base falling under attack, and why he collapsed at his house while talking to his wife about redeployment. I suspect there isn’t much that will cloud his judgment; he’s a seasoned warrior who is ready to sacrifice himself for the sake of his comrades in a heartbeat. Good thing he seems to be recovering from his initial injuries.

Lieutenant Scott has the potential to be one hell of a leader, but his inexperience shows through at a few points, especially when he tries to open a sealed door for no particularly legitimate reason, and against the recommendations of a crewmate and Eli. He seems to have a tendency to get caught up in the moment and allow too much of his emotions to show – also a sign of being a bit wet behind the ears – but he still knows how to manage a crisis situation with other people involved. The fact that he had the cajones to tell a US Senator (and technically, his boss) to shut up speaks positively to his character.

Sergeant Greer is a rather opaque character with obvious anger issues, but ultimately respect for the chain of command. He and Camille almost get into a duking match early on, and he might very well have shot Dr Rush if not for Lt Scott’s intervention. There could be a hell of a soldier behind all the chaos and emotional outbursts; he’ll need to learn to control himself if he’s going to last even a few days on board the Destiny.

Chloe Armstrong has lived a privileged life beside her Senator father, and as such she hasn’t really seemed to figure out where she fits into this new and chaotic setting. She did seem to take to Eli, and she opened up to Lt Scott following her father’s death, but beyond that she has somewhat kept to herself. I’m interested to see what kind of woman she turns into.

Lieutenant Johansen has had her hands full since stepping through the gate and onto the Destiny as the lone person on board with anything resembling medical knowledge and expertise. She’s shouldered the responsibility admirably thus far, tending to the wounded and ensuring that everyone is as comfortable as possible. She has a remarkably subtle yet powerful empathetic aura, evidenced by her support of Chloe following her father’s death. There’s something going on between her and Colonel Young that doesn’t seem quite kosher; nobody – and I mean nobody – would turn down a StarGate assignment to go to medical school.

Camille Wray has thus far kept to herself except when asked directly or when she had a vehement opinion to voice, which is already a far cry from what we’re used to when the IOA gets involved. She obviously has her own opinions of what should be happening and who should be in charge, but has thus far gracefully allowed things to unfold on their own, a departure from the IOA’s typical micromanagement. She did, however, almost come to blows with Sgt Greer, and she’s certainly no friend of Dr Rush, and eventually her opinions on the leadership will come to light.

I didn’t like how the Senator was killed off; from watching Atlantis and SG-1, the seemingly simplistic dilemma of depressing a somewhat unreachable button is something that Rodney McKay could have devised an automated workaround for pretty easily, probably using the kenos Eli found. Even Sheppard probably would have simply tossed his P-90 at the button in a well-aimed throw.

I also didn’t like how little technical jargon there was. Sure, nobody likes listening to the unabridged version of quantum physics, but there was literally zero techno-speak, a somewhat jarring departure from the two previous StarGate shows. There wasn’t a single hint as to what the millennia-old mathematical problem that Eli solved was, or how it could be translated into a stargate dialing protocol.

I hate the Lucian Alliance. Those guys are just plain bad news.

I really liked the nuances of StarGate mythology that kept the show so intriguing to folks like myself who are very familiar with it. For instance, the fact that the Destiny employed some sort of superluminal drive that actually doesn’t use hyperspace, implying just how old the ship really is. Or the fact that, while it’s obvious the ship is of Ancient design, both its interior and exterior look nothing like the architecture of Atlantis or any of the Aurora-class battleships seen in the previous shows.

I love the focus on the characters. Yes, I’m a dork who loves the nerdulance of sci-fi, but truthfully it’s always been the chemistry of the actors and actresses in both previous StarGate series that has so captured my interest, and Universe proves to be no exception. It’s still early, so I can tell they haven’t fully gelled (which is also by design, given their current predicament), but it’s so much fun to watch how each of them contributes to the overall dynamic.

I loved the soundtrack. Tiny elements of well-known StarGate chords, spread thin by a newer, more ominous tune that, for some reason, really drives home just how utterly isolated and alone the crew is. I watched Star Trek: Voyager back when it was running, and it had a similar theme: a crew that has just been put together is suddenly thrown far, far away from home. But not only were they only in the Delta Quadrant (technically, just a few days of hyperspace travel away for any ship from the StarGate universe outfitted with the Asgard intergalactic hyperdrives) of our own Milky Way galaxy, they had an entire brand-new starship at their disposal, and the entire crew was trained at StarFleet Academy. Destiny’s new crew is a motley bunch, ranging from cooks to colonels, on board a dying and half-broken ship that is hundreds of thousands of years old, and quite literally on the opposite side of the known universe. They are, in every sense of the word, alone.

I really, really liked the juxtaposition of well-known StarGate elements with so many new elements previously unknown to the franchise. It was certainly a culture shock – General Jack O’Neill, being serious? – but the veteran directors, producers, and writers pulled it off beautifully. It was something new and exciting, and simultaneously it was still StarGate. Absolutely amazing.

Still though, I miss these guys:

mcgillion_hewlett

Oh! And if you have iTunes, the first two episodes (the premier) is available for FREE download! In HD quality!

Really, Microsoft? Really?

•September 29, 2009 • 9 Comments

Warning: this video is 6:14 in length, and is literally more painful than watching a middle school dance.

While even the most mainstream media outlets are cringing at this veritable train wreck – even a self-proclaimed “Apple-hating bigot” rips this video to shreds – there are literally hundreds of awesome comments left by the readers of the Slashdot article, though I think the Washington Post commenter mentioned in the article’s summary hits the nail on the head:

If Microsoft had been put in charge of marketing sex, the human race would have ended long ago, because no one would be caught dead doing something that uncool.

Well played, Microsoft. Well played.

More futuristic discussion

•September 26, 2009 • 6 Comments

Wait for it, wait for it…

ACRONYM FAIL!

ACRONYM FAIL!

Now that I have your attention, I’d like to share where I’m thinking I’ll be at this time next year.

As I will be graduating from Carnegie Mellon with a master’s degree this coming May, the gears have already been grinding for a few months in determining where I’ll be ending up. Obviously my beautiful girlfriend and I are tag-teaming this item, as she will be finishing her bachelor’s degree from NYU at the same time and is also looking for jobs/at grad schools, so we’re hoping to end up in the same location (for obvious reasons). Both our focuses (foci?) are on jobs and graduate schools.

Before I go any further, let me say this: I won’t be delving into too much detail here, as I am not interested in unintentionally sabotaging my efforts in any of these endeavors. If you really want to know details, contact me (perhaps even for an interview ;) ) and I’d be happy to oblige.

That said, I have already spoken with folks from IBM about possible work opportunities next May. I am also speaking with Academia.edu, an academic-oriented social networking site. There are others I will be contacting in the coming weeks.

Regarding graduate schools, I will be applying to Carnegie Mellon, MIT, Cornell, and Georgia Tech, to their respective Computer Science PhD programs with research emphasis in bioinformatics, computational biology, algorithms, and machine learning. Thankfully, I already have several professors who have expressed interest in writing me recommendations, and my GRE scores from two years ago are still good.

It’s pretty exciting stuff. After this summer at IBM, I have a much clearer idea of what it is I want to spend the rest of my life doing. Granted, it’s still pretty broad, but it’s significantly improved since my days of “I’m interested in everything in CS!” (which, truth be told, weren’t all that long ago).  The hard part is snagging a position that will challenge me; by definition, those positions are challenging to obtain in the first place.

In the meantime, I have PLENTY of work to keep me busy (astrophysics is brutal, web applications is time-consuming, computational modeling is mind-bending, and research is challenging)…AND NEXT FRIDAY NIGHT IS GONNA BE HUGE:

universe

Yes folks, it’s the two-hour StarGate: Universe premier, on Syfy at 9pm eastern! w0000000t

Boned

•September 23, 2009 • 2 Comments

Yep: it doesn’t matter where in this great country you live, we’re all pretty much screwed.

29qo6rs

Real post coming soon!

A plugin that makes bagels would be nice, too

•September 10, 2009 • Leave a Comment

I really have nothing clever to say about this snapshot from my blog’s Dashboard:

wtf

A few other noteworthy updates:

1. I’ve started another blog – Left of Sectarian, Right of Chaos – where I will talk about nothing but politics, thus keeping me free on this blog to write and explore about pure and total geekery without interleaving the occasional depressing and angry entry regarding the latest of the politik. It’s currently empty, but updates will start soon. w00t!

2. I attended my first thesis research meeting with the entire Murphy Lab research group, where we discussed a paper published back in 2005 by, of all people, someone working in Microsoft Research. I have a lot of work to prepare for my thesis defense next May, but damn this is one bright group of folks I’m working with.

3. How many boards could the Mongols hoard if the Mongol horde got bored?

4. Remember those random desktop freezes I had posted about before? Well, even after purchasing that new motherboard, they started up again with a vengeance upon my return to Pittsburgh. This time, I swapped out the power supply (replaced my original Thermaltake 750W with a Corsair 750W), and it’s been purring like a lion in the shade with a fresh kill ever since. Fingers crossed that I finally nailed the friggin problem.

5. Plans continue to unfold regarding my future after graduating from Carnegie Mellon in May. More details to come.

This weekend, I’m off to Hidden Valley Resort for the annual Biology departmental retreat. The experience last year was phenomenal, though I was pretty lost during all the research talks as I had next to zero biology knowledge. This year, I’m really excited about the prospect of really grasping what it is everyone in the department is working on. Plus the social aspects are a ton of fun. :)

funny-pictures-cat-activates-secret-door

Code! Jam!

•September 3, 2009 • 19 Comments

Don’t look now, but the 2009 rendition of Google Codejam is very close to concluding its qualification round!

The competition opened yesterday at 7pm eastern. I worked with my partner in C++ crime who goes by the moniker of Danimal (we’re high school buddies who have pursued somewhat different fields within computer science, but we still keep in regular touch, and even work on projects together, most notably a burgeoning open source real-time strategy video game…but that’s top secret), and we kicked the living arse out of the qualification round.

For those of you not familiar, Codejam is simply a coding competition sponsored by Google, with a grand prize of $5000. Dan and I missed the announcement last year, so we’ve basically been planning our entire year around today to make sure we didn’t miss it again. :P

The competition consists of several rounds, the first of which is a qualification round. There are three programming questions – often more algorithmically intensive than programming intensive – and the goal is to solve as many of the problems as quickly as possible. For the purposes of the qualification round, we were only required to solve one question correctly in order to move on to Round 1 (scheduled for next week).

Here’s how it went down.

Problem A: Alien Language

After years of study, scientists at Google Labs have discovered an alien language transmitted from a faraway planet. The alien language is very unique in that every word consists of exactly L lowercase letters. Also, there are exactly D words in this language.

Once the dictionary of all the words in the alien language was built, the next breakthrough was to discover that the aliens have been transmitting messages to Earth for the past decade. Unfortunately, these signals are weakened due to the distance between our two planets and some of the words may be misinterpreted. In order to help them decipher these messages, the scientists have asked you to devise an algorithm that will determine the number of possible interpretations for a given pattern.

A pattern consists of exactly L tokens. Each token is either a single lowercase letter (the scientists are very sure that this is the letter) or a group of unique lowercase letters surrounded by parenthesis ( and ). For example: (ab)d(dc) means the first letter is either a or b, the second letter is definitely d and the last letter is either d or c. Therefore, the pattern (ab)d(dc) can stand for either one of these 4 possibilities: add, adc, bdd, bdc.

Input Output
3 5 4
abc
bca
dac
dbc
cba
(ab)(bc)(ca)
abc
(abc)(abc)(abc)
(zyx)bc
Case #1: 2
Case #2: 1
Case #3: 3
Case #4: 0

We began with this problem (at Dan’s insistence, even though Dan disagreed with me when I said it was the toughest question of the three, and the submission statistics ended up proving me RIGHT…….ass). Conceptually speaking, it’s fairly straightforward – the most challenging portion is representing those multiple “ambiguous letters” as a single character when attempting to determine which words in the dictionary it could possibly be. Parsing those ambiguous letters out and keeping track of the index they belong to was my biggest hurdle. I ended up removing everything between the braces and replacing it with the character ‘0′, thus maintaining the correct string length but also ensuring it wouldn’t be confused later as a correctly assigned character.

Dan and I both successfully solved this problem, both the small and large data sets.

Problem B: Watersheds

Geologists sometimes divide an area of land into different regions based on where rainfall flows down to. These regions are called drainage basins.

Given an elevation map (a 2-dimensional array of altitudes), label the map such that locations in the same drainage basin have the same label, subject to the following rules.

* From each cell, water flows down to at most one of its 4 neighboring cells.
* For each cell, if none of its 4 neighboring cells has a lower altitude than the current cell’s, then the water does not flow, and the current cell is called a sink.
* Otherwise, water flows from the current cell to the neighbor with the lowest altitude.
* In case of a tie, water will choose the first direction with the lowest altitude from this list: North, West, East, South.

Every cell that drains directly or indirectly to the same sink is part of the same drainage basin. Each basin is labeled by a unique lower-case letter, in such a way that, when the rows of the map are concatenated from top to bottom, the resulting string is lexicographically smallest. (In particular, the basin of the most North-Western cell is always labeled ‘a’.)

Input Output
5
3 3
9 6 3
5 9 6
3 5 9
1 10
0 1 2 3 4 5 6 7 8 7
2 3
7 6 7
7 6 7
5 5
1 2 3 4 5
2 9 3 9 6
3 3 0 8 7
4 9 8 9 8
5 6 7 8 9
2 13
8 8 8 8 8 8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8 8 8 8 8 8
Case #1:
a b b
a a b
a a a
Case #2:
a a a a a a a a a b
Case #3:
a a a
b b b
Case #4:
a a a a a
a a b b a
a b b b a
a b b b a
a a a a a
Case #5:
a b c d e f g h i j k l m
n o p q r s t u v w x y z

Personally, this was my favorite question, in no small part because it reminded me of the machine learning watershed method of fluorescence microscopy image segregation :P .  It’s much less difficult than it actually reads at first, and the submission statistics put this one’s difficulty on par with the last question, and easier than A. The hardest part of this problem is the very last step – determining what sink each cell in the basin ultimately drains into.

Originally, I was approaching it from a similar direction as a dynamic programming protein alignment problem I had written back in the spring – each cell keeps an array of references to all cells that point to it, so that backtracking is made easier at the expense of more initial overhead. However, Dan made the astute observation that, since each cell is already storing a single reference to the cell it flows into (unless the cell is a sink), why not also store a single reference in each cell to its ultimate sink?

This essentially became traversing a linked list, iterating over the “next” references until we reached the sink, and then assigned that to the current cell. From there, labeling each cell was a snap.

Dan and I both correctly solved this problem as well, both the small and large data sets.

Problem C: Welcome to Code Jam

So you’ve registered. We sent you a welcoming email, to welcome you to code jam. But it’s possible that you still don’t feel welcomed to code jam. That’s why we decided to name a problem “welcome to code jam.” After solving this problem, we hope that you’ll feel very welcome. Very welcome, that is, to code jam.

If you read the previous paragraph, you’re probably wondering why it’s there. But if you read it very carefully, you might notice that we have written the words “welcome to code jam” several times: 400263727 times in total. After all, it’s easy to look through the paragraph and find a ‘w’; then find an ‘e’ later in the paragraph; then find an ‘l’ after that, and so on. Your task is to write a program that can take any text and print out how many times that text contains the phrase “welcome to code jam”.

To be more precise, given a text string, you are to determine how many times the string “welcome to code jam” appears as a sub-sequence of that string. In other words, find a sequence s of increasing indices into the input string such that the concatenation of input[s[0]], input[s[1]], …, input[s[18]] is the string “welcome to code jam”.

The result of your calculation might be huge, so for convenience we would only like you to find the last 4 digits.

Input Output
3
elcomew elcome to code jam
wweellccoommee to code qps jam
welcome to codejam
Case #1: 0001
Case #2: 0256
Case #3: 0000

This one was interesting. At first glance, it is nothing more than the classic “longest common subsequence” problem. It even lent itself to a very elegant recursive solution of my own design, for a total code base of a mere 90 lines.

The idea is pretty simple. You have two strings: a “search” string (the strings on the left in the above sample), and the “find” string (“welcome to code jam”).  Starting at the beginning of both, run through the search string until a matching character is found. Ensure all the other characters in the find string are present in the correct order in the find string. Provided that’s true, you have 1 valid subsequence. Repeat, matching that first character of the find string until you reach the end of the search string (exercise for the reader: there’s an opportunity to optimize here!). Then move on to the second character in the find string, and repeat the whole process again, until the very last character in the find string is matched.

My recursive method had a base case of when the find string is empty – this means we have reached its end and matched every single character in it, so we have a valid subsequence – and returned 1.  The recursive case was a loop starting at the beginning of both strings, looking for a matching character in the search string to the find string’s first character. If a match was found, then recurse, passing in substrings of both: everything in the search string after the matched character, and everything in the find string minus the very first character.

The algorithm was all of 15 lines; the other 75 lines were file I/O to read in the test cases and print them out. It worked perfectly on the sample input, and the small input file.

…woe was me when I tested it on the large input. A line with 500 characters, most of which were of the form “wwwwwwwweeeeeeeeeeelllllllllllllccccccccccooooooommmmmeeeeeee …” (use combinatorics to figure out how obscenely massive the number of subsequences would be).  As best I can tell, my elegant recursive solution blew its stack – it couldn’t even finish the first test case of about 100.

Dan, too, had the same problem.  We both solved the small input, but timed out on the large one. Needless to say, the overhead of recursion in this case proved too much – an iterative solution is what is required.

Conclusion

With only minutes left in the qualification round, it’s unlikely anyone could use these insights to their advantage. :P By answering one short input correctly (we got all three) and one large input correctly (those aren’t checked until after the round ends, but we’re pretty confident on the two we got), one is passed on to Round 1, where another batch of problems will be posed. This time around, however, the total points for correct answers and the time taken to achieve those correct answers will factor into who moves on to Round 2.

Dan and I weren’t working under any time constraints; we thoroughly worked each problem, stopping to bounce ideas off each other, waiting for the other to catch up, taking breaks, and also goofing around quite a bit, so we clocked in around several hours total. The current first place contestant finished all three problems in twenty-five minutes.

Of course, time starts from the moment one submits a solution to one of the problems, so this person probably worked all three questions and submitted them at the same time…but still. That’s beastly.

Man I love this stuff :D Kudos to Google for organizing Codejam again!

funny-pictures-cats-promise-to-not-touch-your-food