i tried to understand using this ***R***
but i cant see to what side left or right
build( arr + start, end - start );
it refers too?
because if start if 0 at the begginig then our...
Type: Posts; User: cfan
i tried to understand using this ***R***
but i cant see to what side left or right
build( arr + start, end - start );
it refers too?
because if start if 0 at the begginig then our...
i have an inorder traversal array (in every node we have only two sons or no sons)
and i need to construct a BST tree out of it.
if i had freedom i would do a fuction of node build(arr,start,end)...
i think the answer is searching the first node whoch is larger then arr[i]
is it ok?
its not 2i but i+1
i got to that conclution too
but the right son is hard
because if a tree is not simetric and somewhere we dont have a left of right node
then we cant break it into two
i have an array of the pre order traversal
and i know that the root it arr[0]
and its left son is arr[1]
whats the formula for spotting the value of its right son value
??
i need to write a recursive function which finds the smallest number in a tree which is bigger
then the given number
??
each combination of chars in every length
or is "the" a substring of "beach towel" since all the letters are there somewhere?
yes
i dont want you to solve it for me.
i want to understand the general way
how to play whic a string in order to get every combination
in iterative way
??
the problem is that i have the code of recursive subsets
but i dont andestand it at all.
could you tell me the general iterative index way of generating each string.
this is the original question:
"there are stations all over the country which measure the temperature and the
amount of rain fallen every day of the week.
each station writes in a weekly report...
i have a recursive subset code
but its way too long to remember
is there some easier iterative algorithm to generate all the sub string of a given string
?
template <typename ElemType>
bool BST<ElemType>::remove(ElemType data) {
return recRemoveNode(root, data);
}
template <typename ElemType>
bool BST<ElemType>::recRemoveNode(nodeT *& t,...
correct me if i am wrong
balanced means that height of the left subtree minus height of the right tree
is less then two.
so thats not what i am looking for
so i will use whiteflags method:
...
are you sure that avl is my answer
because i am ask to act on pure BST
not self balancing bst trees
can you specify what algorithm is for me?
i looked it threw
and it talks only about avl trees
not bst
although avl is a self balancing bst
and there is no recursive node removal
??
i have some corrections to the original question:
the node to be deleted is not te root
it has only one son or no sons.
regarding whiteflags post:
if i free the wanted node i need to rearrange...
after solving the previus one with the root.
i looked in
Eternally Confuzzled - Binary Search Trees I
but i coudnt see the general algorithm for
deleting a node in a BST tree in a recursive way...
node* delete (node*root)
{
node* prev,*temp;
if (!root) return NULL;
if (!(root->left)
{
temp=root->right;
free(root); //i am not sure its legal because its a...
no i think ill just copy the value 5 in the root
and make the right some of 4 to be 4.5
and free the leaf copy of 5
ok?
ok you are correct not -1
but 4.5
what do i do if 5 has a left son 4.5
6
/ \
4 7
thats a direct quote from the text so its not me.
5 could have a left child -1 and its still be the predeccesor
my question is what do i do with this 8
or if i had a -1 as the left son of 5...
for one child or no child:
If the node has a left child, replace it with the left child.
If the node has a right child, this is the symmetric case for if the node has a left child.
If the node has...
i have been given this assignment by my teacher
of course i will go to him with this problem.
but there has to be a basic algorithm for this
so there is no general algorithm?