You have given 2 array. You need to find whether they will
create the same BST or not.
For example:
Array1:10 5 20 15 30
Array2:10 20 15 30 5
Result: True
Array1:10 5 20 15 30
Array2:10 15 20 30 5
Result: False
One Approach is Pretty Clear by creating BST O(nlogn) then
checking two tree for identical O(N) overall O(nlogn) ..we
need there exist O(N) Time & O(1) Space also without extra
space .Algorithm ??
DevoCoder
guest
Posted 3 months ago #
#define true 1
#define false 0
int check(int a1[],int a2[],int n1,int n2)
{
int i;
//n1 size of array a1[] and n2 size of a2[]
if(n1!=n2) return false;
//n1 and n2 must be same
for(i=0;i
Is swift better than c++?
What are the Disadvantages of shared object repository?
What are the key differences between Pig vs MapReduce?
What is infinite loop?
In EB metering we face problem kva jump even in no load condition.can any one help to control this
If you are using logical databases how will you modify the selection-screen elements?
Is it necessary to know java to learn hadoop?
Is pluto really a planet?
Comment on batch normalization?
can you send me the previous years drug inspector exam model papers of andhrapradesh
Write an algorithm to show the reverse of link list?
Tell us why would you do the setcontentview() in oncreate() of activity class?
I have done BE ( computer science) i secleted in sbi clerical written exam. so what questions they asked according to my subject please send me the answer
Difference between star and snowflake schemas?