summaryrefslogtreecommitdiff
path: root/test/files/pos
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-07-18 13:51:23 +0000
committerpaltherr <paltherr@epfl.ch>2003-07-18 13:51:23 +0000
commite9c280e68e136274fea9d88b40af6645e0fbb970 (patch)
treefb96b7dfbbb21a98877db0a4380cf8cb63a61c96 /test/files/pos
parent30309b2ba2d8bfa6fb656cd760f6315581204d1d (diff)
downloadscala-e9c280e68e136274fea9d88b40af6645e0fbb970.tar.gz
scala-e9c280e68e136274fea9d88b40af6645e0fbb970.tar.bz2
scala-e9c280e68e136274fea9d88b40af6645e0fbb970.zip
- Merged sort1 into Course-2002-04
Diffstat (limited to 'test/files/pos')
-rw-r--r--test/files/pos/sort1.scala33
1 files changed, 0 insertions, 33 deletions
diff --git a/test/files/pos/sort1.scala b/test/files/pos/sort1.scala
deleted file mode 100644
index a6eb6a7618..0000000000
--- a/test/files/pos/sort1.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-object test {
-
- type String = java.lang.String;
-
- def While(def c: Boolean)(def b: Unit): Unit =
- if (c) { b ; While(c)(b) }
- else ();
-
- def sort(a: Array[Double]): Unit = {
-
- def swap(i: Int, j: Int): Unit = {
- val t = a(i) ; val u = a.apply(j) ; a(i) = u ; a(j) = t
- }
-
- def sort1(l: Int, r: Int): Unit = {
- val pivot = a((l + r) / 2);
- var i = l, j = r;
- While (i <= j) {
- While (a(i) < pivot) { i = i + 1 }
- While (a(j) > pivot) { j = j - 1 }
- if (i <= j) {
- swap(i, j);
- i = i + 1;
- j = j - 1;
- }
- }
- if (l < j) sort1(l, j);
- if (j < r) sort1(i, r);
- }
-
- sort1(0, a.length - 1);
- }
-}