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

Binary Search Tree

A collection of 1 post
Binary Search Tree

Find the minimum larger node in binary search tree for a giving node

Question: Find the minimum larger node in binary search tree for a giving node. Answer: struct BSTreeNode { BSTreeNode* pLeft; BSTreeNode* pRight; BSTreeNode* pParent; int value; }; BSTreeNode* findMinLarge(BSTreeNode* node) { if (!node) return 0; if (Node* result = node->pRight) { while (result && result->pLeft) { result = result->pLeft; } return result; } if (node->pParent
Oct 25, 2017
Page 1 of 1
Post, Code and Quiet Time. © 2023
Powered by Ghost