Top "Binary-tree" questions

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

Skip List vs. Binary Search Tree

I recently came across the data structure known as a skip list. It seems to have very similar behavior to …

algorithm language-agnostic data-structures binary-tree skip-lists
In-order iterator for binary tree

How can I write a Java iterator (i.e. needs the next and hasNext methods) that takes the root of …

java algorithm iterator binary-tree nodes
When to use Preorder, Postorder, and Inorder Binary Search Tree Traversal strategies

I realized recently that while having used BST's plenty in my life, I've never even contemplated using anything but Inorder …

data-structures computer-science binary-tree preorder
Reverse A Binary Tree (Left to Right)

I was looking at interview questions and I recently came upon one that asked you how to reverse a general …

java data-structures tree binary-tree reverse
Nth largest element in a binary search tree

How to find the Nth largest node in a BST? Do I keep a count variable while doing In Order …

algorithm binary-tree
Finding if a Binary Tree is a Binary Search Tree

Today I had an interview where I was asked to write a program which takes a Binary Tree and returns …

algorithm binary-tree binary-search-tree
How would you print out the data in a binary tree, level by level, starting at the top?

This is an interview question I think of a solution. It uses queue. public Void BFS() { Queue q = new Queue(); …

algorithm binary-tree breadth-first-search
Inorder tree traversal: Which definition is correct?

I have the following text from an academic course I took a while ago about inorder traversal (they also call …

data-structures binary-tree tree-traversal
Binary Search Tree Implementation in C++ STL?

Do you know, please, if C++ STL contains a Binary Search Tree (BST) implementation, or if I should construct my …

c++ binary-tree binary-search
Printing BFS (Binary Tree) in Level Order with Specific Formatting

To begin with, this question is not a dup of this one, but builds on it. Taking the tree in …

python algorithm binary-tree breadth-first-search tree-traversal