Skip to content

Commit

Permalink
Document time of back operations of a Linked List
Browse files Browse the repository at this point in the history
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
Chris Couzens committed Dec 10, 2018
1 parent 9567a1c commit 562f33b
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 562f33b

Please sign in to comment.