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 behavioral diagram in UML?
How to retrive current environment in laravel?
What are moments and collections?
What is meant by xsd?
What is the difference between a verilog task and a verilog function?
What is decorator in angular 2?
how we sesign the transformer give some specifion regarding design of transformers
Why doesn’t Azure Redis Cache have an MSDN class library reference like some of the other Azure services?
What are the two basic ways in which classes that can be run as threads may be defined?
Tell me how we are getting light from electrical bulb?
What is Node.js foundation?
List languages/frameworks that can be used to develop windows azure applications?
Explain what if a file is corrupted or missing in a dataset?
Enhance the Debug() function so that the programmer has to press Enter or Return after debugging is deactivated?
Does windows server 2016 come in 32 bit?