Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please only provide the function Design and analysis of algorithms void insertNode(TreeNodePtr *treePtr, int value) if (treePtr is empty) allocate memorv and put here else
Please only provide the function
Design and analysis of algorithms
void insertNode(TreeNodePtr *treePtr, int value)\ if (treePtr is empty) allocate memorv and put here else if (valuedata) insert at the left tree else insert at the right tree void insertNode( TreeNodePtr *treePtr, int value ) { if ( *treePtr NULL) \ *treePtr- malloc( sizeof( TreeNode ) ); if( *treePtr != NULL) { (*treePtr)->data - value; (*treePtr )->leftPtr- NULL; (*treePtr )->rightPtr- NULL; else printf( "No memory available. n"); } else if ( value data) insertNode( &( ( *treePtr )->leftPtr ), value ); else if ( value > (*treePtr)->data) insertNode( &( ( *treePtr)->rightPtr), value); else printf( "dup"); void inOrder( TreeNodePtr treePtr) if ( treePtr!- NULL)\ inorder( treePtr-leftPtr ): printf( "%3d", treePtr->data ); inOrder( treePtr->rightPtr); void preOrder( TreeNodePtr treePtr) if(treePtr != NULL ) { printf( "%2d", treePtr->data ); preOrder( treePtr->leftPtr); preOrder( treePtr->rightPtr); void postOrder( TreeNodePtr treePtr) if(treePtr != NULL ) { postOrder( treePtr->leftPtr); postOrder( treePtr->rightPtr); printf( "%2d", treePtr-data ): Problem Implement the function to find the largest and least elements in the binary tree: void max(TreeNodePtr *treePtr, int *largest, int *least)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started