Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
pub
frama-c
Commits
8f7a277a
Commit
8f7a277a
authored
10 years ago
by
Nikolai Kosmatov
Browse files
Options
Downloads
Patches
Plain Diff
benchmark3 tentative (quicksort)
parent
42c85bb9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/e-acsl/tests/csrv14/benchmark3.c
+3
-7
3 additions, 7 deletions
src/plugins/e-acsl/tests/csrv14/benchmark3.c
with
3 additions
and
7 deletions
src/plugins/e-acsl/tests/csrv14/benchmark3.c
+
3
−
7
View file @
8f7a277a
...
@@ -13,7 +13,7 @@ void swap(int* array, int i, int j) {
...
@@ -13,7 +13,7 @@ void swap(int* array, int i, int j) {
array
[
j
]
=
tmp
;
array
[
j
]
=
tmp
;
}
}
/*@ requires \
valid(array+(left..right)
);
/*@ requires \
forall integer j; left <= j <= right ==> \valid(array+j
);
@ assigns array[left..right];
@ assigns array[left..right];
@*/
@*/
int
partition
(
int
*
array
,
int
left
,
int
right
,
int
pivotIndex
)
{
int
partition
(
int
*
array
,
int
left
,
int
right
,
int
pivotIndex
)
{
...
@@ -33,7 +33,7 @@ int partition (int* array, int left, int right, int pivotIndex) {
...
@@ -33,7 +33,7 @@ int partition (int* array, int left, int right, int pivotIndex) {
return
storeIndex
;
return
storeIndex
;
}
}
/*@ requires \
valid(array+(left..right)
);
/*@ requires \
forall integer j; left <= j <= right ==> \valid(array+j
);
@ assigns array[left..right];
@ assigns array[left..right];
@ ensures \forall int i; left <= i < right ==> array[i] <= array[i+1];
@ ensures \forall int i; left <= i < right ==> array[i] <= array[i+1];
@*/
@*/
...
@@ -48,20 +48,16 @@ void quicksort(int* array, int left, int right) {
...
@@ -48,20 +48,16 @@ void quicksort(int* array, int left, int right) {
int
main
(
void
)
{
int
main
(
void
)
{
int
i
;
int
i
;
int
arr_min
[
LEN
];
// array of minimal elements
int
arr
[
LEN
];
// array to be sorted
int
arr
[
LEN
];
// array to be sorted
int
arr_max
[
LEN
];
// array of maximal elements
int
arr_max
[
LEN
];
// array of maximal elements
arr
[
0
]
=
0
;
arr
[
0
]
=
0
;
arr_min
[
0
]
=
0
;
arr_max
[
0
]
=
9
;
arr_max
[
0
]
=
9
;
for
(
i
=
1
;
i
<
LEN
;
i
++
){
for
(
i
=
1
;
i
<
LEN
;
i
++
){
arr
[
i
]
=
(
13
*
arr
[
i
-
1
]
+
i
)
%
10
;
arr
[
i
]
=
(
13
*
arr
[
i
-
1
]
+
i
)
%
10
;
arr_min
[
i
]
=
0
;
arr_max
[
i
]
=
9
;
arr_max
[
i
]
=
9
;
}
}
printf
(
"
\n
Array before quicksort:
\n
"
);
printf
(
"
\n
Array before quicksort:
\n
"
);
for
(
i
=
0
;
i
<
LEN
;
i
++
)
for
(
i
=
0
;
i
<
LEN
;
i
++
)
printf
(
"%d, "
,
arr
[
i
]);
printf
(
"%d, "
,
arr
[
i
]);
...
...
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