Write an algorithm for Insertion at Kth position in an array.
Answers
Answered by
0
Answer:
[Initialize Counter] Set J: = N.
Repeat steps 3 and 4 while J ≥ K.
[Move Jth element downward] Set LA [J+1]: = LA [J]
[Decrease Counter] Set J: = J-1. [End of step 2 loop]
[Insert element] Set LA [K]: = ITEM.
[Reset N] Set N: = N+1.
Exit.
Similar questions
Computer Science,
5 months ago
Computer Science,
5 months ago
Science,
10 months ago
Social Sciences,
10 months ago
Math,
1 year ago