Home | History | Annotate | Download | only in recursion
      1 //===-- main.cpp ------------------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #include <stdio.h>
     11 #include <stdlib.h>
     12 #include <stdint.h>
     13 
     14 struct node;
     15 struct node {
     16 	int value;
     17 	node* next;
     18 	node () : value(1),next(NULL) {}
     19 	node (int v) : value(v), next(NULL) {}
     20 };
     21 
     22 void make_tree(node* root, int count)
     23 {
     24 	int countdown=1;
     25 	if (!root)
     26 		return;
     27 	root->value = countdown;
     28 	while (count > 0)
     29 	{
     30 		root->next = new node(++countdown);
     31 		root = root->next;
     32 		count--;
     33 	}
     34 }
     35 
     36 int main (int argc, const char * argv[])
     37 {
     38 	node root(1);
     39 	make_tree(&root,25000);
     40 	return 0; // Set break point at this line.
     41 }
     42