diff --git a/src/libcollections/priority_queue.rs b/src/libcollections/priority_queue.rs index da8cf085218..68e2086d042 100644 --- a/src/libcollections/priority_queue.rs +++ b/src/libcollections/priority_queue.rs @@ -10,6 +10,11 @@ //! A priority queue implemented with a binary heap. //! +//! Insertions have `O(log n)` time complexity and checking or popping the largest element is +//! `O(1)`. Converting a vector to a priority queue can be done in-place, and has `O(n)` +//! complexity. A priority queue can also be converted to a sorted vector in-place, allowing it to +//! be used for an `O(n log n)` in-place heapsort. +//! //! # Example //! //! This is a larger example which implements [Dijkstra's algorithm][dijkstra] diff --git a/src/libcollections/ringbuf.rs b/src/libcollections/ringbuf.rs index 3665535e720..aa745ef39ee 100644 --- a/src/libcollections/ringbuf.rs +++ b/src/libcollections/ringbuf.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! A double-ended queue implemented as a circular buffer. -//! -//! `RingBuf` implements the trait `Deque`. It should be imported with -//! `use collections::Deque`. +//! This crate implements a double-ended queue with `O(1)` amortized inserts and removals from both +//! ends of the container. It also has `O(1)` indexing like a vector. The contained elements are +//! not required to be copyable, and the queue will be sendable if the contained type is sendable. +//! Its interface `Deque` is defined in `collections`. use core::prelude::*; diff --git a/src/libcollections/treemap.rs b/src/libcollections/treemap.rs index 80a7c6d4bad..354edae473f 100644 --- a/src/libcollections/treemap.rs +++ b/src/libcollections/treemap.rs @@ -8,9 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! An ordered map and set implemented as self-balancing binary search -//! trees. The only requirement for the types is that the key implements -//! `Ord`. +//! Maps are collections of unique keys with corresponding values, and sets are +//! just unique keys without a corresponding value. The `Map` and `Set` traits in +//! `std::container` define the basic interface. +//! +//! This crate defines the `TreeMap` and `TreeSet` types. Their keys must implement `Ord`. +//! +//! `TreeMap`s are ordered. //! //! ## Example //! diff --git a/src/libcollections/trie.rs b/src/libcollections/trie.rs index fa8bcf94de1..7d60d3a85e1 100644 --- a/src/libcollections/trie.rs +++ b/src/libcollections/trie.rs @@ -8,8 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! Ordered containers with unsigned integer keys, -//! implemented as radix tries (`TrieSet` and `TrieMap` types). +//! Maps are collections of unique keys with corresponding values, and sets are +//! just unique keys without a corresponding value. The `Map` and `Set` traits in +//! `std::container` define the basic interface. +//! +//! This crate defines `TrieMap` and `TrieSet`, which require `uint` keys. +//! +//! `TrieMap` is ordered. use core::prelude::*; diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index a7005cf454d..34b3b11df00 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! An owned, growable vector. +//! A growable list type, written `Vec` but pronounced 'vector.' +//! +//! Vectors have `O(1)` indexing, push (to the end) and pop (from the end). use core::prelude::*;