From 3816e57fd2a8ab19e4ac6d4b3ddd5b49d5973ff2 Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Thu, 12 May 2011 17:24:54 +0200 Subject: Downcase std modules again, move to :: for module dereferencing This should be a snapshot transition. --- src/lib/UFind.rs | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/lib/UFind.rs (limited to 'src/lib/UFind.rs') diff --git a/src/lib/UFind.rs b/src/lib/UFind.rs deleted file mode 100644 index 0bb06d7c..00000000 --- a/src/lib/UFind.rs +++ /dev/null @@ -1,37 +0,0 @@ -import Option.none; -import Option.some; - -// A very naive implementation of union-find with unsigned integer nodes. - -type node = Option.t[uint]; -type ufind = rec(mutable vec[mutable node] nodes); - -fn make() -> ufind { - let vec[mutable node] v = vec(mutable none[uint]); - Vec.pop(v); // FIXME: botch - ret rec(mutable nodes=v); -} - -fn make_set(&ufind ufnd) -> uint { - auto idx = Vec.len(ufnd.nodes); - ufnd.nodes += vec(mutable none[uint]); - ret idx; -} - -fn find(&ufind ufnd, uint n) -> uint { - alt (ufnd.nodes.(n)) { - case (none[uint]) { ret n; } - case (some[uint](?m)) { - // TODO: "be" - ret find(ufnd, m); - } - } -} - -fn union(&ufind ufnd, uint m, uint n) { - auto m_root = find(ufnd, m); - auto n_root = find(ufnd, n); - auto ptr = some[uint](n_root); - ufnd.nodes.(m_root) = ptr; -} - -- cgit v1.2.3