int main() { srand(time(NULL)); int l,u,n,i,loop; l=1;u=100;n=15;i=30; /* printf("Enter l : "); scanf("%d",&l); printf("Enter u : "); scanf("%d",&u); printf("Enter n : "); scanf("%d",&n); printf("Enter i : "); scanf("%d",&i); */ interval=(u-l+1)/n; node *root = (node*)malloc(sizeof(node)); root = CREATE_INTERVAL_TREE(l, u, n); for(loop=1;loop<=i;loop++) { int k=l+rand()%(u-l+1); INSERT(root,k); } PRETTY_PRINT(root, maxDepth(root)); printf("\n"); MERGE(root,2,10); PRETTY_PRINT(root, maxDepth(root)); printf("\n"); }
//----------------------------------------------------------------// STLString MOAIAnimCurve::ToString () { STLString repr; PRETTY_PRINT ( repr, mTime ); PRETTY_PRINT ( repr, mValue ); return repr; }
//----------------------------------------------------------------// STLString MOAILayerBridge2D::ToString () { STLString repr( MOAITransform::ToString () ); PRETTY_PRINT ( repr, mSourceScene ) PRETTY_PRINT ( repr, mTargetScene ) return repr; }
void PRETTY_PRINT(node *root, int k) //working correctly { int i; if(root==NULL) return; PRETTY_PRINT(root->lChild,k-1); for(i=1;i<=k;i++) printf("\t"); printf("[%d, %d]",root->lower,root->upper); list *templist = (list*)malloc(sizeof(list)); templist=root->listptr; while(templist!=NULL&&templist->data!=0) { printf(" %d",templist->data); templist=templist->next; } printf("\n"); PRETTY_PRINT(root->rChild,k-1); }