Zzenith
BAN USER@shadyabhi... as you said, Lazy allocation means to allocate the memory when it is required, so the remaining part of the 600mb data will be stored in external storage. but Heap is used for malloc and the heap resides in physical memory, so how is it possible for malloc to return true as it will not have sufficient heap memory.
 Zzenith July 25, 2013just with simple modification, we can correct it...
1. if most significant digit is equal to most significant digit of root
then
A. if both root and number has next digit to compare, repeat step 1.
B. else if root does not have next digit then insert( root>left, number).
C. else swap the value of root and number and insert( root>left, number)
...
1. do tree traversal
2. if any of them hits the NULL after the leaf node then chek for another one doing the same or not.
int flag = 0;
bool chekSimilatTree( tree1 root1, tree2 root2) {
if( (root1==NULL && root2!=NULL)  (root2==NULL && root1!=NULL) ) {
flag=1; return ;
}
if (root1==NULL && root2==NULL )
return ;
chekSimilarTree ( root1>left, root2>left);
chekSimilarTree( root1>right, root2>right );
if( flag==1 )
return false;
else return true;
}

Zzenith
June 22, 2013 isn't it the worst case running time is O(n^2) as in every selection we may get the min element as pivot.
i think, need some modification in selecting pivot. while using randomized selection, we can choose pth ele of every 5 element continuesly n then amont them, choos the pth element, (it may not be the pth ele but it will be near to that) complexity O(n).
1. consider a minheap, with a count variable counting number of elements in heap.
2. iterate array, insert elements in heap until count is less than k+1;
3. continue iterating array, compare the ith element with top of minheap, if ele is less then continue
else
{ replace the top of minheap with the element. update the heap (logk) }
complexity O(n*log(k) ).
Open Chat in New Window
I thinks, its 3.
 Zzenith February 23, 2015check for x.
check for 1,
check for 2.
explanation: suppose user has to return true or false for each paper. he has to check for x, if the front contains 1 or 2.