Skip to content

Commit

Permalink
Rollup merge of rust-lang#56672 - ccouzens:master, r=nikic
Browse files Browse the repository at this point in the history
Document time of back operations of a Linked List

Popping and pushing from the end of a linked list is constant time. This
documentation is already there for popping and pushing from the front.

@bors: r+ 38fe8d2 rollup
  • Loading branch information
kennytm authored Dec 13, 2018
2 parents 43e19e9 + 562f33b commit 73236ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/liballoc/collections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,9 @@ impl<T> LinkedList<T> {
self.pop_front_node().map(Node::into_element)
}

/// Appends an element to the back of a list
/// Appends an element to the back of a list.
///
/// This operation should compute in O(1) time.
///
/// # Examples
///
Expand All @@ -647,6 +649,8 @@ impl<T> LinkedList<T> {
/// Removes the last element from a list and returns it, or `None` if
/// it is empty.
///
/// This operation should compute in O(1) time.
///
/// # Examples
///
/// ```
Expand Down

0 comments on commit 73236ad

Please sign in to comment.