C++ :: Want To Return A Node Using Recursion
Mar 28, 2013
So the task is to find the node with minimum value of a binary tree (not binary search tree). the input is the pointer to the root of the tree. and i cannot make recursion work when i do if conditions. here is what i have
CPPtr minimumvalue(CPPtr SP){
CPPtr min = NULL;//node of minimum value
if(SP== NULL){// if there is a node, begin comparing
return NULL;
[Code] ....
No matter where i call my function i get errors like unhandled exception at some memory. How to use recursion in this?
View 1 Replies
Mar 27, 2013
So the task is to find the node with minimum value of a binary tree (not binary search tree). the input is the pointer to the root of the tree. and i cannot make recursion work when i do if conditions. here is what i have Code: /*function 3-takses as input the pointer to the root of the tree and returns a pointer to the node with the minimum value*/
CPPtr minimumvalue(CPPtr SP){
CPPtr min = NULL; //node of minimum value
if(SP== NULL){ // if there is a node, begin comparing
return NULL;
}
else{
if(SP->data<SP->left->data){ //if the node has smaller value than its left child
min = SP; //update node of minimum value
[code].....
no matter where i call my function i get errors like unhandled exception at some memory. how to use recursion in this?
View 6 Replies
View Related
Aug 12, 2013
I've to use recursion function that return if the string has a same letters:
for example: - fff = true
- fFf = false
I did this but the return answer is always: NOT!
bool iSameLetters(char str[SIZE]) {
if(str[0]='