[algogeeks] how to solve this?

2013-04-04 Thread arun kumar
Given an expression in the form of a string, solve for x. The highest power of x in the expression will be equal to 1. Operators allowed are +, * and -. These are all binary operators. So, 2x would be written as 2*x. Every operator will be followed by a single term or a constant. For example,

[algogeeks] binary search tree over btree

2012-04-01 Thread arun kumar
hi i just like to know when you will go for binary search tree over btree. advantage and disadvantage, application of both of them. thank you in advance Regards, Arun kumar -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group

Re: [algogeeks] segment tree

2012-01-21 Thread arun kumar
this link deal with applying lazy propagation for the problem LITE in spoj. hope this one help you http://apps.topcoder.com/forums/?module=ThreadthreadID=690098messageID=1298729mc=8view=tree#1298729 regards arun On Sat, Jan 21, 2012 at 6:10 PM, UTKARSH SRIVASTAV usrivastav...@gmail.comwrote: Hi

[algogeeks] ACM-ICPC Kanpur 2011 LCM Extreme

2011-12-18 Thread arun kumar
long long function( int n ) { long long res = 0; for( int i = 1; i = n; i++ ) for( int j = i+1; j = n; j++ ) res+=lcm(i,j); return res; } N=5*10^6 and TestCases=25000.. TimeLimit=5s Can anyone give hints to solve this ? Thanks in advance ! -- You received

Re: [algogeeks] Question from Google interview

2011-08-19 Thread arun kumar
Build a Trie... Recursive search on trie This ll give you all possible interpretation of the given key On 8/18/11, Navneet Gupta navneetn...@gmail.com wrote: Given a string containing multiple words such that spaces between words is missing. Also, you have a dictionary containing valid

Re: [algogeeks] Re: String questions

2011-08-13 Thread arun kumar
maybe we can use KMP PREFIX function to find ans. On Sat, Aug 13, 2011 at 3:20 PM, *$* gopi.komand...@gmail.com wrote: can be done using suffix trees.. On Sat, Aug 13, 2011 at 2:06 PM, Brijesh Upadhyay brijeshupadhyay...@gmail.com wrote: Dynamic programming would surely help but i dont

Re: [algogeeks] Tug of War

2011-07-30 Thread arun kumar
problem link: https://www.spoj.pl/problems/TUG/ i think your asking about this one On Sat, Jul 30, 2011 at 5:51 PM, shubham shubh2...@gmail.com wrote: hey sylvester, just clarify the problem .. Is it such that in forming the group some people can be left out or the sum of the number of

Re: [algogeeks] Re: MICROSOFT!!!!

2011-07-23 Thread arun kumar
@ shady:the algo posted by naveen ms is better than eulicd algorithm to find gcd. for more details refer http://en.wikipedia.org/wiki/Binary_GCD_algorithm On Sat, Jul 23, 2011 at 5:20 PM, shady sinv...@gmail.com wrote: gcd can always be found in O(log(larger number)) using Euclidean algorithms

Re: [algogeeks] Re: MICROSOFT!!!!

2011-07-23 Thread arun kumar
the questions were same for intern as well as for placement except for last one i.e design question which was not there for intern. On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0...@gmail.com wrote: @ shady:the algo posted by naveen ms is better than eulicd algorithm to find gcd. for more

Re: [algogeeks] explain plzz:output in file old.out

2011-07-23 Thread arun kumar
oh thanks. On Sat, Jul 23, 2011 at 11:18 AM, shady sinv...@gmail.com wrote: ya, you are right, but it returns -1 when it reaches the end of file. On Sat, Jul 23, 2011 at 9:15 AM, arun kumar kumar0...@gmail.com wrote: @shady:i have a doubt. scanf returns number of succesfully read words. how

Re: [algogeeks] Re: MICROSOFT!!!!

2011-07-23 Thread arun kumar
the question was for positive number only.:) On Sat, Jul 23, 2011 at 5:42 PM, saurabh singh saurab...@gmail.com wrote: 2 will fail for negatve numbers. On Sat, Jul 23, 2011 at 5:33 PM, shady sinv...@gmail.com wrote: thanks a lot arun :) On Sat, Jul 23, 2011 at 5:27 PM, arun kumar kumar0

Re: [algogeeks] Re: MICROSOFT!!!!

