in DS
705 views
0 votes
0 votes

in DS
by
705 views

1 Answer

0 votes
0 votes

S1: In the worst case , middle element of array will be deleted,then we have to adjust the position of (n/2) elements, which will take O(n) time,

S2: Just Interchange, two variables First & Last in O(1) Then print from first to last , elements will be printed in reverse order.

Option (b)

2 Comments

@The_Toad_Sage

Can you please elaborate this line further:

In the worst case , middle element of array will be deleted,then we have to adjust the position of (n/2) elements,

0
0
Is that mean swapping $\mathbf{\frac{n}{2}}$ elements?
0
0

Related questions