| 1 | #include <stdio.h> |
|---|---|
| 2 | #include <stdlib.h> |
| 3 | #include <stdint.h> |
| 4 | |
| 5 | struct node; |
| 6 | struct node { |
| 7 | int value; |
| 8 | node* next; |
| 9 | node () : value(1),next(NULL) {} |
| 10 | node (int v) : value(v), next(NULL) {} |
| 11 | }; |
| 12 | |
| 13 | void make_tree(node* root, int count) |
| 14 | { |
| 15 | int countdown=1; |
| 16 | if (!root) |
| 17 | return; |
| 18 | root->value = countdown; |
| 19 | while (count > 0) |
| 20 | { |
| 21 | root->next = new node(++countdown); |
| 22 | root = root->next; |
| 23 | count--; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | int main (int argc, const char * argv[]) |
| 28 | { |
| 29 | node root(1); |
| 30 | make_tree(root: &root,count: 25000); |
| 31 | return 0; // Set break point at this line. |
| 32 | } |
| 33 |
