mirror of
https://github.com/supleed2/ELEC70056-HSV-CW1.git
synced 2024-11-10 02:15:47 +00:00
removed task 6
This commit is contained in:
parent
0e8514ef99
commit
cbe8f0fb9c
Binary file not shown.
|
@ -123,26 +123,6 @@ method bubble_sort3(A:array<int>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Task 6. Difficulty: *
|
|
||||||
function method get_min(a:int, b:int) : int
|
|
||||||
{
|
|
||||||
if a <= b then a else b
|
|
||||||
}
|
|
||||||
|
|
||||||
method sort3(a:int, b:int, c:int) returns (min:int, mid:int, max:int)
|
|
||||||
ensures min in {a,b,c}
|
|
||||||
ensures mid in {a,b,c}
|
|
||||||
ensures max in {a,b,c}
|
|
||||||
ensures a in {min, mid, max}
|
|
||||||
ensures b in {min, mid, max}
|
|
||||||
ensures c in {min, mid, max}
|
|
||||||
ensures min <= mid <= max
|
|
||||||
{
|
|
||||||
min := get_min(a, get_min(b,c));
|
|
||||||
max := -get_min(-a, get_min(-b,-c));
|
|
||||||
mid := a + b + c - max - min;
|
|
||||||
}
|
|
||||||
|
|
||||||
method print_array(A:array<int>)
|
method print_array(A:array<int>)
|
||||||
{
|
{
|
||||||
var i := 0;
|
var i := 0;
|
||||||
|
|
Loading…
Reference in a new issue