A Programming Contest

Monday · 17 Feb 03 · 02:12 PM IST | Posted by Karthik | Category: General

Like I said in the previous post, I took part in the C programming contest at Adastra 2003 on 14th.  Now I wasn't actually planning on taking part in it, in fact, a few days before, the thought wouldn't even have come to my mind.  But just about 15 minutes before the contest began, I decided to give it a shot, and walked in.

The question was a logical one, and went something like this.  There is one Professor Bumstead who has to get dressed in the morning.  There are nine items he has to wear.  Certain items, like (socks, shoes) are related, which means they have to be worn in that particular order.  Unrelated items can be worn in any order.  This way, the sets of items were (socks, shoes), (undergarments, pants, belt, jacket), (shirt, tie, jacket) and (watch).  When a random arrangement of these items is given, the task is to sort them so that related items always appear in order.  Technically, this is supposed to be called topological sorting.

I thought about this for a little while and came up with a quick solution (though not optimal).  In my program I had a function which would give out the priority of each item (socks = 0, shoes = 1, undergarments = 0, pants = 1, belt = 2, and so on, you get the idea), and then I took in the input arrangement and did a bubble sort on the priorities.

On 15th, I was the one who was supposed to announce the winners of the various competitions, so I saw the results.  I had come second in this contest, which is pretty good because I've never considered myself the "programmer" type (this problem was basically a logical one though, so it doesn't actually rely on programming).  Too bad there was only one prize for this contest!

0 comment(s) for this post.
Recent Comments
Recent Posts
Latest Doom Map
Dark Fate 2 — a Doom II map by Karthik Abhiram

Dark Fate 2 is a singleplayer level for Doom II, replacing MAP01.  It's a small-sized hellish level — and there's a walkthrough video as well.

Popular Videos
Other Destinations
Favourite Posts
Some Statistics
  • news posts two · 173
  • news posts one · 301
  • comments · 1168
  • drawings · 77
The Author
Karthik

Karthik Abhiram

27-year old Taurean (birthday 15-May-82), Assistant Manager - HR at Tata Consultancy Services Ltd in Hyderabad, India.  Previously, did Post Graduate Diploma in Management from T A Pai Management Institute (2003-05) and before that, Computer Science Engineering from Sree Nidhi Institute of Science and Technology (1999-2003).

Email: karthik82 -AT- gmail -DOT- com
orkut profile
Facebook profile
YouTube channel
deviantART page
Google Reader Shared Items

Disclaimer: The views expressed on this site are purely my own.

Warning: This site occasionally contains profanity.

Creative Commons License