I recently noticed that some of my most brilliant ideas and realizations came to me whilst taking a crap. *Excuse me*. Funny as that may sound but NO KIDDING!* One of my colleagues asked me some time ago how to convert a Queue to a Stack (ADT's) with minimum revisions on the code but because I wasn't really paying attention and my mind was busy with other stuffs, I wasn't able to answer her. That night, while I was sitting on the toilet doing my thing (you know) and looking at black ants crawling the wall (which is a long queue), I realized that the answer to the question was very simple...you simply enqueue at the front of the queue (FIFO) instead of the rear and it will now work as a stack (LIFO). And that will take only one line of code to change (index only if the implementation is an array).
* I have been teaching Discrete Mathematics for almost 4 years now. Being one with more experience on the subject, Miss Cathy, who was then starting to teach DM, asked me on practical applications of Mathematical Induction, which is one of the most pain in the a$$ topics for most students because it's highly mathematical and theoretical. I couldn't give a very "pracatical" answer at that time. BUT days ago, I finally thought of it (and I'm wondering why it didn't come to me earlier). It can be applied in programming, for example, if you have a function that takes n as input and outputs the sum of the nonnegative numbers from 1 to n. Normally, what we can easily think of is to loop from 1 to n and have a variable that accumulates with each pass of the loop, which has a time complexity O(n). But since we can prove by mathematical induction that the sum of the numbers from 1 to n is equal to [n(n+1)]/2, then instead of looping, the function can simply return [n(n+1)]/2, and that would be O(1). We all know that O(1) is better than O(n). And again, that came to me while I was taking a crap.
* Our Dean (and pretty much everyone in the higher ups), has been encouraging (and quite urging) us to do research, even the most simple correlational studies because we understand that it's really one of our weaknesses (of the school, in general). I have done one correlational study in the past but it was so simple that I felt it was just an example in the my Elementary Statistics class in college. Then yesterday morning, again while sitting on the toilet taking a crap, I thought of a more complex and (hopefully) has more impact study. I haven't mapped the details yet, but I have the general idea.
* And, of course, the idea to blog about this came when I was sitting on my "thinking chair" doing my thing. Haha.



No comments:
Post a Comment