[zt]Which are the 10 algorithms every computer science student must implement at least once in life?
More important than algorithms(just problems #$!%), the techniques/concepts residing at the base of such algorithms is more important.
There are broadly 4 ways in which classification of algorithms can be done.
- Classification by purpose
Each algorithm has a goal, for example, the purpose of the Quick Sort algorithm is to sort data in ascending or descending order. But the number of goals is infinite, and we have to group them by kind of purposes.
2. Classification by implementation
- Recursive or iterative
A recursive algorithm is one that calls itself repeatedly until a certain condition matches. It is a method common to functional programming.
For example, the towers of hanoi problem is well understood in recursive implementation. Every recursive version has an iterative equivalent iterative, and vice versa. - Logical or procedural
An algorithm may be viewed as controlled logical deduction.
A logic component expresses the axioms which may be used in the computation and a control component determines the way in which deduction is applied to the axioms. - Serial or parallel Algorithms are usually discussed with the assumption that computers execute one instruction of an algorithm at a time. This is a serial algorithm, as opposed to parallel algorithms, which take advantage of computer architectures to process several instructions at once. Sorting algorithms can be parallelized efficiently.
- Deterministic or non-deterministic
Deterministic algorithms solve the problem with a predefined process whereas non-deterministic algorithm must perform guesses of best solution at each step through the use of heuristics.
3. Classification by design paradigm
- Divide and conquer
A divide and conquer algorithm repeatedly reduces an instance of a problem to one or more smaller instances of the same problem (usually recursively), until the instances are small enough to solve easily. One such example of divide and conquer is merge sorting. The binary search algorithm is an example of a variant of divide and conquer called decrease and conquer algorithm, that solves an identical subproblem and uses the solution of this subproblem to solve the bigger problem. - Dynamic programming
The shortest path in a weighted graph can be found by using the shortest path to the goal from all adjacent vertices.
When the optimal solution to a problem can be constructed from optimal solutions to subproblems, using dynamic programming avoids recomputing solutions that have already been computed.
- The main difference with the "divide and conquer" approach is, subproblems are independent in divide and conquer, where as the overlap of subproblems occur in dynamic programming.
- Dynamic programming and memoization go together. The difference with straightforward recursion is in caching or memoization of recursive calls. Where subproblems are independent, this is useless. By using memoization or maintaining a table of subproblems already solved, dynamic programming reduces the exponential nature of many problems to polynomial complexity. - The greedy method
A greedy algorithm is similar to a dynamic programming algorithm, but the difference is that solutions to the subproblems do not have to be known at each stage. Instead a "greedy" choice can be made of what looks the best solution for the moment.
The most popular greedy algorithm is finding the minimal spanning tree as given by Kruskal. - Linear programming
The problem is expressed as a set of linear inequalities and then an attempt is made to maximize or minimize the inputs. This can solve many problems such as the maximum flow for directed graphs, notably by using the simplex algorithm.
A complex variant of linear programming is called integer programming, where the solution space is restricted to all integers. - Reduction also called transform and conquer
Solve a problem by transforming it into another problem. A simple example:finding the median in an unsorted list is first translating this problem into sorting problem and finding the middle element in sorted list. The main goal of reduction is finding the simplest transformation possible. - Using graphs
Many problems, such as playing chess, can be modeled as problems on graphs. A graph exploration algorithms are used.
This category also includes the search algorithms and backtracking. - The probabilistic and heuristic paradigm
- Probabilistic
Those that make some choices randomly. - Genetic
Attempt to find solutions to problems by mimicking biological evolutionary processes, with a cycle of random mutations yielding successive generations of "solutions". Thus, they emulate reproduction and "survival of the fittest". - Heuristic
Whose general purpose is not to find an optimal solution, but an approximate solution where the time or resources to find a perfect solution are not practical.
__________________________________________________________________
You can look at Algorithms Repository
1. Searching and sorting algorithms -
Sorting algorithms include Quicksort
, Merge sort, Heapsort, Bubble sort,Insertion sort, Radix sort. Other imp soting algorithms are Topological sort, Counting sort, Shell sort
A comprehensive list can be found here.
Important searching algorithms include breadth/ depth first search, binary search etc.
2. Dynamic Programming -- To name a few DP problems, Longest Common Subsequence problem, Knapsack, travelling salesman problem etc. A list of dynamic programming algorithms can be found here.
3. Graph algorithms -- Important graph algorithms are Dijkstra, Prim,
Kruskal, Bellman-Ford. A comprehensive list can be found here.
Good luck !!!
[zt]Which are the 10 algorithms every computer science student must implement at least once in life?的更多相关文章
- What every computer science major should know 每一个计算机科学专业的毕业生都应该都知道的
Given the expansive growth in the field, it's become challenging to discern what belongs in a modern ...
- Top 10 Algorithms of 20th and 21st Century
Top 10 Algorithms of 20th and 21st Century MATH 595 (Section TTA) Fall 2014 TR 2:00 pm - 3:20 pm, Ro ...
- 18 Candidates for the Top 10 Algorithms in Data Mining
Classification============== #1. C4.5 Quinlan, J. R. 1993. C4.5: Programs for Machine Learning.Morga ...
- What are the 10 algorithms one must know in order to solve most algorithm challenges/puzzles?
QUESTION : What are the 10 algorithms one must know in order to solve most algorithm challenges/puzz ...
- Top 10 Algorithms for Coding Interview--reference
By X Wang Update History:Web Version latest update: 4/6/2014PDF Version latest update: 1/16/2014 The ...
- 转:Top 10 Algorithms for Coding Interview
The following are top 10 algorithms related concepts in coding interview. I will try to illustrate t ...
- Georgia Tech Online Master of Science in Computer Science 项目经验分享
Georgia Tech Online Master of Science in Computer Science 项目经验分享 Posted on 2014/04/22 项目关键词:工科名校,计算机 ...
- Discovering the Computer Science Behind Postgres Indexes
This is the last in a series of Postgres posts that Pat Shaughnessy wrote based on his presentation ...
- [转载] A set of top Computer Science blogs
This started out as a list of top Computer Science blogs, but it more closely resembles a set: the o ...
随机推荐
- NeHe OpenGL教程 第三十五课:播放AVI
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- java finally中含return语句
<java核心技术卷一>中提到过:当finally子句包含return 语句时(当然在设计原则上是不允许在finally块中抛出异常或者 执行return语句的,我不明白为何java的设计 ...
- 【转】H264编码原理以及I帧B帧P帧
前言 H264是新一代的编码标准,以高压缩高质量和支持多种网络的流媒体传输著称,在编码方面,我理解的他的理论依据是:参照一段时间内图像的统计结果表明,在相邻几幅图像画面中,一般有差别的像素只有10%以 ...
- PHP批量替换MySql数据库中的数据内容(替换MySql数据库内容源码)
PHP批量替换MySql数据库内容 UTF-8 1.0版 <?php //声明 //1.本源码开发意图:作者在使用一些CMS建站的时候发现很多CMS把网址写入到数据库了,如果换网址,那么就需要更 ...
- Java注解教程及自定义注解
Java注解提供了关于代码的一些信息,但并不直接作用于它所注解的代码内容.在这个教程当中,我们将学习Java的注解,如何定制注解,注解的使用以及如何通过反射解析注解. Java1.5引入了注解,当前许 ...
- iPhone播放音乐
来源:http://blog.csdn.net/htttw/article/details/7842295 iPhone播放音乐 今天我们简要介绍如何在iPhone中播放音乐: 强烈建议你参考官方文档 ...
- rails中两种回滚-reversible和revert区别
1 通常迁移内容写在change方法中 ,但是有些迁移内容不能自动通过执行rake:rollback回滚, 所以在迁移文件里要使用 reversible 方法,告诉rails如何回滚例如下面 # co ...
- PHP的require()函数可以在一行代码中多次读取
[root@NJ232:~]$[root@NJ232:~]$more tt.php m#!/opt/php/bin/php -q<?phpwhile(1){ sleep(2); $arr = r ...
- c# partial类
partial类就是说明这个类是写在几个文件里面的,这里只是一部分. partial是一个类修饰符,用于把类定义拆分为几个部分,便于代码管理,如class ClassA{void A(){;}void ...
- Mac添加环境变量的三种方法
法一: sudo vi /etc/paths 来编辑 paths,将环境变量添加到 paths 中. vim 是一个编辑器,另外还有几个,如:Pico,Emacs. Hint:输入环境变量时,不用一个 ...