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
What is frequncy?
Explain the benefits of proper inheritance.
What is jsp translation time?
What is BSSID?
Im Simil,doing 6th semester Electronics & Communication Engineering.After completing my course I would like to be an integral part of Siemens technology.For dat when & how shoult I apply?
Can I do transforms or add new functionality?
how to fin top two miximum values in sql? not 2nd both max value of 1st and 2nd both have to find out
What is aot in angular?
How do you foster a culture of continuous improvement among production teams? Can you share an example of a successful continuous improvement initiative you led?
What are dynamic actions and how do you create dynamic actions in sap?
Explain relationship between jdbc and sybase.
Whats the difference between registerclientscriptblock, registerclientscriptinclude and registerclientscriptresource?
What is the use of drupal?
When should I use microsoft access vs excel?
Why script error occur in between recording in qtp?