mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
time complexity for insert
This commit is contained in:
parent
0a5d6841e8
commit
d2f825f261
@ -1490,6 +1490,12 @@ impl<T, A: Allocator> Vec<T, A> {
|
||||
/// vec.insert(4, 5);
|
||||
/// assert_eq!(vec, [1, 4, 2, 3, 5]);
|
||||
/// ```
|
||||
///
|
||||
/// # Time complexity
|
||||
///
|
||||
/// Takes *O*(`len`) time. All items after the insertion index must be
|
||||
/// shifted to the right. In the worst case, all elements are shifted when
|
||||
/// the insertion index is 0.
|
||||
#[cfg(not(no_global_oom_handling))]
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
pub fn insert(&mut self, index: usize, element: T) {
|
||||
|
Loading…
Reference in New Issue
Block a user