3 ms·
Inserting an element at a position in the array means shifting the element at that position and every subsequent element to the right by 1. Naively, this takes
by rosstex 7y ago
Inserting an element at a position in the array means shifting the element at that position and every subsequent element to the right by 1. Naively, this takes linear time.