Re: [algogeeks] DS Q

2011-11-17 Thread Piyush
b) Binary search Binary search has to be done in O(logn) but in a linked list individual elements can't be accessed in O(1) time. and hence its not suitable to have a linked list as a data structure in binary search. -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] DS Q

2011-11-17 Thread Vijay Khandar
Thank u very much On Thu, Nov 17, 2011 at 4:05 PM, Piyush piyushmadan2...@gmail.com wrote: b) Binary search Binary search has to be done in O(logn) but in a linked list individual elements can't be accessed in O(1) time. and hence its not suitable to have a linked list as a

[algogeeks] DS QUESTION

2011-09-18 Thread kartik sachan
given n nodes ,how many different possible tree can be formed??(not necessary that all are binary treeit could be any tree...) -- *WITH REGARDS,* * * *KARTIK SACHAN* *B.TECH 3rd YEAR* *COMPUTER SCIENCE AND ENGINEERING* *NIT ALLAHABAD* -- You received this message because you are

Re: [algogeeks] DS QUESTION

2011-09-18 Thread Amol Sharma
2nCn/(n+1) ..simple maths :) -- Amol Sharma Third Year Student Computer Science and Engineering MNNIT Allahabad http://gplus.to/amolsharma99 http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99 On Sun, Sep 18, 2011 at 12:37

Re: [algogeeks] DS QUESTION

2011-09-18 Thread Anup Ghatage
(2n)! / ((n+1)! + (n)!) Where n is the number of nodes. The above mentioned formula is for the n'th Catalan number. @all correct me if I am wrong On Sun, Sep 18, 2011 at 7:11 AM, Amol Sharma amolsharm...@gmail.com wrote: 2nCn/(n+1) ..simple maths :) -- Amol Sharma Third Year

Re: [algogeeks] DS QUESTION

2011-09-18 Thread Jagannath Prasad Das
@Amol:the answer u have given is for binary ..and thats catalan number...recursive solution On Sun, Sep 18, 2011 at 1:33 PM, Anup Ghatage ghat...@gmail.com wrote: (2n)! / ((n+1)! + (n)!) Where n is the number of nodes. The above mentioned formula is for the n'th Catalan number.

[algogeeks] ds apti

2011-08-22 Thread Nikhil Veliath
need link for ds aptitude ! ! thanks for ur help -- 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] DS representation.

2011-07-31 Thread rahul
I think it might help... struct node { int coef; /* A,B,C */ int var; /* x */ unsigned int exp;/* power of x */ struct node *next; /* next term in polynomial equation */ }; typedef struct node NODE; Regards. On Fri, Jul 29, 2011 at 7:32 PM, saurabh singh

Re: [algogeeks] DS representation.

2011-07-30 Thread saurabh singh
Once again I feel it boils down to the problem where the representation has to be used. If its a sparse polynomial(i dont think its a technichal term but i hope folks realize wat I want to say) link list is a gud idea. PS:MS visited our campus for interns(as well as for placements) and they were

[algogeeks] DS representation.

2011-07-29 Thread Puneet Gautam
Hi, pls tell me which data structure has following representation:: A+Bx+Cx(^2)+Dx(^3)+...+Nx(^n-1).?? reply asap...!! -- 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] DS representation.

2011-07-29 Thread Prem Krishna Chettri
SLL... Bit Field (best optimisation)... On Fri, Jul 29, 2011 at 3:06 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: Hi, pls tell me which data structure has following representation:: A+Bx+Cx(^2)+Dx(^3)+...+Nx(^n-1).?? reply asap...!! -- You received this message because

Re: [algogeeks] DS representation.

2011-07-29 Thread sunny agrawal
Array that that stores A,B,C,D,E. it looks like u r on some telephonic interview :P On Fri, Jul 29, 2011 at 3:06 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: Hi, pls tell me which data structure has following representation:: A+Bx+Cx(^2)+Dx(^3)+...+Nx(^n-1).?? reply

Re: [algogeeks] DS representation.

2011-07-29 Thread rajeev bharshetty
You can use a Hash map which maps the coefficients of the equation and their exponents. Is this feasible ?? On Fri, Jul 29, 2011 at 3:10 PM, sunny agrawal sunny816.i...@gmail.comwrote: Array that that stores A,B,C,D,E. it looks like u r on some telephonic interview :P On Fri, Jul 29,

Re: [algogeeks] DS representation.

2011-07-29 Thread Prem Krishna Chettri
For all Folks.. DS question answer cannot be simple yes no. it is always the tradeoff of Space and time Complexity. On Fri, Jul 29, 2011 at 3:26 PM, rajeev bharshetty rajeevr...@gmail.comwrote: You can use a Hash map which maps the coefficients of the equation and their exponents. Is this

