We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed4ce85 commit f72fde5Copy full SHA for f72fde5
tests/regression/27-inv_invariants/16-sedgewick.c
@@ -0,0 +1,26 @@
1
+#include <stddef.h>
2
+#include <assert.h>
3
+
4
+struct node {
5
+ struct node *left;
6
+ struct node *right;
7
+ int key;
8
+};
9
10
+// https://old.reddit.com/r/programminghorror/comments/jgrpcu/on_sedgewicks_original_presentation_for_llrb_trees/
11
+struct node* min(struct node *root) {
12
+ struct node *x = root;
13
+ while (x != NULL)
14
+ x = x->left;
15
+ if (x == NULL) // WARN (dead branch)
16
+ return NULL;
17
+ else
18
+ return x;
19
+}
20
21
+int main() {
22
+ struct node *root;
23
+ struct node *m = min(root);
24
+ assert(m == NULL);
25
+ return 0;
26
0 commit comments