Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

How are HIV and AIDS related?

Answered: 1 week ago