Re: [algogeeks] Re: worst case complexity

2011-09-10 Thread Prashant Kulkarni
In work case (ie max value of i,j and k ll be) for(i=0;in;i++) //i=n { for(j=0;jn*n;j++) // j=i=n; { for(k=0;kn*n;k++) // k=j=i=n; } } So Ans O(n^5) -- Prashant Kulkarni On Sat, Sep 10, 2011 at 12:05 PM, deepikaanand swinyanand...@gmail.comwrote: ans : O(n^5) inner

Re: [algogeeks] Algo Book

2011-09-06 Thread Prashant Kulkarni
The Algorithm Design Manual By Steve S. Skiena -- Prashant Kulkarni On Tue, Sep 6, 2011 at 3:48 PM, Udit Gupta uditgupta...@gmail.com wrote: Fundamentals of Computer Algorithms by Sartaj Sahni On Tue, Sep 6, 2011 at 3:45 PM, Neha Gupta nehagup...@gmail.com wrote: hey guys , do tell me

Re: [algogeeks] MICROSOFT INTERVIEW QUESTIONS faced by my frenz nd me

2011-08-08 Thread Prashant Kulkarni
are printing its starting location so we will some garbage value. -- Prashant Kulkarni On Mon, Aug 8, 2011 at 11:28 AM, Mohit Goel mohitgoel291...@gmail.comwrote: can anyone one explain output of question 1. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Single linked list questions.

2011-01-06 Thread Prashant Kulkarni
hi, for 1 question, use stack to display elements in reverse order. can you elaborate your 2nd question ? -- Prashant Kulkarni On Thu, Jan 6, 2011 at 4:56 PM, dinesh bansal bansal...@gmail.com wrote: Hi Guys, There are some questions asked to me: 1. How do you print the SLL in reverse

Re: [algogeeks] linkd list

2010-12-15 Thread Prashant Kulkarni
4)look for 'z' in the list by considering all numbers as unsigned if u found then check sign of that number it be opposite of 'z' if so return 1 else 0 [above steps is repeated for all elements] *correct me if I am wrong* -- Prashant Kulkarni IISc Bangalore On Wed, Dec 15, 2010 at 10:36 AM

Re: [algogeeks] linkd list

2010-12-15 Thread Prashant Kulkarni
we can use binary search algorithm to find the z ( sorting ll take O(n log n ) but it is very less compared to n^2 * log n ) -- Prashant Kulkarni On Wed, Dec 15, 2010 at 3:32 PM, Ankur Murarka ankur.murarka@gmail.comwrote: wouldn't your algo take n^3 time as well given the fact

Re: [algogeeks] All numbers in Array repeat twice except two

2010-10-04 Thread Prashant Kulkarni
I think we can do XOR operation Over all numbers and result will contain number which appeared only once. Correct Me If I'm Wrong -- Prashant Kulkarni On Mon, Oct 4, 2010 at 3:17 PM, malli mallesh...@gmail.com wrote: I have an array. All numbers in the array repeat twice except two

Re: [algogeeks] Algorithm to determine the largest number of envelopes that can be nested inside one another.

2010-09-28 Thread Prashant Kulkarni
i think it is similar to finding max in a list O(n) or sorting algorithm O(n log n) -- Prashant Kulkarni On Tue, Sep 28, 2010 at 11:33 PM, Rahul Singal rahulsinga...@gmail.comwrote: A possible solution i can think is create a directed graph where each vertex is a envelope and edges

Re: [algogeeks] find out the mid point of a single linked list

2010-09-28 Thread Prashant Kulkarni
of the linked list -- Prashant Kulkarni On Tue, Sep 28, 2010 at 10:54 PM, Divesh Dixit dixit.coolfrog.div...@gmail.com wrote: Given a singly-linked, find out (just give the basic logic) the mid point of a single linked list in a single parse of the list. Assume the program would be loaded

Re: [algogeeks] Re: Addition Of numbers in SLL

2010-08-14 Thread Prashant Kulkarni
i think we can use recursion method to reverse the list -- Prashant Kulkarni On Sat, Aug 14, 2010 at 11:40 PM, Lokesh Agarwal lokesh...@gmail.comwrote: how can you traverse from last without reversing it. and there is no need fof using extra stack space. -- You received this message

Re: [algogeeks] confusion

2010-07-29 Thread Prashant Kulkarni
every printf statement wll return how many number of parameter/variable print r printed so 2nd nested wll print number 1 n remaing two printf statement wll print number of parameters are printed so total three 1's .:) -- Prashant Kulkarni || Lokaha Samastaha Sukhino Bhavanthu || || Sarve Jana

Re: [algogeeks] Recursion help!

2010-06-04 Thread Prashant Kulkarni
) here if (n-1) th is greater so it will return its value -- Prashant Kulkarni On Fri, Jun 4, 2010 at 7:13 PM, Raj N rajn...@gmail.com wrote: int Max(int a[],int n) { int max; if(n==1) return a[0]; else max=Max(a,n-1); if(maxa[n

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

2010-05-19 Thread Prashant Kulkarni
i think we can use sorting algorithm like insertion sort, in insertion sort whenever we are putting the element into it's proper position we can check whether this elements already exists don't put otherwise insert into into it's proper position (element) -- Prashant Kulkarni || Lokaha Samastaha