Records R1, ..., RN are rearranged in place; after sorting is complete, their keys will be in order, K1 <= KN. S1 [loop on j.] Perform steps S2 through S5 for j = 2,3,...,N; then terminate the algorithm. S2 [Set up i, K, R.] Set i <- j-􀀀1, K <- Kj, R <- Rj. (...) S3 [Compare K,Ki] If K >= Ki, go to step S5. (. . . ) S4 [Move Ri, decrease i.] Set Ri+1 <- Ri, then i <- i-􀀀1. If i > 0, go back to step S3. (. . . ) S5 Set Ri+1 <- R.