Guest User

Untitled

a guest
Oct 21st, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. procedure TableSort ( T: in out Table_Array) is
  2. x : Item ;
  3. j: Index;
  4. begin
  5.  
  6. for I in T'Range loop
  7.  
  8. if T(Index'Succ(I)) < T(I) then
  9.  
  10. x := T(I) ;
  11. T(I) := T(Index'Succ(I));
  12. j := Index'Pred(Index'Pred(I));
  13.  
  14.  
  15.  
  16. while j <= T'First and x < T(Index'succ(j)) loop
  17. T(j) := T(Index'Succ(j)) ;
  18. j := Index'Pred(j);
  19.  
  20. end loop ;
  21. T(Index'Pred(I)) := x ;
  22.  
  23. end if ;
  24.  
  25. end loop;
  26.  
  27. end TableSort ;
Add Comment
Please, Sign In to add comment