Post, Code and Quiet Time.
  • Home
Sign in Subscribe

Binary Tree

A collection of 1 post
Binary Tree

Rebuild Binary Tree from Preorder and Inorder Traversal

Question: struct NODE { NODE* pLeft; NODE* pRight; char chValue; }; e.g. preorder traversal : a b d c e f inorder traversal : d b a e c f Answer: #include using namespace std; struct NODE { NODE* pLeft; NODE* pRight; char chValue; }; void PrintPreOrder(NODE* pRoot) { if (!pRoot) return; cout << pRoot->chValue;
Oct 23, 2017 1 min read
Page 1 of 1
Post, Code and Quiet Time. © 2023
Powered by Ghost