We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
How do you move the three at index 2 to index 0 in 1 shift? I think maybe there is a confusion with what a shift is.
As I understood it a shift is moving an element of an array one position to the left. In this example you have to move 3 to positions to the left, and therefor two shifts.
Running Time of Algorithms
You are viewing a single comment's thread. Return to all comments →
How do you move the three at index 2 to index 0 in 1 shift? I think maybe there is a confusion with what a shift is.
As I understood it a shift is moving an element of an array one position to the left. In this example you have to move 3 to positions to the left, and therefor two shifts.