views:

1434

answers:

19

Hi all,

This is my first qestion in the forum.

I am a student of Software Engineering. Today I asked this question to my teacher in class. But did not get any satisfactory answer

Can any one please give me some insight why should i learn this topic in my graduations.

+22  A: 

So that you can properly evaluate different approaches to solving a problem.

Ignacio Vazquez-Abrams
+1 I absolutely agree with that. It certainly helps you find ways of 'reordering' your thinking.
Nick Haslam
this is definitely my favorite answer .. less is more ..
c0mrade
+6  A: 

Learning algorithms will give you new insights into ways to solve problems that you wouldn't have if you only ever used software libraries.

You'll also learn about the complexity of different approaches to solve the same problem, and the trade-offs involved, in terms of speed, space etc.

Skilldrick
+5  A: 

I'd say it's so you can solve similar problems in whatever language your boss wants you to use. "Give a man a fish, he eats for a day, teach him to fish, he eats the rest of his life"

Arthur Kalliokoski
or until the fish run out...
Matt Ellen
"Give a man a fire and he's warm for the day, but set fire to him and he's warm for the rest of his life." — Terry Pratchett
Yrlec
@Matt - stop pedanting about those few weeks it takes to starve to death
Steve314
Give a man a fish, he eats for a day. Teach him to fish and he'll complain that he has better things to do than holding a stick over the water.
Christopher Creutzig
+16  A: 

As a programmer, everything you write - even a simple sequence of steps - is an algorithm. What you learn in an algorithms course includes how to evaluate the efficiency of algorithms (in terms of speed and space requirements), along with a convenient toolbox of standard good quality algorithms that you would be unlikely to invent for yourself.

Take a look here

Divide and conquer is probably among the simplest things you will learn, yet it isn't one algorithm but a general approach to designing algorithms that can be applied to a very wide range of problems.

Steve314
+1 for `convenient toolbox of standard good quality algorithms`. I was going to mention that you wont have to re-invent the wheel as you will recognize problems as needing a specific algorithm. The more algorithms you know the more times you can re-use tried and tested ideas.
James Brooks
+2  A: 

An algorithm is a set of instructions for solving a particular problem e.g. searching. There are many different ways to solve problems, and some are better than others. Studying algorithms should give you an appreciation of how different solutions can be, why some are better than others and help you compare algorithms. This should help you select the most appropriate algorithms when writing software.

There are many good algorithms which have been written and widely tested. Being aware of them allows you to reuse them, thus saving a lot of time and almost certainly give you a better, more efficient and robust solution.

macleojw
+1  A: 

So you don't have to reinvent the wheel. Algorithms are an optimal way to solve frequently occuring problems.

Padmarag
+2  A: 

Depends on what you want to do, you can get away with simple knowledge that lets you differentiate between tree-based associative container, a hash based associative container and a list. If you plan to develop software other then business applications/web development then you probably need to study basic algorithms in detail.

I say you can get away with it because most programming frameworks have pre-rolled implementations of the above concepts -- and you can solve a large amount of computing problems using them (give or take some wasted computing cycles).

Hassan Syed
dude, are u on a mission to scare us NOOBS. :P LOL!
BK
A hash-map *is* an associative container.
Steve314
C++ parlance, my bad.
Hassan Syed
+2  A: 

Because using certain algorithms in your software will result in HUGE performance improvements.

For example, if you have array of 1000000 unique elements, AND if you know binary search algorithm, you can find element in array using 20 comparison operations. If you don't know binary search, you will use up to one million operations.

Also, certain sorting algorithms may be much faster than even quicksort, but only if used data meets certain requirements. If you don't know the differences - you will use slower algorithms and waste CPU time.

Which means - if you don't learn at least basic algorithms (binary search, quick sort, merge sort, heap sort), you will write slow software which will eat computer resources for no reason. So as a result you will be probably replaced by someone more knowledgeable than you.

SigTerm
I can foresee; my life is very hard in next few months.
Vijay Shanker
+3  A: 

Oh, if you don't know why you should learn algorithms, then you shouldn't learn them at all. I can see a promising career for you as a Software Engineer.

fortran
Why the negative undertone? He never said he disagreed with it, he just said that he didn't get a good answer. It's a perfectly legitimate question.
Matt Olenik
The answer should be so obvious to anyone that is studying Software Engineering or any Computer Science related career... It's like somebody studying medicine asking why does he have to learn human anatomy.
fortran
@fortran: maybe that's because he didn't know the definition of the word 'algorithm'?
bancer
+8  A: 

