function B = insert(A, k)
       % assume k > 1 and A(1:k-1)is sorted
       temp = A(k); j = k-1;
       while (j > 0)
         if A(j) > temp 
           A(j+1) = A(j); j = j-1;
         else
           break;
          end;
       end;
       A(j+1) = temp;
B = A;
