Re: [algogeeks] Re: What is the time to get min element from the binary max heap !!

2011-09-20 Thread CHERUVU JAANU REDDY
We can find minimum element in O(n) time. Just compare leaf nodes in max heap tree. Cheers Janardhan Reddy Cheruvu +91-9642421117 On Tue, Sep 20, 2011 at 6:39 PM, saurabh agrawal wrote: > I think, we have to delete all the elements from the heap which takes > o(n*logn). Please share

Re: [algogeeks] Re: another google telephone interview question

2010-05-18 Thread CHERUVU JAANU REDDY
Here u r using extra space to store count values.. CHERUVU JAANU REDDY M.Tech in CSIS On Tue, May 18, 2010 at 7:01 PM, Jagadish M wrote: > > On May 18, 8:29 am, Terence wrote: > > How do you maintain the heap? Could you explain in de

Re: [algogeeks] Convert a Binary tree into spike.

2010-05-13 Thread CHERUVU JAANU REDDY
Use Breadth First search .. CHERUVU JAANU REDDY M.Tech in CSIS On Thu, May 13, 2010 at 9:18 AM, vinayan c wrote: > 2-> -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To po

Re: [algogeeks] Re: Finding youngest common ancestor of two nodes in a binary tree

2010-04-08 Thread CHERUVU JAANU REDDY
l : r; return(tmp); } } } ---- CHERUVU JAANU REDDY M.Tech in CSIS On Thu, Apr 8, 2010 at 7:22 PM, Rahul Singh wrote: > Perform inorder traverse for both the node. match element by element the 2 > strings and when first time the string deviates thats Lowest common > ancestor. > -rahul >

Re: [algogeeks] First k smallest elements

2010-03-28 Thread CHERUVU JAANU REDDY
you will get k smallest elements and root is kth smallest element in the array this is O(nlogk) CHERUVU JAANU REDDY M.Tech in CSIS On Sun, Mar 28, 2010 at 8:41 PM, abhijith reddy wrote: > Can any one tell how to do this when there are 'm'

Re: [algogeeks] Implement a Queue using a stack

2010-02-08 Thread CHERUVU JAANU REDDY
2:printf("Deleted element:%d\n",delete()); break; case 3:exit(0); break; } } return(0); } CHERUVU JAANU REDDY M.Tech in CSIS On Mon, Feb 8, 2010 at 1:49 PM, atul verma wrote: > I dont think its

Re: [algogeeks] Implement a Queue using a stack

2010-02-07 Thread CHERUVU JAANU REDDY
CHERUVU JAANU REDDY M.Tech in CSIS On Sun, Feb 7, 2010 at 7:02 PM, naren wrote: > how to Implement a Queue using a stack if space complexity is there... > > -- > You received this message because you are subscribed to the Google Groups > "Al

[algogeeks] Re: Fibonacci number

2009-04-04 Thread CHERUVU JAANU REDDY
use memorization u will get in 0(logn).. On Fri, Apr 3, 2009 at 4:01 PM, alex wrote: > > Does anyone has some good algorithm for Fibonacci number question ,get > the F(n) ,if n is a big number ... > > > > > -- ---- CHERU

[algogeeks] Re: Binary search

2009-03-01 Thread CHERUVU JAANU REDDY
;> j++; > >> else > >> c=i; > >> } > >> cout< >> return 0; > >> } > >> > >> On Sun, Mar 1, 2009 at 9:50 AM, sharad kumar > >> wrote: > >>> > >>> hi, > >>> does the above solution need

[algogeeks] Binary search

2009-02-28 Thread jaanu
Given a sorted arrays of N integers, possibly with duplicates, write a function that returns the highest index of an element X in that array if found or -1 otherwise.(use Binary search) --~--~-~--~~~---~--~~ You received this message because you are subscribed to t