2011-07-23 Thread arun kumar
Anna university,chennai On Sat, Jul 23, 2011 at 5:52 PM, saurabh singh saurab...@gmail.com wrote: where it was written?We had the same question in our MS exam and it was never mentioned so. On Sat, Jul 23, 2011 at 5:46 PM, arun kumar kumar0...@gmail.com wrote: the question was for positive

Re: [algogeeks] Prime Numbers

2011-07-23 Thread arun kumar
hope this link will help you http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=primalityTesting On Sat, Jul 23, 2011 at 10:39 PM, frank abb...@gmail.com wrote: what is the efficient algorith to find the prime numbers or to check a number prime or not ? Helpful if the pseudo code provided.

Re: [algogeeks] explain plzz:output in file old.out

2011-07-22 Thread arun kumar
@shady:i have a doubt. scanf returns number of succesfully read words. how come it will return -1? On Sat, Jul 23, 2011 at 12:17 AM, geek forgeek geekhori...@gmail.com wrote: @shady and @varun ... i hav got it thanx both of u  :) On Fri, Jul 22, 2011 at 11:31 AM, shady sinv...@gmail.com

Re: [algogeeks] logic error:

2011-06-06 Thread arun kumar
any team which has nt lost a match will win On Mon, Jun 6, 2011 at 1:12 PM, PRAMENDRA RATHi rathi prathi...@gmail.com wrote: i am thinking that the team with win point 4 will be the winner .. is this wrong? https://www.spoj.pl/problems/SBETS/ because there are only 16 match 8+4+2+1(final)

Re: [algogeeks] SPOJ ETF

2011-06-03 Thread arun kumar
read topcoder tutotial http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=primeNumbers hope will be useful On Fri, Jun 3, 2011 at 5:33 PM, kartik kartik.sac...@gmail.com wrote: what's worng in my code..why the judge is giving TLE.plzz help me out my code is #

Re: [algogeeks] spoj problem acode

2011-06-01 Thread arun kumar
hey me getting wrong ans..can anyone pls help me out here s my code #includestdio.h #includeiostream #includestring #includecstring using namespace std; unsigned long long a[5001]={0}; unsigned long long fun(string s,int n) { if(n==0) return 1; if(a[n]) return a[n]; int c=0,d=0;

Re: [algogeeks] Dp problem

2011-04-04 Thread arun kumar
i think this problem can be solved by binary search correct me if i m wrong On Mon, Apr 4, 2011 at 2:36 PM, rajat ahuja catch.rajatah...@gmail.com wrote: You have to paint N boards of length {B1, B2, B3… BN}. There are K painters available and you are also given how much time a painter takes to

Re: [algogeeks] Dp problem

2011-04-04 Thread arun kumar
read topcoder tutorial binary search...u will get an idea On Mon, Apr 4, 2011 at 4:38 PM, rajat ahuja catch.rajatah...@gmail.com wrote: then please share wid me yaar thanks in advance On Mon, Apr 4, 2011 at 4:30 PM, Manmeet Singh mans.aus...@gmail.com wrote: Simple Dp On Mon, Apr 4, 2011

[algogeeks] Re: Given Infinite array ,Find one number problem

2007-05-07 Thread arun kumar manickan
/7/07, Nisha Subramanian [EMAIL PROTECTED] wrote: Okie... if not O(n) how can u solve it in min order ..at any cost it shouldn't turn out to be an infinite order.Is their any way Now? On 5/7/07, arun kumar manickan [EMAIL PROTECTED] wrote: we can use a modified binary search to find

[algogeeks] Re: Given Infinite array ,Find one number problem

2007-05-06 Thread arun kumar manickan
we can use a modified binary search to find the element. whenever u calculate a new lower and upper boundary you can move them forward and backward respectively so that both point to a index which contains a valid number.But still this wont give O(n). do we have any memory constraints? do we have

[algogeeks] Re: Arranging arrays in to two sets.

2006-11-14 Thread arun kumar manickan
interesting solution really. but the order of the algorithm seems to be n^2 / 4 . [ as we will look at n/2 elements each time and swap them, andrepeating this for n/2 times ] please correct me if I am wrong. thanks. --~--~-~--~~~---~--~~ You received this

[algogeeks] Re: Least Lost Selection Problem

2006-11-10 Thread arun kumar manickan
my idea, say, fruit1 is required to make personA and personB happy. personA requires num1 number offruit1 and personB requires num2 number of fruit1. then required number of fruit1 is max( num1 , num2 ) similary if you can extend this to all who require it and calculate the max requirement for