Distributed File System written in C
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

comments

+1 -9
+1 -9
src/lib/dnode.c
··· 1 1 #include "dnode.h" 2 2 3 + // Implement all of the functions for ListDNode and ListDNodeInfo 3 4 ImplList(DNode) 4 5 ImplList(DNodeInfo) 5 6 ··· 177 178 } 178 179 179 180 180 - /* 181 - insert :: [Int] -> Int -> [Int] 182 - insert [] a = [a] 183 - insert (x:xs) a = if x > a then a:x:xs else x:insert xs a 184 - */ 185 181 ListDNodeInfo insert(ListDNodeInfo l, DNodeInfo a) { 186 182 if (l == NULL) { 187 183 return ListDNodeInfo_cons(a, NULL); ··· 192 188 } 193 189 } 194 190 195 - /* 196 - sort :: [Int] -> [Int] 197 - sort = foldl insert [] 198 - */ 199 191 ListDNodeInfo sort(ListDNodeInfo l) { 200 192 ListDNodeInfo acc = NULL; 201 193 for (;l != NULL; l = l->rest) acc = insert(acc, l->head);