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
#include
Post New Facebook C Interview Questions
How is the marker interface used in Java?
How will you drop variables using indices in a data frame?
Explain about objects in PHP?
What is routing and how it's work?
Where can the metastore database be hosted?
What are the advantages of zend framework 3? Explain
Explain your role while working in a team.
What is python? State some programming language features of python.
Please guide me... We are dealing in trading of industrial material. What is the difference between importer, 1st stage dealer, 2nd stage dealer and 3rd stage dealer? Whether all of these above can pass on the excise duty to the end user. Please tell me and thanks in advance.
Tell about your work experience. Why you quit that job?
how can you get the errors in job? when loops are araised we get error?
Shall I use 40A semiconductor Fuses in 32 A SFU ? Frame size is same. What Happen if Fuses burn on SFU?
Define data page.
What is the best method for Storing Objects in Cassandra ?
What are cookies in analytics?