You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
3.5 KiB
HTML
80 lines
3.5 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
|
|
"http://www.w3.org/TR/html4/loose.dtd">
|
|
<html >
|
|
<head><title>Heap data structure</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<meta name="generator" content="TeX4ht (http://www.tug.org/tex4ht/)">
|
|
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)">
|
|
<!-- html,3 -->
|
|
<meta name="src" content="userhtml.tex">
|
|
<link rel="stylesheet" type="text/css" href="userhtml.css">
|
|
</head><body
|
|
>
|
|
<!--l. 1314--><div class="crosslinks"><p class="noindent">[<a
|
|
href="userhtmlsu8.html" >prev</a>] [<a
|
|
href="userhtmlsu8.html#tailuserhtmlsu8.html" >prev-tail</a>] [<a
|
|
href="userhtmlsu6.html#tailuserhtmlsu9.html">tail</a>] [<a
|
|
href="userhtmlsu7.html#userhtmlsu11.html" >up</a>] </p></div>
|
|
<h4 class="subsectionHead"><span class="titlemark">3.5 </span> <a
|
|
id="x17-540003.5"></a>Heap data structure</h4>
|
|
<!--l. 1316--><p class="noindent" >Among the tools routines of sec. <a
|
|
href="userhtmlse6.html#x40-770006">6<!--tex4ht:ref: sec:toolsrout --></a>, we have a number of sorting utilities; the heap
|
|
sort is implemented in terms of heaps having the following signatures:
|
|
<dl class="description"><dt class="description">
|
|
<span
|
|
class="cmtt-10">psb</span><span
|
|
class="cmtt-10">_T</span><span
|
|
class="cmtt-10">_heap</span> </dt><dd
|
|
class="description">: a heap containing elements of type T, where T can be <span class="obeylines-h"><span class="verb"><span
|
|
class="cmtt-10">i,s,c,d,z</span></span></span>
|
|
for integer, real and complex data;
|
|
</dd><dt class="description">
|
|
<span
|
|
class="cmtt-10">psb</span><span
|
|
class="cmtt-10">_T</span><span
|
|
class="cmtt-10">_idx</span><span
|
|
class="cmtt-10">_heap</span> </dt><dd
|
|
class="description">: a heap containing elements of type T, as above, together
|
|
with an integer index.</dd></dl>
|
|
<!--l. 1325--><p class="noindent" >Given a heap object, the following methods are defined on it:
|
|
<dl class="description"><dt class="description">
|
|
<span
|
|
class="cmbx-10">init</span> </dt><dd
|
|
class="description">Initialize memory; also choose ascending or descending order;
|
|
</dd><dt class="description">
|
|
<span
|
|
class="cmbx-10">howmany</span> </dt><dd
|
|
class="description">Current heap occupancy;
|
|
</dd><dt class="description">
|
|
<span
|
|
class="cmbx-10">insert</span> </dt><dd
|
|
class="description">Add an item (or an item and its index);
|
|
</dd><dt class="description">
|
|
<span
|
|
class="cmbx-10">get</span><span
|
|
class="cmbx-10">_first</span> </dt><dd
|
|
class="description">Remove and return the first element;
|
|
</dd><dt class="description">
|
|
<span
|
|
class="cmbx-10">dump</span> </dt><dd
|
|
class="description">Print on file;
|
|
</dd><dt class="description">
|
|
<span
|
|
class="cmbx-10">free</span> </dt><dd
|
|
class="description">Release memory.</dd></dl>
|
|
<!--l. 1335--><p class="noindent" >These objects are used in MLD2P4 to implement the factorization algorithms.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
|
|
href="userhtmlsu8.html" >prev</a>] [<a
|
|
href="userhtmlsu8.html#tailuserhtmlsu8.html" >prev-tail</a>] [<a
|
|
href="userhtmlsu9.html" >front</a>] [<a
|
|
href="userhtmlsu7.html#userhtmlsu11.html" >up</a>] </p></div>
|
|
<!--l. 1--><p class="indent" > <a
|
|
id="tailuserhtmlsu9.html"></a>
|
|
</body></html>
|