Um, because you're a student of software engineering, so it's part of your job description? What kind of software do you plan to develop, that you don't expect to ever deal with an algorithm throughout your professional career? What kind of engineer do you expect to become, who doesn't know his components?

Heh, I bet you find that answer unsatisfactory.

comingstorm
+11  A: 

Besides all the interesting answers given here, I'd add one more thing: do it for yourself.

Learning and understanding algorithms it's a challenge. If you find joy or even small pleasure when you "get it", when you have an "a-ha!" moment, when your brain releases the chemicals that signal a reward - then you have the potential to become a good programmer, and will enjoy it more and more every day. It's a small addiction. Being a programmer more often than not means doing it as a profession (9-5 every day) and in your free time.

This is not a normal job. I do not know any lawyer that, when home, does laywer stuff. Or economists. Or MD. And they all make so much more money than I do. But still, part of becoming a programmer is more than just money. It's a quest for mathematical elegance.

Give it a try. You might find that the chief reason why you learn algorithms is because you like it.

lorenzog
Yes! lorenzog I am delighted after reading your post.
Vijay Shanker
+30  A: 
  • It's possible to describe an algorithm without programming, but you can't program without using algorithms.
  • Algorithms express a way to solve a problem independent of platform or language. Thus, you can talk about the relative merits of an algorithm without having to first learn a particular technology. Once you understand an algorithm, you can implement it in whatever language you wish. This makes algorithms a far more useful thing to know than a specific technology, however popular it may be.
  • Just as you need to know fundamental things about math to communicate with other mathematicians, or fundamentals of music to communicate with musicians, you need to understand fundamental algorithms to communicate with other programmers and computer scientists. It's part of the shared language and culture that makes up the discipline of computer science and engineering.
  • It's very difficult, if not impossible, to talk about program correctness, efficiency, time and space tradeoffs, and ways to improve programs without knowing algorithm analysis and design.
Feanor
+1 for (especially) the shared culture aspect
Steve314
+1  A: 

You shoud learn algorithms because this is the fundamental toolbox of any software engineer. In fact, a program, which ever programming language you use, is the implementation of an algorithm.

Beside the usual basics sorting algorithms and other iterative or recursive constructs, you will see that algorithms are also of other nature like distributed algorithms.

Making a computer sorting a list of values is easy and learning that sound boring. Making two computer sorting the same list together could be less easy. In fact, you will never be able to solve the second problem without knowing how to solve the first one.

Speaking of sorting list sounds trivial ? Now, imagine you should develop the online system that will sell tickets for the next big summer festival where 1 billion people will try to buy their ticket at the same time ... how would you implement the priority queue amongst your ten server and assert that the website won't go down if you say, some years ago, to your teacher "I don't want to learn your boring algorithms" :)

Hope you see the concret interest now.

Kaltezar
Yes sir,But your details are out of my mind. But yes I feel like understanding something. By the way thanks for your answer.
Vijay Shanker
+3  A: 

Because software engineering is not about writing programs, it's about solving problems. Programs are the questions. Algorithms are the answers.

erelender
A: 

so you wont be unemployed

Hellfrost
+1  A: 

The practice of software engineering is the application of algorithms. Why you would want to learn pre-existing ones is that you are unlikely to invent the best algorithms yourself, given typical constraints of time and money. You could get by with only using libraries (defer the work of learning, understanding and developing algorithms to someone else), but this strategy will only get you so far: at some point, you will be faced with a situation where you don't have a ready library, and you must develop a technique yourself; and in this situation, having knowledge of how the standard algorithms function is immensely valuable, even when those standard algorithms are not directly applicable to your situation.

cjrh
+1  A: 

You could as well ask why you should learn anything: multiplication tables, life of Shakespeare, foreign languages...

Algorithms and data structures are your building blocks.

Computer programs are entirely made of algorithms and data structures. You are not simply learning some standard solutions to common problems. You are starting to think like a Software Engineer. You are starting to understand how computer programs work, and learning how to decompose problems and find your own solution.

G B
A: 

this is like if you say, "why should i learn kamasutra in order to learn to make love"

it is up to you

asdf
A: 

Because Programs = Algorithms + data structures.

Ramakrishnan Muthukrishnan