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
Can you have multiple retained earnings a/c?
What are independent graphics subsystems?
What are some secret sharing schemes ?
What is race condition?
What is the guid concept in crm. How is it used?
What is transaction server auto commit?
Can you explain completion handler?
Is mongodb publicly traded?
What is difference between table aliases and column aliases? Do they affect performance?
Explain the use of excitation table in digital electronics?
Is sql a backend?
Suppose you have to plan a business meeting or a party for some clients. How will you go about the task?
Assuming that a firm pays tax at a 50 per cent rate, compute the after tax cost of capital in the following cases: I. A 8.5 % preference share sold at par. II. A perpetual bond sold at par, coupon rate of interest being 7 per cent III. A ten year, 8 percent, Rs.1000 par bond sold at Rs.950 less 4 percent underwriting commission.
What is gelatinization?
2. Tell me about a time when you had to use your presentation skills to influence someone’s opinion.