|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectArray<D>
OArray<D>
D
- The type of the elements in the array. These elements must be comparable.public class OArray<D extends java.lang.Comparable<D>>
An (O)rdered array is like an array but there additional methods
to sort an array (quicksort()
and heapsort()
).
Moreover, for a sorted array there are efficient methods to
check whether an element is present in an array binsearch(Comparable)
.
Finally, there are methods like insert(Comparable)
and extract_min()
which should only be used if the array has a heap-structure and which ensure that
the heap-structure is guaranteed afterwards.
Comparable
Constructor Summary | |
---|---|
OArray()
|
Method Summary | |
---|---|
boolean |
binsearch(D d)
Performs a binary search of d, requires logarithmic time in the size of the array. |
void |
heapsort()
Sorts this array in place in O(n log(n)) time using the heap-sort algorithm. |
void |
insert(D d)
Inserts d into this array and preserves the heap-property if this array had the heap-property before the call to this method. |
void |
quicksort()
Sorts this array using the quicksort-algorithm. |
Methods inherited from class Array |
---|
get, isempty, iterator, permute_randomly, print, resize, set, size |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OArray()
Method Detail |
---|
public void heapsort()
public void insert(D d)
d
- The data to insert.public void quicksort()
public boolean binsearch(D d)
d
- The data to search for
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |