All pastes #736903 Raw Edit

Stuff

public text v1 · immutable
·published 2007-10-14 22:31 UTC
rendered paste body
program sorter(input, output);

const n = 8;
type item = record key: integer;
	end;

type index  = 0..n ;
var a: array[0..n] of item;

procedure inputer(input,output);


procedure straightinsertion;
	var i, j: index; x: item;
begin
	for i := 2 to n do
	begin 
		x := a[i]; 
		a[0] := x; 
		j := i-1;
		while x.key < a[j].key do
			begin 
				a[j+1] := a[j]; 
				j:= j-1;
			end;
		a[j+1] := x;
	end;
end;

var m : index;
begin
	for m := 1 to n do
	begin
		writeln(a[m]);	
	end;
end.