Task3 Construct Binary Tree 20 Pts Write A Program To Build A Binary Tree According To An Input Matrix And Returns 1 (55.13 KiB) Viewed 44 times
Task3 Construct Binary Tree 20 Pts Write A Program To Build A Binary Tree According To An Input Matrix And Returns 2 (55.13 KiB) Viewed 44 times
Task3: Construct Binary Tree (20 pts) • Write a program to build a binary tree according to an input matrix, and returns the pointer to the root of the binary tree. • Complete Node* constructBT(int matrix[][3], int rowNum); • Input matrix format: . The matrix has three columns • Every entry stores the key of a node. All keys are positive integers. . For each row, the first column value denotes the key of a node, second column value denotes the key of its left child and third column value denotes the key of its right child. (-1 means the child is empty.) • The value stored in matrix[0][0] is the root of the tree. • You can assume there is no duplicate keys in the binary tree. . For example: 123 245 24-1 3-16 367 123 Data Structures and Task3: Construct Binary Tree (25 pts) • Submit the complete code set including • Struct definition • Declaration and implementation for every necessary method. . You can use the printTree method provided in previous labs) • A main function which runs your own test cases 123 245 367 123 24-1 3-16 3 Demo results
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!