Skip to content

Commit d63e0f0

Browse files
authored
Add time complexities to linked_list.rs
1 parent 2b862be commit d63e0f0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

library/alloc/src/collections/linked_list.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,8 @@ impl<T> LinkedList<T> {
631631
/// Returns `true` if the `LinkedList` contains an element equal to the
632632
/// given value.
633633
///
634+
/// This operation should compute in *O*(*n*) time.
635+
///
634636
/// # Examples
635637
///
636638
/// ```
@@ -655,6 +657,8 @@ impl<T> LinkedList<T> {
655657

656658
/// Provides a reference to the front element, or `None` if the list is
657659
/// empty.
660+
///
661+
/// This operation should compute in *O*(*1*) time.
658662
///
659663
/// # Examples
660664
///
@@ -675,6 +679,8 @@ impl<T> LinkedList<T> {
675679

676680
/// Provides a mutable reference to the front element, or `None` if the list
677681
/// is empty.
682+
///
683+
/// This operation should compute in *O*(*1*) time.
678684
///
679685
/// # Examples
680686
///
@@ -701,6 +707,8 @@ impl<T> LinkedList<T> {
701707

702708
/// Provides a reference to the back element, or `None` if the list is
703709
/// empty.
710+
///
711+
/// This operation should compute in *O*(*1*) time.
704712
///
705713
/// # Examples
706714
///
@@ -721,6 +729,8 @@ impl<T> LinkedList<T> {
721729

722730
/// Provides a mutable reference to the back element, or `None` if the list
723731
/// is empty.
732+
///
733+
/// This operation should compute in *O*(*1*) time.
724734
///
725735
/// # Examples
726736
///

0 commit comments

Comments
 (0)