Rollup merge of #89210 - Takashiidobe:master, r=kennytm

Add missing time complexities to linked_list.rs

Most functions in LinkedList have time complexities in their description:
Like push front:

```
Adds an element first in the list.

This operation should compute in O(1) time.
```

Time complexities were missing for the following, so I've added them in this PR:

contains: O(n)
front: O(1)
front_mut: O(1)
back: O(1)
back_mut: O(1)
This commit is contained in:
Jubilee 2021-09-24 11:40:15 -07:00 committed by GitHub
commit 0fa43494bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -631,6 +631,8 @@ impl<T> LinkedList<T> {
/// Returns `true` if the `LinkedList` contains an element equal to the
/// given value.
///
/// This operation should compute in *O*(*n*) time.
///
/// # Examples
///
/// ```
@ -656,6 +658,8 @@ impl<T> LinkedList<T> {
/// Provides a reference to the front element, or `None` if the list is
/// empty.
///
/// This operation should compute in *O*(1) time.
///
/// # Examples
///
/// ```
@ -676,6 +680,8 @@ impl<T> LinkedList<T> {
/// Provides a mutable reference to the front element, or `None` if the list
/// is empty.
///
/// This operation should compute in *O*(1) time.
///
/// # Examples
///
/// ```
@ -702,6 +708,8 @@ impl<T> LinkedList<T> {
/// Provides a reference to the back element, or `None` if the list is
/// empty.
///
/// This operation should compute in *O*(1) time.
///
/// # Examples
///
/// ```
@ -722,6 +730,8 @@ impl<T> LinkedList<T> {
/// Provides a mutable reference to the back element, or `None` if the list
/// is empty.
///
/// This operation should compute in *O*(1) time.
///
/// # Examples
///
/// ```