Re: [algogeeks] DS representation.

2011-07-29 Thread Puneet Gautam
@sunny: well not really in an interview .. its that adobe is coming 1st august to our college.. I found this question in its placement papers..!!! I thought there might be a predefined ds for such representation... What is an SLL..? On 7/29/11, rajeev bharshetty rajeevr...@gmail.com wrote:

Re: [algogeeks] DS representation.

2011-07-29 Thread sunny agrawal
SLL = singly linked list but i think array is better choice :) On Fri, Jul 29, 2011 at 3:36 PM, Puneet Gautam puneet.nsi...@gmail.comwrote: @sunny: well not really in an interview .. its that adobe is coming 1st august to our college.. I found this question in its placement papers..!!! I

Re: [algogeeks] ds

2010-06-08 Thread Antony Vincent Pandian.S.
I dont think so This approach is better than O(nlogn) On Tue, Jun 8, 2010 at 9:10 AM, harit agarwal agarwalha...@gmail.comwrote: @vadivel selvaraj your approach is O(nlogn) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

Re: [algogeeks] ds

2010-06-07 Thread sharad kumar
@ anand all input is in 1 array n in ur approach u hve used 2 arrays ,bt that is not d ques -- 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,

Re: [algogeeks] ds

2010-06-07 Thread Anurag Sharma
@anand. Perhaps, its not correct. Does not work for larger inputs. Anurag Sharma On Mon, Jun 7, 2010 at 3:35 AM, Anand anandut2...@gmail.com wrote: Here is my approach is o(n). http://codepad.org/YAFfZpxO http://codepad.org/YAFfZpxO On Sun, Jun 6, 2010 at 7:28 AM, sharad kumar

Re: [algogeeks] ds

2010-06-07 Thread Raj N
@sain: But the question demands O(n) time On Mon, Jun 7, 2010 at 3:35 AM, Anand anandut2...@gmail.com wrote: Here is my approach is o(n). http://codepad.org/YAFfZpxO http://codepad.org/YAFfZpxO On Sun, Jun 6, 2010 at 7:28 AM, sharad kumar sharad20073...@gmail.comwrote: this is ques by

Re: [algogeeks] ds

2010-06-07 Thread vadivel selvaraj
Hi guys d soln z quite easy by swapping the variables.. consider a1a2a3a4b1b2b3b4 In the first iteration, swap (a2,b1),(a4,b3) giving a1b1a3b3a2b2a4b4 In the second iteration, swap (a3b3,a2b2) which gives d soln... a1b1a2b2a3b3a4b4... Any comments on dis?? On Mon, Jun 7, 2010 at 1:51 PM, Raj N

Re: [algogeeks] ds

2010-06-07 Thread Rohit Saraf
Of course you should do it via swappings.. why would one think of anything else :) -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 On Mon, Jun 7, 2010 at 10:39 PM,

[algogeeks] ds

2010-06-06 Thread sharad
Convert in O(n) time: a1a2a3a4.aNb1b2b3b4.bN to a1b2a2b2a3b3a4b4..aNbN -- 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

Re: [algogeeks] ds

2010-06-06 Thread sharad kumar
in o(n) take a separate array of size 2n and for iteration a[i] and a[i+1] should have ai and bi elelemnt On Sun, Jun 6, 2010 at 7:39 PM, sharad sharad20073...@gmail.com wrote: Convert in O(n) time: a1a2a3a4.aNb1b2b3b4.bN to a1b2a2b2a3b3a4b4..aNbN -- You received this

Re: [algogeeks] ds

2010-06-06 Thread sharad kumar
this is ques by adobe and they want inplace soln.. -- 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] ds

2010-06-06 Thread sharad
Given an array of size n wherein elements keep on increasing monotically upto a certain location after which they keep on decreasing monotically, then again keep on increasing, then decreasing again and so on. Sort the array in place (ie. using only O(1) extra memory). -- You received this

Re: [algogeeks] ds

2010-06-06 Thread Anand
Here is my approach is o(n). http://codepad.org/YAFfZpxO http://codepad.org/YAFfZpxO On Sun, Jun 6, 2010 at 7:28 AM, sharad kumar sharad20073...@gmail.comwrote: this is ques by adobe and they want inplace soln.. -- You received this message because you are subscribed to the Google

[algogeeks] DS question

2009-09-07 Thread yash
wap a program in efficient manner to remove all occurrence of duplicate character in the word and all occurrence of duplicate word in the file. i break the problem in two section( this is my approach it may be better one ) wap to remove all duplicate character in the word. (order is important)