| |
|
Welcome to AstaHost - Dear Guest | |
Toggle shoutbox
Shoutbox
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Whats Your Favorite Algorithm
#1
Posted 30 June 2010 - 04:27 PM
So, what is your favorite algorithm, and why? Do you have a programming example to show us?
#2
Posted 06 July 2010 - 05:16 PM
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.
#3
Posted 20 July 2010 - 07:41 AM
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.
#4
Posted 10 October 2010 - 06:54 PM
#5
Posted 09 November 2010 - 01:00 PM
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.
#6
Posted 09 November 2010 - 11:51 PM
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.
Reply to this topic
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











