Linked List Insertion vs. BST Insertion Time Costs
By : Dazhi Bai
Date : March 29 2020, 07:55 AM
To fix the issue you can do When insertion to linked list is considered, it is mainly assumed that the list does not have an order that should be maintained during an insertion. (i.e. the elements of the list are not ordered in a certain way) Hence, the cost of the insertion is considered to be the cheapest that can be achieved. After all, we, as you put it, don't care how the elements are ordered once we are done with the insertion. In that spirit, just adding the new node to the head of the list works, and that operation has O(1) time complexity, as you too have said. In binary search tree(BST), however, the data structure has a predefined order. Thus, when we are talking about an insertion, where to insert is defined by the definition of BST itself.

sum of nodes greater than a number in BST
By : user7189542
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You're making this a bit too complicated. Your base case is hitting a leaf node (which you already know how to handle). You have three recursion cases: code :
current > num
result = current +
recur on right child +
recur on left child
current = num
result = current +
recur on right child
current < num
result = recur on right child
return result

Number of nodes in a BST which are bigger than a given KEY
By : user2212279
Date : March 29 2020, 07:55 AM
Does that help your else is not correct, it's condition is start>key == key which should be treated the same as start>key < key so rewrite it to code :
else
return this>PrivateFindNumbersThatBiggerThanKey(key, start>rightNode);

Count number of left nodes in BST
By : Popuri
Date : March 29 2020, 07:55 AM
it should still fix some issue The second recursion branch overwrites the value from the first. Also you should add 1 for the left root. Something like:

Given a BST and its root, print all sequences of nodes which give rise to the same bst
By : Himani Shah
Date : March 29 2020, 07:55 AM
seems to work fine I assume you want a list of all sequences which will generate the same BST. In this answer, we will use Divide and Conquer.

