Skip to content
Snippets Groups Projects
Commit 38ad3aa2 authored by SETaratukhina's avatar SETaratukhina
Browse files

Replace README.md

parent f21a2140
No related branches found
No related tags found
No related merge requests found
# 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment