Commit 38ad3aa2 authored by SETaratukhina's avatar SETaratukhina
Browse files

Replace README.md

parent f21a2140
# Shuttle method
const
N=5;
var
a: array [0..N] of integer;
i, k, start_index, end_index : integer;
wer : boolean ;
begin
start_index:= 0;
end_index := N - 1;
for i:=1 to N do
readln(a[i]);
wer:= True;
while wer = True do
begin
wer:= False;
for i:=start_index to end_index do
if (a[i] > a[i + 1]) then
begin
k:= a[i];
a[i]:= a[i + 1];
a[i + 1] := k;
wer:= True;
end;
if (not(wer))then
break ;
wer:= False ;
for i:=end_index downto start_index + 1 do
if (a[i] < a[i - 1]) then
begin
k:= a[i-1];
a[i-1]:= a[i];
a[i] := k;
wer := True;
end;
start_index := start_index + 1;
end;
for i:=1 to N do
writeln(a[i]);
end.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment