Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Shuttle method
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SETaratukhina
Shuttle method
Commits
38ad3aa2
Commit
38ad3aa2
authored
4 years ago
by
SETaratukhina
Browse files
Options
Downloads
Patches
Plain Diff
Replace README.md
parent
f21a2140
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+39
-2
39 additions, 2 deletions
README.md
with
39 additions
and
2 deletions
README.md
+
39
−
2
View file @
38ad3aa2
# 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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment