SHARE
TWEET

Untitled

a guest Dec 13th, 2015 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. procedure swap2(one:integer;two:integer);
  2. var temp:integer;
  3. begin
  4.   temp:=one;
  5.   one:=two;
  6.   two:=temp;
  7. end;  
  8.  
  9. procedure select_sort(tab : array of integer);
  10. var min,min_i:integer;
  11. begin
  12.      for i:=0 to tab_size-1 do
  13.      begin
  14.           min:=tab[i];
  15.           for j:=i to tab_size-1 do
  16.           begin
  17.  
  18.                 if(tab[j]<=min) then
  19.                 begin
  20.                   min:=tab[j];
  21.                   min_i:=j;
  22.                 end
  23.  
  24.           end;
  25.           swap2(tab[j],tab[min_i]);
  26.      end;
  27.  
  28. end;  
  29.  
  30. procedure insert_sort(tab : array of integer);
  31. begin
  32.   for i:=0 to tab_size-1 do
  33.     begin
  34.          j:=i;
  35.          while (j>1) do
  36.          begin
  37.               if(tab[j]<tab[j-1]) then swap2(tab[j-1],tab[j]);
  38.               j:=j-1;
  39.          end;
  40.     end;
  41.  
  42. end;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top