4 ms·
When programming in high level OO languages, which have ready algorithms and data structures are pretty-much standard, what's your use-case of algorithms? I've
by atmosx 12y ago
When programming in high level OO languages, which have ready algorithms and data structures are pretty-much standard, what's your use-case of algorithms?
I've seen entire projects which do not require specific knowledge or application of any algorithm. Even when they do, one can google and find "best algorithm for XYZ", then find a library which has the algorithm implemented and off you go.
I understand the use of algorithms in low level languages and specific domains, but when you need to sort a ruby array you just "array.sort" and a default (IIRC the default in ruby is a version of quick-sort) sorting algorithm is applied, which 9 out of 10 is the faster solution you'll get given the language constrains.
Can you offer an example of specific situation, in any OO-language with reasonable amount of available libraries, where deep knowledge of design and analysis of algorithms is actually required?
- modarts 12y ago> Can you offer an example of specific situation, in any OO-language with reasonable amount of available libraries, where deep knowledge of design and analysis of algorithms is actually required? Interviews :)
- sheepmullet 12y ago"Can you offer an example of specific situation, in any OO-language with reasonable amount of available libraries, where deep knowledge of design and analysis of algorithms is actually required?" You won't get very many good replies because you are asking the wrong questions. The truth is you don't even need a decent understanding of OO for most day to day dev. You will just produce suboptimal work. A better question is: "...where reasonable knowledge of design and analysis of algorithms allows you to do a better job?" And the answer to this more reasonable question is: Every single project I've worked on as an enterprise developer over the last 10+ years. Being able to say "hey actually this problem we are working on can be formulated as a graph problem" can turn a 3 month problem into a 3 day problem. For example we recently had a rules engine rule dependency issue that turned out to be expressable as graph problem and was then easily solved. If nobody in the team had a good knowledge of algorithms we still could have solved the issue but it just would have taken a lot longer. And unfortunately until you can phrase the problem in the right way you can't just google "find best algorithm for XYZ".
- atmosx 12y agoThat is an enlightening answer, thanks.
- andersonvieira 12y agoThere are cases where you must adapt a known algorithm to fit your domain. In my job, for example, we work with automatic train dispatch planning [1]. The application is built in Java and one of the main components of the route planning is a custom depth-first search. The search tries to move a train through a series of connected tracks while considering the passage of time and checking for time-dependent constraints such as track blocks, other trains, speed restrictions, etc. This couldn't be done using a standard library implementation. Also, I believe such knowledge will make you a better programmer, even if you don't have to build everything from scratch. I have seen experienced developers using a list to store unique elements, when the only read operation they would do was to check if an element was in the list. Their solution to speed up the checks was to sort the list every time it was modified and then run a binary search. In this case, better knowledge of algorithm complexity and data structures could lead to a much faster solution, using a set for example. [1] http://www.academia.edu/6128585/A_Heuristic_Approach_to_Train_Dispatch_Planning http://www.academia.edu/6128585/A_Heuristic_Approach_to_Trai...