Jump to content
xisto Community
slidstream

Whats Your Favorite Algorithm Theres alot out there

Recommended Posts

This may be way to broad, in both CS and Math. My personal favorite algorithm may be the PageRank, because it is just so beautifully done, it really is, look at it. But there are many more, graph theories max-flow min-cut, or the shortest distance between to vertices. But there are many others, take number theories algorithm for finding if two numbers are prime to eachother, simply cool.So, what is your favorite algorithm, and why? Do you have a programming example to show us?

Share this post


Link to post
Share on other sites

Hi!The first algorithm I ever learned was the bubble sorting algorithm. It is quite simple, but before I figured out the bubble sort, I did a less efficient algorithm that did a 1 to N loop on both the inner and outer loops so I was comparing more elements than I needed to. After I figured out the bubble sort, I thought there couldn't be any other way to compare the elements of an array till I read about the O(n) algorithms, particularly merge sort and quick sort. It is getting such that business application programmers and web programmers don't have to code algorithms any more - libraries, the language features, or development frameworks take care of all the magic that happens behind the scenes, and this kind of abstract thinking is exactly what has enabled us to continue to build bigger and more powerful systems.Of all algorithms, I really like the binary search algorithm because it is quite simple yet very efficient at what it does. Sure, there are quicker ways, such as by doing a hash-lookup, but the simplicity of the binary search tree as a concept is what makes it so appealing.I probably can't paste the binary search tree on the forum, but I'll try to come up with a blog post about it.

Share this post


Link to post
Share on other sites

The only really serious algorithm for me was to play with path finding, I used A* Pathfinding algorithm for studies in to find the best path from point a to point b through roads for a car by also measuring different roads speed limits, road signs and etc. It was really interesting to write it.. So as I know those kind of algorithms also work in such applications as GPS in a car or Google maps :)Other algorithms for me was also to write some games.. and of course, sorting and search.. Even though in the studying days we needed to write a lot of mathematical algorithms, but usually a lot of them were written in books, so you just needed to implement them the way the home work and etc. required. :D

Share this post


Link to post
Share on other sites

My two favorite are the quick sort algorithm for sorting and the sieve algorithm, which is used for finding prime numbers efficiently. I like both of these because I learned them after I realized that the algorithms I used previously were inefficient and could be improved.

Share this post


Link to post
Share on other sites

Hi!
The first algorithm I ever learned was the bubble sorting algorithm. It is quite simple, but before I figured out the bubble sort, I did a less efficient algorithm that did a 1 to N loop on both the inner and outer loops so I was comparing more elements than I needed to. After I figured out the bubble sort, I thought there couldn't be any other way to compare the elements of an array till I read about the O(n) algorithms, particularly merge sort and quick sort. It is getting such that business application programmers and web programmers don't have to code algorithms any more - libraries, the language features, or development frameworks take care of all the magic that happens behind the scenes, and this kind of abstract thinking is exactly what has enabled us to continue to build bigger and more powerful systems.

Of all algorithms, I really like the binary search algorithm because it is quite simple yet very efficient at what it does. Sure, there are quicker ways, such as by doing a hash-lookup, but the simplicity of the binary search tree as a concept is what makes it so appealing.

I probably can't paste the binary search tree on the forum, but I'll try to come up with a blog post about it.


My favorite happens to be bubble sorting as well. When I first started C++ programming, I learned this technique which absolutely wowed me. I thought it was pretty genius at the time (I was around 12/13 years old). If you look at the wikipedia page for bubble sorting, you find some cool visual representation demonstrating how bubble sorting works.

Share this post


Link to post
Share on other sites

I can’t really say I have a favorite algorithm but I do have one that caused me much grief while in school. One of the first algorithms covered in my 200 level algorithms class were N-way trees. Perhaps the professor just explained them poorly or my brain just doesn’t think that way, but they were almost the end of me. We had to create a c program that implemented an N-way tree from scratch without any source code reference. The problems started to pile up when the tree had to be balanced if a new node or branch was added or removed. I ended up cutting up small pieces of paper and labeling them with node names and placing them on my kitchen counter. I would then step through the algorithm by rearranging the pieces of paper on the counter. It was the only way I could visualize the problem and I finally got a working program after many hours of working through the problem in my head.I am very glad that modern programming languages come with these basic algorithm already solved because understanding and implementing them from scratch can suck.

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

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.