Suppose there are n elements in an array. If we want to delete the beginning element of an array, then how many shift operations are required to fill the…
Suppose there are n elements in an array. If we want to delete the beginning element of an array, then how many shift operations are required to fill the gap left by the deleted element?
Show answerHide answer
Correct answer: (B) n − 1
Explanation
After deleting a[0], each of the remaining n - 1 elements must move one position left, so n - 1 shift operations are needed.