📄 greedyalgo.html
字号:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD W3 HTML 2.0//EN">
<HTML lang="en-US">
<HEAD>
<TITLE>greedy algorithm</TITLE>
<META name="description"
content="Definition of greedy algorithm,
possibly with links to more information and implementations.">
<META name="keywords" content="greedy algorithm">
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<H1>greedy algorithm</H1>
<P>
(algorithmic technique)
<P>
<strong>Definition:</strong>
An algorithm which always takes the best immediate, or local, solution while finding an answer. Greedy algorithms will always find the overall, or globally, optimal solution for some problems, but may find less-than-optimal solutions for some instances of other problems.
<P><em>Note:
<a href="primsalgrthm.html" tppabs="http://hissa.nist.gov/dads/HTML/primsalgrthm.html"><em>Prim's algorithm</em></a> and <a href="kruskalsalgo.html" tppabs="http://hissa.nist.gov/dads/HTML/kruskalsalgo.html"><em>Kruskal's algorithm</em></a> are greedy algorithms which find the globally optimal solution, a <a href="minspantree.html" tppabs="http://hissa.nist.gov/dads/HTML/minspantree.html"><em>minimum spanning tree</em></a>. In contrast, any known greedy algorithm to find an <a href="eulercycle.html" tppabs="http://hissa.nist.gov/dads/HTML/eulercycle.html"><em>Euler cycle</em></a> might not find the shortest path, that is, a solution to the <a href="travelsales.html" tppabs="http://hissa.nist.gov/dads/HTML/travelsales.html"><em>traveling salesman</em></a> problem. <P> If there is no greedy algorithm which always finds the optimal solution for a problem, one may have to search (exponentially) many possible solutions to find the optimum. Greedy algorithms are usually quicker, since they don't consider possible alternatives.</em>
<P>Author: <a href="terms.html#authorPEB" tppabs="http://hissa.nist.gov/dads/terms.html#authorPEB">PEB</a>
<hr>
Go to the
<A HREF="terms.html" tppabs="http://hissa.nist.gov/dads/terms.html">Algorithms, Data Structures, and Problems</A>
home page.
<hr>
If you have suggestions, corrections, or comments, please get in touch
with
<a href="javascript:if(confirm('http://hissa.nist.gov/~black/black.html \n\nThis file was not retrieved by Teleport Pro, because it is addressed on a domain or path outside the boundaries set for its Starting Address. \n\nDo you want to open it from the server?'))window.location='http://hissa.nist.gov/~black/black.html'" tppabs="http://hissa.nist.gov/~black/black.html">Paul E. Black</a>
(<a href="mailto:paul.black@nist.gov">paul.black@nist.gov</a>).
<p>
Entry modified Wed Apr 14 14:55:44 1999.<BR>
HTML page formatted Wed Dec 22 09:35:27 1999.
<P>
This page's URL is
<A href="greedyalgo.html" tppabs="http://hissa.nist.gov/dads/HTML/greedyalgo.html">http://hissa.nist.gov/dads/HTML/greedyalgo.html</A>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -