# Questions tagged [binary-search-tree]

A binary search tree is a data structure which consists of a root node with left and right child nodes. The left node and all of its descendants have smaller values than the root node, while the right node and all of its descendants have larger values than the root node. The children of the root ...

**-1**

votes

**1**answer

47 views

### How to remove largest number in binary search tree?

I know how to build a binary tree, but I need a methodpublic void delMax() which removes the largest number of the tree. So that means I have to remove the value which is in the last position on the ...

**0**

votes

**1**answer

35 views

### Knight's Travail: Recursive Solution

The problem is to create a data structure, similar to a binary search tree that can list all possible moves a knight (in chess) can make on a 8x8 board. I came up with a single node class with the ...

**-1**

votes

**1**answer

54 views

### find the most right leaf in the lowest leven of an almost complete bst

I have a question, which I can't seem to solve.I need to find the most right leaf in the lowest level of the tree, in an almost complete bst, while the size of the tree is unknown. >in O(log(n)^2)....

**0**

votes

**1**answer

22 views

### Insertion failure in a Binary Search Tree

Here is my code for the creation and insertion of the binary search treestruct BTNode{int info;struct BTNode *left, *right;};struct BTNode* create(int data){struct BTNode *root;...

**0**

votes

**2**answers

44 views

### Inserting in a Binary Search Tree

I've made a binary search treestruct BTNode{int info;struct BTNode *left,*right;};I've wrote a code to insert a node in the treevoid insert(struct BTNode *root,int data){struct ...

**0**

votes

**1**answer

33 views

### In a BST how can I keep an array as a value?

I am reading a file where the first word that appear on the line is the one that I want as a key. The others words, I want to keep them in an array of chars(char* array[]). The problem I have is, when ...

**0**

votes

**1**answer

20 views

### Balanced BSTs using hashmaps?

BBSTs using a hash-map instead of pointersI was thinking about the idea to implement a balanced binary search tree using hash-maps. An implementation can be something like this : hash-map's key will ...

**-1**

votes

**1**answer

47 views

### data structure that consists of min-heap and binary search tree(tricky)

I am having really hard time with this and I don't know how to approach it - would really appreciate your help:A company tries to build a SP tree data structure so that each intersection contains ...

**-1**

votes

**1**answer

58 views

### android firebase database using material search filter all child value

i am trying to search data from firebase database. but i don't know. here i attached my firebase database screenshot. In my firebase database, there are name, phone, datefrom and dateto that are ...

**0**

votes

**0**answers

12 views

### How are letters treated in binary search trees compared to numbers?

How can I tell which letters are larger or have priority compared to numbers?With numbers, I know that if the root of a tree is 10, inserting 8 would go to the left child and inserting 11 would go ...

**0**

votes

**1**answer

51 views

### Storing a hard copy of data in a binary search tree format

I got to thinking that if we store data in a text file, it is stored in a linear fashion. While you can store things in sorted order, there’s always the chance that the thing you’re looking for is ...

**0**

votes

**1**answer

10 views

### Binary Search Tree Iterator java

I did the LeetCode question Binary Search Tree Iterator. the following code is what I learned from others. One part I didn't understand which is cur=cur.right. Since I got the smallest value of cur....

**0**

votes

**1**answer

24 views

### Returning an element with a specific rank k in a binary tree

I already implemented a method rankOfElement(x) in pseudocode which returns the rank for a given node x:function rankofElement(x) {rank=0; Node temp=root;while (temp.key !=x) {...

**2**

votes

**1**answer

34 views

### Code failed to create BST with array of numbers

I try to create a BST with the following code, nums=[4,5,8,2]var TreeNode=function (val) {this.val=val;this.left=this.right=null;this.count=1;}var constructBST=...

**0**

votes

**1**answer

22 views

### How would you calculate the sum of a binary tree recursively with given input tree?

Hi! I need help finding a way to calculate the sum of a binary tree recursively. I have put what I have been working on but I am still really confused. Please, any help would be appreciated. Define ...