Tcl Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

struct::prioqueue - Create and manipulate prioqueue objects

Table Of Contents

SYNOPSIS

package require Tcl 8.5 9
package require struct::prioqueue ?1.5?

::struct::prioqueue ?-ascii|-dictionary|-integer|-real? ?prioqueueName?
prioqueueName option ?arg arg ...?
prioqueueName clear
prioqueueName remove item
prioqueueName destroy
prioqueueName get ?count?
prioqueueName peek ?count?
prioqueueName peekpriority ?count?
prioqueueName put item prio ?item prio ...?
prioqueueName size

DESCRIPTION

This package implements a simple priority queue using nested tcl lists.

The command ::struct::prioqueue creates a new priority queue with default priority key type -integer. This means that keys given to the put subcommand must have this type.

This also sets the priority ordering. For key types -ascii and -dictionary the data is sorted in ascending order (as with lsort -increasing), thereas for -integer and -real the data is sorted in descending order (as with lsort -decreasing).

Prioqueue names are unrestricted, but may be recognized as options if no priority type is given.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category struct :: prioqueue of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

KEYWORDS

ordered list, prioqueue, priority queue

CATEGORY

Data structures

COPYRIGHT

Copyright © 2003 Michael Schlenker