This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Originally posted by will boyd: can you talk about why you don't use the algorithms you studied in college? are they useless? i take it they don't have real-world applications?
They absolutely have real-world applications. Thankfully, really cool people have written, tested and released good implementations of those algorithms so I never have to do it myself.
Don't think of the goal of CS classes as teaching you how to code a sort routine. Instead, it teaches you how to analyze, plan and code algorithms in general. Sure, you may write code to buble sort, quick sort, multiply arrays, factor primes and play checkers, but the algorithms aren't the goal. The goal is to give you enough practice writing algorithms so you can devise and write your own algorithms later.
I have never, in my professional career, had to use long division. It's something i was taught in school, and had to do hundreds, if not thousands of times then, be never in 'the real world'.
Does that mean it was not worth my time to learn it?
The purpose of school (imho) is not to teach you stuff you need to know, but how to think, and how to approach a problem. It give you tools you can use to analyze problems in the future. It gives you the building blocks that you can then take to construct larger, more elaborate structures.
so, you learn some well known algorithms that have probably been implemented in any language you would care to write in. Understanding how they work is an important step in knowing which tool to use.
Case and point - i was given the task of speeing up a program that was taking about 30+ hours. it was inserting some records into a flat file, but needed to maintain a sorted order (a database was not an option). The program read everything into memory, added a few lines to the end, then did a quick sort.
What did i learn in college? for large numbers of records that are already sorted, a quick sort is one of the WORST choices. i used a bubble sort and cut the time down to 5 minutes. Had i not learned about both bubble and quick sorts in college, i'm not sure how i would have cut the time down.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
In 8+ years of programming, I had to implement a tree structure along with DFS and MRU caching in just one project, and all of these are some of the simpler algorithms. However, knowlede og Data Structures and algorithms has helped me because I use that knowledge when I design my Beans, like when I have to decide whther to use a LinkSet or a HashSet etc etc
Joined: Jul 30, 2003
In my first year of college, I was flunking electronics for the second time, with a second professor. My professor took me aside and asked me what the problem was. I pulled out the schematic diagram for a complicated analog circuit, and showed him how I could not see where the circuits we were learning applied. In other words, I was not advancing because I was stuck trying to apply what little I had already learned!
He laughed, then told me something that changed my whole life: He said that I misunderstood what college was all about. He told me that I'm not here to learn, I'm here to learn how to learn. What he meant was that once I left college and was out in the real world I would have a set of skills that would help me figure out how to solve real-world problems, and he was right. Not only was he right about that, but his "course correction" on how I was approaching college turned my gpa around to where I made the President's List that semester and never did poorly in a class again. That meeting still has effect in my life today, twenty-five years later. I never would have made it as an engineer without that advice.
I hope that helps.
And thank you, Professor Weston Beale. I miss you greatly, but I'm eternally grateful for your wisdom and your willingness to work with a flunking student!
Joined: May 16, 2001
for people who read my first post and jumped to the conclusion that i was some wide-eyed, naive student seeking sagely advise on how to deal with an algorithm class, you have guessed wrong. i'm not asking for advice.
anyway, it is still interesting to read the different responses and analyze why people probably respond the way that they do.
i probably should have made it clear that i was not referring to algorithms in the general sense. i was refering to the cook-book style application of specific algorithms (from the already existing body of algorithms that have been discovered, analyzed and documented).
its obvious that every programmer has their own particular take on algorithms. i think it is fair to say that whether or not a given programmer "implements" (as opposed to simply "using") algorithms has a lot to do with how well they grok algoritms on an academic level.
Joined: Jul 30, 2003
In that case, I can give a very brief response: Algorithms from college, no; algorithms from the programming community, yes.
It is not useless to be exposed to algorithms even though one does not forcibly use them as pointed out in the previous posts with which I agree.
I once had to program (in Cobol) some sorting. I tried the simplest and least sophisticated algorithm and found out that 90% of the whole processing time was due to the actual reordering of the records in the database, which could not be made faster, and 10% went for the sorting itself: it had been pointless to optimize it.
The way we program has evolved since. There are mature libraries to rely upon, we use components etc.
The good old days of programming monolithic programs and rolling out your own implementations even for basic algorithms seem to have mostly gone.
But that does not mean one does not need to know about algorithms, their speed, simplicity vs. speed or time vs. space trade-off issues etc.
will boyd wrote:for people who read my first post and jumped to the conclusion that i was some wide-eyed, naive student seeking sagely advise on how to deal with an algorithm class, you have guessed wrong...
Nope. To be honest, it sounded like you might be trawling for information for a thesis.
For my part, I certainly use some of the algorithms I learned in CS, but not on a daily basis. And I totally agree with Fred's post, and can't really add much to it.
Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
subject: who uses algorithms they learned in cs classes?