3. (20%) Given a $k$-sorted array that is almost sorted such that each of the $n$ elements may be misplaced by no more than $k$ positions from the correct sorted order, write a C program to sort this array, and analyze the program in the worst case. (If you have many programs, choose the program with less running time. If you cannot write the program in C, design a flowchart or provide an algorithm instead.)