84 lines
3.3 KiB
HTML
84 lines
3.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Priority queues</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body background="images/back.gif">
|
|
<!--START-->
|
|
|
|
<h3>Priority queues</h3>
|
|
|
|
In a priority queue a number of values are stored, each with a priority. You
|
|
can quickly find the values with minimum and maximum priority. Using this
|
|
data structure you can handle certain things in the order of priority. The
|
|
following functions exist:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<tt><b>ds_priority_create()</b></tt>
|
|
Creates a new priority queue. The function returns an integer as
|
|
an id that must be used in all other functions to access the particular
|
|
priority queue.<br>
|
|
<tt><b>ds_priority_destroy(id)</b></tt>
|
|
Destroys the priority queue with the given id, freeing the memory used.
|
|
Don't forget to call this function when you are ready with the structure.<br>
|
|
<tt><b>ds_priority_clear(id)</b></tt>
|
|
Clears the priority queue with the given id, removing all
|
|
data from it but not destroying it.<br>
|
|
<tt><b>ds_priority_copy(id,source)</b></tt>
|
|
Copies the priority queue source into the priority queue with the given id.<br>
|
|
<tt><b>ds_priority_size(id)</b></tt>
|
|
Returns the number of values stored in the priority queue.<br>
|
|
<tt><b>ds_priority_empty(id)</b></tt>
|
|
Returns whether the priority queue is empty. This is the same as testing
|
|
whether the size is 0.<br>
|
|
<tt><b>ds_priority_add(id,val,prio)</b></tt>
|
|
Adds the value with the given priority to the priority queue.<br>
|
|
<tt><b>ds_priority_change_priority(id,val,prio)</b></tt>
|
|
Changes the priority of the given value in the priority queue.<br>
|
|
<tt><b>ds_priority_find_priority(id,val)</b></tt>
|
|
Returns the priority of the given value in the priority queue.<br>
|
|
<tt><b>ds_priority_delete_value(id,val)</b></tt>
|
|
Deletes the given value (with its priority) from the priority queue.<br>
|
|
<tt><b>ds_priority_delete_min(id)</b></tt>
|
|
Returns the value with the smallest priority and deletes it from the priority queue.<br>
|
|
<tt><b>ds_priority_find_min(id)</b></tt>
|
|
Returns the value with the smallest priority but does not delete it from the priority queue.<br>
|
|
<tt><b>ds_priority_delete_max(id)</b></tt>
|
|
Returns the value with the largest priority and deletes it from the priority queue.<br>
|
|
<tt><b>ds_priority_find_max(id)</b></tt>
|
|
Returns the value with the largest priority but does not delete it from the priority queue.<br>
|
|
<tt><b>ds_priority_write(id)</b></tt>
|
|
Turns the data structure into a string and returns this string. The string can then
|
|
be used to e.g. save it to a file. This provides an easy mechanism for saving data
|
|
structures.<br>
|
|
<tt><b>ds_priority_read(id,str)</b></tt>
|
|
Reads the data structure from the given string (as created by the previous call).<br>
|
|
</blockquote>
|
|
|
|
<!--END-->
|
|
</body>
|
|
</html>
|
|
|
|
<!-- KEYWORDS
|
|
priority queues
|
|
|
|
ds_priority_create()
|
|
ds_priority_destroy()
|
|
ds_priority_clear()
|
|
ds_priority_copy()
|
|
ds_priority_size()
|
|
ds_priority_empty()
|
|
ds_priority_add()
|
|
ds_priority_change_priority()
|
|
ds_priority_find_priority()
|
|
ds_priority_delete_value()
|
|
ds_priority_delete_min()
|
|
ds_priority_find_min()
|
|
ds_priority_delete_max()
|
|
ds_priority_find_max()
|
|
ds_priority_write()
|
|
ds_priority_read()
|
|
--> |