Top "Binary-tree" questions

A tree data structure in which each node has at most two child nodes.

Level Order Traversal of a Binary Tree

void traverse(Node* root) { queue<Node*> q; Node* temp_node= root; while(temp_node) { cout<<temp_…

c++ algorithm binary-tree breadth-first-search tree-traversal
how to get the path from root to a given node on a binary tree?

I am trying to find out how to get the path from root to a given node on a binary …

tree binary-tree
Max-Heapify A Binary Tree

This is one of the interview questions I recently came across. Given the root address of a complete or almost …

algorithm data-structures heap binary-tree binary-heap
Height of a tree with only one node

According to Wikipedia, The height of a tree is the length of the path from the root to the deepest …

tree height binary-tree discrete-mathematics
Convert binary tree to array in c

I want to convert a binary tree to an array using C. I tried but was unsuccessful. My binary tree …

c arrays tree binary-tree preorder
B trees vs binary trees

If I am implementing in-memory(RAM) search operation with b trees, then would it be better in terms of caching …

performance binary-tree b-tree
Sorting the elements in Binary trees

Here is a question I was recently asked in an interview. A binary tree is given with a condition that …

algorithm sorting binary-tree
Convert a binary tree to linked list, breadth first, constant storage/destructive

This is not homework, and I don't need to answer it, but now I have become obsessed :) The problem is: …

algorithm tree binary-tree
Diameter of Binary Tree - Better Design

I have written a code for finding diameter of Binary Tree. Need suggestions for the following: Can I do this …

java algorithm recursion tree binary-tree
Retrieving a Binary-Tree node's depth non-recursively

Can anyone point out a way of getting the depth of a Node in a Binary Tree (not a balanced …

recursion binary-tree non-recursive