Jump to content
Sign in to follow this  
imdow123

Algorithms and computer science

Recommended Posts

I've just been wondering, why do we study algorithms in a computer science course.

Algorithms are just a way to precisely define steps to solve a particular problem. This is not just important in computer science but basically in any field.

 

I mean, algorithms just teach us how to solve problems step-by-step in a well-defined manner. These skills are useful not just for computer science but for every branch.

Then why just computer science course has an algorithms course? Why not others?

Share this post


Link to post
Share on other sites

Then why just computer science course has an algorithms course? Why not others?

An algorithm is just a step-by-step procedure to calculate something. As you say, algorithms appear across mathematics, science and engineering. I taught my linear algebra students more or less nothing but algorithms.

 

 

The problem maybe that algorithms are usually ad hoc and so teaching "algorithms" may not be very useful in general. That said, I have no idea what would be covered on a computer science course.

Share this post


Link to post
Share on other sites

In almost all colleges, a whole semester is spent on teaching algorithms in a computer science course.

It starts with teaching some common algorithms used for sorting, searching in graphs etc. Then they teach different techniques like divide and conquer, dynamic programming etc.

 

Yes, algorithms appear across all domains. But they don't teach different techniques to solve problems like in a computer science course is done. Techniques like divide and conquer, dynamic programming, greedy algorithms etc. is not taught elsewhere althought I guess they might be useful in all domains. Why?

Share this post


Link to post
Share on other sites

I've just been wondering, why do we study algorithms in a computer science course.

Algorithms are just a way to precisely define steps to solve a particular problem. This is not just important in computer science but basically in any field.

 

I mean, algorithms just teach us how to solve problems step-by-step in a well-defined manner. These skills are useful not just for computer science but for every branch.

Then why just computer science course has an algorithms course? Why not others?

 

Computer science is essentially an applied science that uses tried and tested solutions on a number-crunching engine to generate speedy results.

 

To illustrate, you could use a bubble sort for ordering or a matrix approach for solving a linear equation. Computer languages provide a platform to translate these scenarios into real time solutions.

 

Computer programming without a proper algorithm would be :

 

- too slow

- logically weak

- syntactically redundant

 

I think this describes the gist of my argument.

Share this post


Link to post
Share on other sites

I've just been wondering, why do we study algorithms in a computer science course.

Algorithms are just a way to precisely define steps to solve a particular problem. This is not just important in computer science but basically in any field.

 

I mean, algorithms just teach us how to solve problems step-by-step in a well-defined manner. These skills are useful not just for computer science but for every branch.

Then why just computer science course has an algorithms course? Why not others?

 

Suppose so you have array of strings, and have to find string with exact name.

The basic logical way of solving it is to go through all entries of array and compare. Working but slow.

 

const char *string; // argument

const char *entries[]; // array

int length;

for( int i = 0; i < length; i++ )

{

if( !strcmp( entries[ i ], string ) return( i ); // string found, return index

}

return( -1 ); // string not found, return invalid index -1

 

For 1000 entries, it will have to compare 1000 strings (at worse case).

For 1 mln entries, it will have to compare 1 mln strings (at worse case).

 

There are algorithms that can speed up this process.

 

For instance, you can sort array in alphabetical order.

Then compare middle entry with what we are searching for.

 

int tmp = strcmp( entries[ length / 2 ], string );

if( tmp == 0 ) // string found,

else if( tmp > 0 ) // string must be in one part of array

else if( tmp < 0 ) // string must be in other part of array

 

Now you see, one compare function used, and we have just reduced quantity of entries to compare to half of initial.

 

If initial length of array is 1000

and we will be using such algorithm recursively

we will have quantity of elements to check:

 

1000

500

250

125

62

31

15

7

3

1

 

Just 10 compare functions to find string in 1000 elements array, instead of 1000 in previous brute force algorithm.

 

Where would you learn about such algorithm if not on lesson about algorithms?

Edited by Sensei

Share this post


Link to post
Share on other sites

I think everyone has missed imdow123's point. The question is essentially about curriculum, not algorithms.

...
I mean, algorithms just teach us how to solve problems step-by-step in a well-defined manner. These skills are useful not just for computer science but for every branch.
Then why just computer science course has an algorithms course? Why not others?


Can students not in the computer science major take the extant algorithm courses if they want to?

I think the subject of algorithms is an important & useful concept that has a place in the wider general studies and per se liberal arts curriculum. The subject would need to be geared to that general audience by including examples outside of computer science, e.g. cooking recipes as algorithms, or following one of those damnable instruction sheets that comes with 'some assembly required' cargo. Perhaps include algorithms as a section of another course, such as a course on critical thinking.

Share this post


Link to post
Share on other sites

Can students not in the computer science major take the extant algorithm courses if they want to?

That will depend on the university and maybe even the country you are studying in.

 

For me, it may have been possible to take sit a module in computer science, but at the time I would not have wanted to as I would not have been aware of the potential usefulness of "algorithms class".

 

I can only really speak about my own undergraduate experience here, I was taught lots of algorithms, including some numerical methods, in order to solve particular kinds of problems. Maybe some overreaching theory could have been useful, but I wonder if on top of everything else it would have been a distraction.

 

So, any course cannot cover everything and so people have to prioritise.

Where would you learn about such algorithm if not on lesson about algorithms?

Not that I personally do much computing, but when I have needed numerical methods, computer algorithms and similar for a particular problem I look at what other people have done for similar problems and tailor them. Maybe not the most clever way...

Share this post


Link to post
Share on other sites

I've just been wondering, why do we study algorithms in a computer science course.

Algorithms are just a way to precisely define steps to solve a particular problem. This is not just important in computer science but basically in any field.

 

I mean, algorithms just teach us how to solve problems step-by-step in a well-defined manner. These skills are useful not just for computer science but for every branch.

Then why just computer science course has an algorithms course? Why not others?

Whereas computers can only follow an algorithm, people are have a variety of problems following algorithms, including misunderstanding, boredom and mistakes. Nonetheless, people are taught algorithms, with varying results. For example, the scientific method is mistrusted and misunderstood by some. Moreover, some people like to be creative, and algorithms do not permit creativity. Finally, people usually work on issues and problems that defy algorithmic solution; thus, education is designed to give people the tools to work on things that defy algorithmic solution.

Share this post


Link to post
Share on other sites

Whereas computers can only follow an algorithm, people are have a variety of problems following algorithms, including misunderstanding, boredom and mistakes. Nonetheless, people are taught algorithms, with varying results. For example, the scientific method is mistrusted and misunderstood by some. Moreover, some people like to be creative, and algorithms do not permit creativity. Finally, people usually work on issues and problems that defy algorithmic solution; thus, education is designed to give people the tools to work on things that defy algorithmic solution.

 

Algorithms in different flavors permeate everyday life. Painting is an algorithm of colors, poetry is an algorithm of words, prose an algorithm of phrases, biology an algorithm of DNA, chemistry an algorithm of atoms and molecules etc. Algorithms are omnipresent in nature. It only takes a discerning eye to see them.... :blink:

Share this post


Link to post
Share on other sites

 

Algorithms in different flavors permeate everyday life. Painting is an algorithm of colors, poetry is an algorithm of words, prose an algorithm of phrases, biology an algorithm of DNA, chemistry an algorithm of atoms and molecules etc. Algorithms are omnipresent in nature. It only takes a discerning eye to see them.... :blink:

Math and algorithms are fundamental in nature.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.