[algogeeks] Complexity doubt

2012-08-25 Thread rahul sharma
guys can anyone tell me the link from where i can read about the big o ,big w and big q ...i read from corma but i didnt get theses from that...thnx in advance -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email

Re: [algogeeks] Complexity

2011-12-15 Thread Durgesh Kumar
saurabh is right nd or U can also download lecture 2 of series Introduction to Algorithm mit lecture . It is jst awesome . On 12/15/11, saurabh singh saurab...@gmail.com wrote: Introduction to Algorithms Coreman On Wed, Dec 14, 2011 at 8:21 PM, Shashank Jain shashan...@gmail.com wrote: I

[algogeeks] Complexity

2011-12-14 Thread Shashank Jain
I need to study both space and time complexities. What is the best source? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

Re: [algogeeks] Complexity

2011-12-14 Thread saurabh singh
Introduction to Algorithms Coreman On Wed, Dec 14, 2011 at 8:21 PM, Shashank Jain shashan...@gmail.com wrote: I need to study both space and time complexities. What is the best source? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] complexity of recursion

2011-09-14 Thread tech coder
an interseting problem for a fibonacci series the recurrence relation is t(n)=t(n-1)+t(n-2)+O(1) on solving it gives upper bound of O(n^2) but when draw tree for the recurcsion we see that it is growing exponentially giving a complexity of O(2^n). so what is the complexity for fibonaacci series

Re: [algogeeks] complexity of recursion

2011-09-14 Thread shady
it is O(n) actually we use memoization in recursion to avoid calculating same subproblem. On Wed, Sep 14, 2011 at 9:38 PM, tech coder techcoderonw...@gmail.comwrote: an interseting problem for a fibonacci series the recurrence relation is t(n)=t(n-1)+t(n-2)+O(1) on solving it gives upper

Re: [algogeeks] Complexity Help..

2011-08-03 Thread ankit sambyal
@Aanchal : My mistake... Its complexity can't be O(n^2) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Complexity of euclidean theorem to find GCD

2011-08-03 Thread Ankur Khurana
Hi , can you tell me that how do we arrive at the complexity of the repetitive division theorem to find GCD. I tried to read it on net but was not able to find a satisfactory answer. Is it log ( max(a,b)) or is it max of 5+max number of digits(a,b) . . Can anybody clarify this and how you arrive

[algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
Can someone please help me with finding the complexity of below code: /*The code is of finding all possible combinations of coins (given in array, each having infinite supply) that sum upto given target value.*/ void solve(int index[], int arr[], int target, int cursum, int n, int sz) { cnt++;

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
really sorry for that, here is the complete code: #includeiostream using namespace std; void print(int arr[], int index[], int n) { int i=1; while(i=n) { coutarr[index[i]] ; i++; } coutendl; } void solve(int index[], int arr[], int target, int cursum, int n, int sz) {

Re: [algogeeks] Complexity Help..

2011-08-02 Thread Ravinder Kumar
Its complexity is same as of finding the all combination if a given string . it is O(n!) -- *With Regards :* Ravinder Kumar B.Tech Final Year Computer Science and Engineering MNNIT Allahabad -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group.

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
Can we prove this?? On Wed, Aug 3, 2011 at 1:45 AM, Ravinder Kumar ravinde...@gmail.com wrote: Its complexity is same as of finding the all combination if a given string . it is O(n!) -- *With Regards :* Ravinder Kumar B.Tech Final Year Computer Science and Engineering MNNIT

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
I was asked a similar question in an interview, and the interviwer told me that it is O(n^2), I have no idea how he got that!! On Wed, Aug 3, 2011 at 1:47 AM, aanchal goyal goyal.aanch...@gmail.comwrote: Can we prove this?? On Wed, Aug 3, 2011 at 1:45 AM, Ravinder Kumar

Re: [algogeeks] Complexity Help..

2011-08-02 Thread Ravinder Kumar
My mistake .I only saw the program flow which is similar to permutation . Its DP similar to 0,1 knapsack Complexity is O(nc) where c is size of knapsack and n is number different of items -- *With Regards :* Ravinder Kumar B.Tech Final Year Computer Science and Engineering MNNIT

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
But this is not dp rite? I know knapsack problem, it has 2 nested for loops, thats why it is O(nc). And also, here we have infinite supply of each item. And we want all possible ways of getting the sum, not just one way. Here, function is recursively called, like a dfs is performed here... So,

Re: [algogeeks] Complexity Help..

2011-08-02 Thread Ravinder Kumar
it depends on target sum . Size of index array is depends on target sum . Try to dry run it you will get hint . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe

Re: [algogeeks] Complexity Help..

2011-08-02 Thread ankit sambyal
@Ravinder : Its not a DP problem.. If it was, where are the sub problems reused or in other words, where is memoization ?? @Anchal : Its complexity is O(n^2). Look at the following segment in ur code : for(int i=index[n];isz;i++) { index[n+1]=i;

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
let sum=45 int arr[]={1,2,3,4,5}; /*43545 times the function solve is called*/ /*2611 ways of achieving the sum (2611 ways will be printed)*/ if, int arr[]={1,3,10,30,75}; /*2931 times the function solve is called*/ /*53 ways of

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
@ Ankit Sambyal, please explain me why is it O(n^2) taking into account what the number of times solve is called (in my example above.) On Wed, Aug 3, 2011 at 10:36 AM, aanchal goyal goyal.aanch...@gmail.comwrote: let sum=45 int arr[]={1,2,3,4,5}; /*43545 times the function solve is called*/

Re: [algogeeks] Complexity Help..

2011-08-02 Thread aanchal goyal
sorry, *target=45*, not sum. sum=0 when we call the function the first time. On Wed, Aug 3, 2011 at 10:39 AM, aanchal goyal goyal.aanch...@gmail.comwrote: @ Ankit Sambyal, please explain me why is it O(n^2) taking into account what the number of times solve is called (in my example above.)

Re: [algogeeks] Complexity Help..

2011-08-02 Thread Nitin Nizhawan
Running time can be found by solving this recursion. T(sz,target) = SUM {1=i=sz} T(i,target-1) T(sz,0) = c I think it is around O(sz^target) Thanks Nitin On Wed, Aug 3, 2011 at 10:40 AM, aanchal goyal goyal.aanch...@gmail.comwrote: sorry, *target=45*, not sum. sum=0 when we call the function

Re: [algogeeks] complexity

2011-07-28 Thread sachin sharma
it is O(plg5) Best Wishes Sachin Sharma -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com.

Re: [algogeeks] complexity

2011-07-28 Thread Puneet Gautam
@sachin: Explain pls...!!? On 7/28/11, sachin sharma sachin.bles...@gmail.com wrote: it is O(plg5) Best Wishes Sachin Sharma -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

Re: [algogeeks] complexity

2011-07-28 Thread Rajeev Kumar
@Puneet, get_power(int a, int b) works in O(logb) as you keep on dividing b with 2... you are calling that method *P *times in *func(int p) *method. So it is *plogb...*u r passing 5 as b valueit will be *plog5* On Thu, Jul 28, 2011 at 11:45 AM, Puneet Gautam

Re: [algogeeks] complexity

2011-07-28 Thread Puneet Gautam
k...thanks... On 7/28/11, Rajeev Kumar rajeevprasa...@gmail.com wrote: @Puneet, get_power(int a, int b) works in O(logb) as you keep on dividing b with 2... you are calling that method *P *times in *func(int p) *method. So it is *plogb...*u r passing 5 as b valueit will be

[algogeeks] complexity

2011-07-27 Thread Puneet Gautam
Time complexity..? int get_power(int a, int b) { if(!b) return 1; if(b%2) return a * get_power(a, b/2); return get_power(a, b/2); } int func(int p) { int sum = 0; for(int i = 1; i = p; ++i) { sum += get_power(i, 5); } return sum; } Is it O(plgp) or O(plg5) -- You received this message because

[algogeeks] Complexity QuickSort

2011-07-05 Thread oppilas .
If u could find the (n/4)th element of an array in O(n) time, then what is the worst time complexity of quick sort algo if this algo is used to decide the pivot element. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group,

[algogeeks] Complexity Help ??

2011-01-22 Thread Decipher
fun(n) { if(n=2) return (1); else return ((fun(n-1)*fun(n-2)); } find the order of complexity . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group,

Re: [algogeeks] Complexity Help ??

2011-01-22 Thread abhijith reddy
O(2^n) On Sat, Jan 22, 2011 at 8:58 PM, Decipher ankurseth...@gmail.com wrote: fun(n) { if(n=2) return (1); else return ((fun(n-1)*fun(n-2)); } find the order of complexity . -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post

Re: [algogeeks] Complexity Help ??

2011-01-22 Thread Decipher
Could u pls explain ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options,

Re: [algogeeks] Complexity Help ??

2011-01-22 Thread Preetam Purbia
T(n) = T(n-1) + T(n-2) + O(1) On Sat, Jan 22, 2011 at 11:28 PM, Decipher ankurseth...@gmail.com wrote: Could u pls explain ?? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Complexity of Algorithms [√n and log ( n^2)]

2010-07-31 Thread sourav
f(n) = sqrt(n) [squate root of n] g(n) = log(^2) [log of (n square)] For the above pair of functions is f(n) = Ω(g(n))? i.e., is there some c 0, such that f(n) = g(n) for all n? Give proof in case answer is yes or no.

Re: [algogeeks] Complexity of Algorithms

2010-05-07 Thread Yalla Sridhar
it is impossible 2 give a formula or a generic method to calculate the complexity for any algo.. method to calcuate complexity differs per algo On Mon, May 3, 2010 at 11:45 PM, scanfile rahul08k...@gmail.com wrote: Pls can anyone help me out that how to calculate the complexity of any

Re: [algogeeks] Complexity of Algorithms

2010-05-07 Thread rajesh kumar
check the design and analysis of algorithm by thomas cormen On Mon, May 3, 2010 at 11:45 PM, scanfile rahul08k...@gmail.com wrote: Pls can anyone help me out that how to calculate the complexity of any Algorithm? -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Complexity of Algorithms

2010-05-07 Thread Varun Nagpal
Complexity of an algorithms is focussed on two aspects: Time it takes to execute the algorithm(Time Complexity) and the amount of space in memory it takes to store the associated data(Space Complexity). Most literature in computer science focuses on Time Complexity as it directly influences the

Re: [algogeeks] Complexity of Algorithms

2010-05-07 Thread sharad kumar
use master theorem or recursion tree method On Wed, May 5, 2010 at 7:29 PM, Varun Nagpal varun.nagp...@gmail.comwrote: Complexity of an algorithms is focussed on two aspects: Time it takes to execute the algorithm(Time Complexity) and the amount of space in memory it takes to store the

[algogeeks] Complexity of Algorithms

2010-05-05 Thread scanfile
Pls can anyone help me out that how to calculate the complexity of any Algorithm? -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to

[algogeeks] Complexity of searching in this alternate representation of tree

2010-04-10 Thread Himanshu Aggarwal
Hi, The book on data structures by Langsam and Tanenbaum gives an alternate representation of trees as : struct treenode { int data; struct treenode * son; struct treenode * sibling; }; Such type of nodes can be used to make trees in which each node can have any