Assuming the BST is balanced,

1.Convert BST to Sorted Doubly-Linked list in-place
2.have two pointers start and end at head and tail of the list
repeat until start->data + end->data == sum
increment start if start->data + end->data < sum
decrement end if start->data + end->data > sum
3.print the values of (start->data , end->data)

Regards,
Karthikeyan

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to