777 lines
30 KiB
HTML
777 lines
30 KiB
HTML
<!DOCTYPE HTML>
|
|
<!-- NewPage -->
|
|
<html lang="fr">
|
|
<head>
|
|
<!-- Generated by javadoc (11.0.6) on Mon Mar 16 10:16:49 CET 2020 -->
|
|
<title>BinaryHeap</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<meta name="dc.created" content="2020-03-16">
|
|
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
|
<link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style">
|
|
<script type="text/javascript" src="../../../../../script.js"></script>
|
|
<script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script>
|
|
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script>
|
|
<!--[if IE]>
|
|
<script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script>
|
|
<![endif]-->
|
|
<script type="text/javascript" src="../../../../../jquery/jquery-3.3.1.js"></script>
|
|
<script type="text/javascript" src="../../../../../jquery/jquery-migrate-3.0.1.js"></script>
|
|
<script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript"><!--
|
|
try {
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="BinaryHeap";
|
|
}
|
|
}
|
|
catch(err) {
|
|
}
|
|
//-->
|
|
var data = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10};
|
|
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
|
|
var altColor = "altColor";
|
|
var rowColor = "rowColor";
|
|
var tableTab = "tableTab";
|
|
var activeTableTab = "activeTableTab";
|
|
var pathtoroot = "../../../../../";
|
|
var useModuleDirectories = true;
|
|
loadScripts(document, 'script');</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
<header role="banner">
|
|
<nav role="navigation">
|
|
<div class="fixedNav">
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<div class="topNav"><a id="navbar.top">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a id="navbar.top.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../../../index.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/BinaryHeap.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList" id="allclasses_navbar_top">
|
|
<li><a href="../../../../../allclasses.html">All Classes</a></li>
|
|
</ul>
|
|
<ul class="navListSearch">
|
|
<li><label for="search">SEARCH:</label>
|
|
<input type="text" id="search" value="search" disabled="disabled">
|
|
<input type="reset" id="reset" value="reset" disabled="disabled">
|
|
</li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_top");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li><a href="#field.summary">Field</a> | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#field.detail">Field</a> | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a id="skip.navbar.top">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
</div>
|
|
<div class="navPadding"> </div>
|
|
<script type="text/javascript"><!--
|
|
$('.navPadding').css('padding-top', $('.fixedNav').css("height"));
|
|
//-->
|
|
</script>
|
|
</nav>
|
|
</header>
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<main role="main">
|
|
<div class="header">
|
|
<div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">org.insa.graphs.algorithm.utils</a></div>
|
|
<h2 title="Class BinaryHeap" class="title">Class BinaryHeap<E extends java.lang.Comparable<E>></h2>
|
|
</div>
|
|
<div class="contentContainer">
|
|
<ul class="inheritance">
|
|
<li>java.lang.Object</li>
|
|
<li>
|
|
<ul class="inheritance">
|
|
<li>org.insa.graphs.algorithm.utils.BinaryHeap<E></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
<div class="description">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<dl>
|
|
<dt>All Implemented Interfaces:</dt>
|
|
<dd><code><a href="PriorityQueue.html" title="interface in org.insa.graphs.algorithm.utils">PriorityQueue</a><E></code></dd>
|
|
</dl>
|
|
<hr>
|
|
<pre>public class <span class="typeNameLabel">BinaryHeap<E extends java.lang.Comparable<E>></span>
|
|
extends java.lang.Object
|
|
implements <a href="PriorityQueue.html" title="interface in org.insa.graphs.algorithm.utils">PriorityQueue</a><E></pre>
|
|
<div class="block">Implements a binary heap containing elements of type E.
|
|
|
|
Note that all comparisons are based on the compareTo method, hence E must
|
|
implement Comparable</div>
|
|
<dl>
|
|
<dt><span class="simpleTagLabel">Author:</span></dt>
|
|
<dd>Mark Allen Weiss, DLB</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="summary">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- =========== FIELD SUMMARY =========== -->
|
|
<section role="region">
|
|
<ul class="blockList">
|
|
<li class="blockList"><a id="field.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Field Summary</h3>
|
|
<table class="memberSummary">
|
|
<caption><span>Fields</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colSecond" scope="col">Field</th>
|
|
<th class="colLast" scope="col">Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<td class="colFirst"><code>protected java.util.ArrayList<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>></code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#array">array</a></span></code></th>
|
|
<td class="colLast"> </td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<td class="colFirst"><code>private int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#currentSize">currentSize</a></span></code></th>
|
|
<td class="colLast"> </td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
<section role="region">
|
|
<ul class="blockList">
|
|
<li class="blockList"><a id="constructor.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Summary</h3>
|
|
<table class="memberSummary">
|
|
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Constructor</th>
|
|
<th class="colLast" scope="col">Description</th>
|
|
</tr>
|
|
<tr class="altColor">
|
|
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E()">BinaryHeap</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Construct a new empty binary heap.</div>
|
|
</td>
|
|
</tr>
|
|
<tr class="rowColor">
|
|
<th class="colConstructorName" scope="row"><code><span class="memberNameLink"><a href="#%3Cinit%3E(org.insa.graphs.algorithm.utils.BinaryHeap)">BinaryHeap</a></span>​(<a href="BinaryHeap.html" title="class in org.insa.graphs.algorithm.utils">BinaryHeap</a><<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>> heap)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Construct a copy of the given heap.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
<section role="region">
|
|
<ul class="blockList">
|
|
<li class="blockList"><a id="method.summary">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Summary</h3>
|
|
<table class="memberSummary">
|
|
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
|
|
<tr>
|
|
<th class="colFirst" scope="col">Modifier and Type</th>
|
|
<th class="colSecond" scope="col">Method</th>
|
|
<th class="colLast" scope="col">Description</th>
|
|
</tr>
|
|
<tr id="i0" class="altColor">
|
|
<td class="colFirst"><code>private void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#arraySet(int,E)">arraySet</a></span>​(int index,
|
|
<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> value)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Set an element at the given index.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i1" class="rowColor">
|
|
<td class="colFirst"><code><a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a></code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#deleteMin()">deleteMin</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Remove and return the smallest item from the priority queue.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i2" class="altColor">
|
|
<td class="colFirst"><code><a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a></code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#findMin()">findMin</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Retrieve (but not remove) the smallest item in the queue.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i3" class="rowColor">
|
|
<td class="colFirst"><code>protected int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#indexLeft(int)">indexLeft</a></span>​(int index)</code></th>
|
|
<td class="colLast"> </td>
|
|
</tr>
|
|
<tr id="i4" class="altColor">
|
|
<td class="colFirst"><code>protected int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#indexParent(int)">indexParent</a></span>​(int index)</code></th>
|
|
<td class="colLast"> </td>
|
|
</tr>
|
|
<tr id="i5" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#insert(E)">insert</a></span>​(<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> x)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Insert the given element into the queue.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i6" class="altColor">
|
|
<td class="colFirst"><code>boolean</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#isEmpty()">isEmpty</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Check if the priority queue is empty.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i7" class="rowColor">
|
|
<td class="colFirst"><code>private void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#percolateDown(int)">percolateDown</a></span>​(int index)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Internal method to percolate down in the heap.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i8" class="altColor">
|
|
<td class="colFirst"><code>private void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#percolateUp(int)">percolateUp</a></span>​(int index)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Internal method to percolate up in the heap.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i9" class="rowColor">
|
|
<td class="colFirst"><code>void</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#remove(E)">remove</a></span>​(<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> x)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Remove the given element from the priority queue.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i10" class="altColor">
|
|
<td class="colFirst"><code>int</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#size()">size</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Get the number of elements in this queue.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i11" class="rowColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toString()">toString</a></span>()</code></th>
|
|
<td class="colLast"> </td>
|
|
</tr>
|
|
<tr id="i12" class="altColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toStringSorted()">toStringSorted</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Creates a multi-lines string representing a sorted view of this binary heap.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i13" class="rowColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toStringSorted(int)">toStringSorted</a></span>​(int maxElement)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Creates a multi-lines string representing a sorted view of this binary heap.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i14" class="altColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toStringTree()">toStringTree</a></span>()</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Creates a multi-lines string representing a tree view of this binary heap.</div>
|
|
</td>
|
|
</tr>
|
|
<tr id="i15" class="rowColor">
|
|
<td class="colFirst"><code>java.lang.String</code></td>
|
|
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#toStringTree(int)">toStringTree</a></span>​(int maxDepth)</code></th>
|
|
<td class="colLast">
|
|
<div class="block">Creates a multi-lines string representing a tree view of this binary heap.</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<ul class="blockList">
|
|
<li class="blockList"><a id="methods.inherited.from.class.java.lang.Object">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Methods inherited from class java.lang.Object</h3>
|
|
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="details">
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<!-- ============ FIELD DETAIL =========== -->
|
|
<section role="region">
|
|
<ul class="blockList">
|
|
<li class="blockList"><a id="field.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Field Detail</h3>
|
|
<a id="currentSize">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>currentSize</h4>
|
|
<pre>private int currentSize</pre>
|
|
</li>
|
|
</ul>
|
|
<a id="array">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>array</h4>
|
|
<pre>protected final java.util.ArrayList<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> extends java.lang.Comparable<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>>> array</pre>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<!-- ========= CONSTRUCTOR DETAIL ======== -->
|
|
<section role="region">
|
|
<ul class="blockList">
|
|
<li class="blockList"><a id="constructor.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Constructor Detail</h3>
|
|
<a id="<init>()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>BinaryHeap</h4>
|
|
<pre>public BinaryHeap()</pre>
|
|
<div class="block">Construct a new empty binary heap.</div>
|
|
</li>
|
|
</ul>
|
|
<a id="<init>(org.insa.graphs.algorithm.utils.BinaryHeap)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>BinaryHeap</h4>
|
|
<pre>public BinaryHeap​(<a href="BinaryHeap.html" title="class in org.insa.graphs.algorithm.utils">BinaryHeap</a><<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>> heap)</pre>
|
|
<div class="block">Construct a copy of the given heap.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>heap</code> - Binary heap to copy.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
<!-- ============ METHOD DETAIL ========== -->
|
|
<section role="region">
|
|
<ul class="blockList">
|
|
<li class="blockList"><a id="method.detail">
|
|
<!-- -->
|
|
</a>
|
|
<h3>Method Detail</h3>
|
|
<a id="arraySet(int,java.lang.Comparable)">
|
|
<!-- -->
|
|
</a><a id="arraySet(int,E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>arraySet</h4>
|
|
<pre class="methodSignature">private void arraySet​(int index,
|
|
<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> value)</pre>
|
|
<div class="block">Set an element at the given index.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - Index at which the element should be set.</dd>
|
|
<dd><code>value</code> - Element to set.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="indexParent(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>indexParent</h4>
|
|
<pre class="methodSignature">protected int indexParent​(int index)</pre>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>Index of the parent of the given index.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="indexLeft(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>indexLeft</h4>
|
|
<pre class="methodSignature">protected int indexLeft​(int index)</pre>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>Index of the left child of the given index.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="percolateUp(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>percolateUp</h4>
|
|
<pre class="methodSignature">private void percolateUp​(int index)</pre>
|
|
<div class="block">Internal method to percolate up in the heap.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - Index at which the percolate begins.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="percolateDown(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>percolateDown</h4>
|
|
<pre class="methodSignature">private void percolateDown​(int index)</pre>
|
|
<div class="block">Internal method to percolate down in the heap.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>index</code> - Index at which the percolate begins.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="isEmpty()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>isEmpty</h4>
|
|
<pre class="methodSignature">public boolean isEmpty()</pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="PriorityQueue.html#isEmpty()">PriorityQueue</a></code></span></div>
|
|
<div class="block">Check if the priority queue is empty.
|
|
|
|
<p>
|
|
<b>Complexity:</b> <i>O(1)</i>
|
|
</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="PriorityQueue.html#isEmpty()">isEmpty</a></code> in interface <code><a href="PriorityQueue.html" title="interface in org.insa.graphs.algorithm.utils">PriorityQueue</a><<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> extends java.lang.Comparable<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>>></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>true if the queue is empty, false otherwise.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="size()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>size</h4>
|
|
<pre class="methodSignature">public int size()</pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="PriorityQueue.html#size()">PriorityQueue</a></code></span></div>
|
|
<div class="block">Get the number of elements in this queue.
|
|
|
|
<p>
|
|
<b>Complexity:</b> <i>O(1)</i>
|
|
</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="PriorityQueue.html#size()">size</a></code> in interface <code><a href="PriorityQueue.html" title="interface in org.insa.graphs.algorithm.utils">PriorityQueue</a><<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> extends java.lang.Comparable<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>>></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>Current size (number of elements) of this queue.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="insert(java.lang.Comparable)">
|
|
<!-- -->
|
|
</a><a id="insert(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>insert</h4>
|
|
<pre class="methodSignature">public void insert​(<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> x)</pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="PriorityQueue.html#insert(E)">PriorityQueue</a></code></span></div>
|
|
<div class="block">Insert the given element into the queue.
|
|
|
|
<p>
|
|
<b>Complexity:</b> <i>O(log n)</i>
|
|
</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="PriorityQueue.html#insert(E)">insert</a></code> in interface <code><a href="PriorityQueue.html" title="interface in org.insa.graphs.algorithm.utils">PriorityQueue</a><<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> extends java.lang.Comparable<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>>></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>x</code> - Item to insert.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="remove(java.lang.Comparable)">
|
|
<!-- -->
|
|
</a><a id="remove(E)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>remove</h4>
|
|
<pre class="methodSignature">public void remove​(<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> x)
|
|
throws <a href="ElementNotFoundException.html" title="class in org.insa.graphs.algorithm.utils">ElementNotFoundException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="PriorityQueue.html#remove(E)">PriorityQueue</a></code></span></div>
|
|
<div class="block">Remove the given element from the priority queue.
|
|
|
|
<p>
|
|
<b>Complexity:</b> <i>O(log n)</i>
|
|
</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="PriorityQueue.html#remove(E)">remove</a></code> in interface <code><a href="PriorityQueue.html" title="interface in org.insa.graphs.algorithm.utils">PriorityQueue</a><<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> extends java.lang.Comparable<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>>></code></dd>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>x</code> - Item to remove.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="ElementNotFoundException.html" title="class in org.insa.graphs.algorithm.utils">ElementNotFoundException</a></code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="findMin()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>findMin</h4>
|
|
<pre class="methodSignature">public <a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> findMin()
|
|
throws <a href="EmptyPriorityQueueException.html" title="class in org.insa.graphs.algorithm.utils">EmptyPriorityQueueException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="PriorityQueue.html#findMin()">PriorityQueue</a></code></span></div>
|
|
<div class="block">Retrieve (but not remove) the smallest item in the queue.
|
|
|
|
<p>
|
|
<b>Complexity:</b> <i>O(1)</i>
|
|
</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="PriorityQueue.html#findMin()">findMin</a></code> in interface <code><a href="PriorityQueue.html" title="interface in org.insa.graphs.algorithm.utils">PriorityQueue</a><<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> extends java.lang.Comparable<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>>></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The smallest item in the queue.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="EmptyPriorityQueueException.html" title="class in org.insa.graphs.algorithm.utils">EmptyPriorityQueueException</a></code> - if this queue is empty.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="deleteMin()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>deleteMin</h4>
|
|
<pre class="methodSignature">public <a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> deleteMin()
|
|
throws <a href="EmptyPriorityQueueException.html" title="class in org.insa.graphs.algorithm.utils">EmptyPriorityQueueException</a></pre>
|
|
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="PriorityQueue.html#deleteMin()">PriorityQueue</a></code></span></div>
|
|
<div class="block">Remove and return the smallest item from the priority queue.
|
|
|
|
<p>
|
|
<b>Complexity:</b> <i>O(log n)</i>
|
|
</p></div>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
|
<dd><code><a href="PriorityQueue.html#deleteMin()">deleteMin</a></code> in interface <code><a href="PriorityQueue.html" title="interface in org.insa.graphs.algorithm.utils">PriorityQueue</a><<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a> extends java.lang.Comparable<<a href="BinaryHeap.html" title="type parameter in BinaryHeap">E</a>>></code></dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>The smallest item in the queue.</dd>
|
|
<dt><span class="throwsLabel">Throws:</span></dt>
|
|
<dd><code><a href="EmptyPriorityQueueException.html" title="class in org.insa.graphs.algorithm.utils">EmptyPriorityQueueException</a></code> - if this queue is empty.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="toStringSorted()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toStringSorted</h4>
|
|
<pre class="methodSignature">public java.lang.String toStringSorted()</pre>
|
|
<div class="block">Creates a multi-lines string representing a sorted view of this binary heap.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>a string containing a sorted view this binary heap.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="toStringSorted(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toStringSorted</h4>
|
|
<pre class="methodSignature">public java.lang.String toStringSorted​(int maxElement)</pre>
|
|
<div class="block">Creates a multi-lines string representing a sorted view of this binary heap.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>maxElement</code> - Maximum number of elements to display. or <code>-1</code> to
|
|
display all the elements.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>a string containing a sorted view this binary heap.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="toStringTree()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toStringTree</h4>
|
|
<pre class="methodSignature">public java.lang.String toStringTree()</pre>
|
|
<div class="block">Creates a multi-lines string representing a tree view of this binary heap.</div>
|
|
<dl>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>a string containing a tree view of this binary heap.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="toStringTree(int)">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockList">
|
|
<li class="blockList">
|
|
<h4>toStringTree</h4>
|
|
<pre class="methodSignature">public java.lang.String toStringTree​(int maxDepth)</pre>
|
|
<div class="block">Creates a multi-lines string representing a tree view of this binary heap.</div>
|
|
<dl>
|
|
<dt><span class="paramLabel">Parameters:</span></dt>
|
|
<dd><code>maxDepth</code> - Maximum depth of the tree to display.</dd>
|
|
<dt><span class="returnLabel">Returns:</span></dt>
|
|
<dd>a string containing a tree view of this binary heap.</dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
<a id="toString()">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="blockListLast">
|
|
<li class="blockList">
|
|
<h4>toString</h4>
|
|
<pre class="methodSignature">public java.lang.String toString()</pre>
|
|
<dl>
|
|
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
|
|
<dd><code>toString</code> in class <code>java.lang.Object</code></dd>
|
|
</dl>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</section>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<footer role="contentinfo">
|
|
<nav role="navigation">
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<div class="bottomNav"><a id="navbar.bottom">
|
|
<!-- -->
|
|
</a>
|
|
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
|
|
<a id="navbar.bottom.firstrow">
|
|
<!-- -->
|
|
</a>
|
|
<ul class="navList" title="Navigation">
|
|
<li><a href="../../../../../index.html">Overview</a></li>
|
|
<li><a href="package-summary.html">Package</a></li>
|
|
<li class="navBarCell1Rev">Class</li>
|
|
<li><a href="class-use/BinaryHeap.html">Use</a></li>
|
|
<li><a href="package-tree.html">Tree</a></li>
|
|
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
|
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
|
|
<li><a href="../../../../../help-doc.html">Help</a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="subNav">
|
|
<ul class="navList" id="allclasses_navbar_bottom">
|
|
<li><a href="../../../../../allclasses.html">All Classes</a></li>
|
|
</ul>
|
|
<div>
|
|
<script type="text/javascript"><!--
|
|
allClassesLink = document.getElementById("allclasses_navbar_bottom");
|
|
if(window==top) {
|
|
allClassesLink.style.display = "block";
|
|
}
|
|
else {
|
|
allClassesLink.style.display = "none";
|
|
}
|
|
//-->
|
|
</script>
|
|
<noscript>
|
|
<div>JavaScript is disabled on your browser.</div>
|
|
</noscript>
|
|
</div>
|
|
<div>
|
|
<ul class="subNavList">
|
|
<li>Summary: </li>
|
|
<li>Nested | </li>
|
|
<li><a href="#field.summary">Field</a> | </li>
|
|
<li><a href="#constructor.summary">Constr</a> | </li>
|
|
<li><a href="#method.summary">Method</a></li>
|
|
</ul>
|
|
<ul class="subNavList">
|
|
<li>Detail: </li>
|
|
<li><a href="#field.detail">Field</a> | </li>
|
|
<li><a href="#constructor.detail">Constr</a> | </li>
|
|
<li><a href="#method.detail">Method</a></li>
|
|
</ul>
|
|
</div>
|
|
<a id="skip.navbar.bottom">
|
|
<!-- -->
|
|
</a></div>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
</nav>
|
|
</footer>
|
|
</body>
|
|
</html>
|