[algogeeks] Minimum sum of Array

2013-01-05 Thread mukesh tiwari
to solve this problem ? I didn't assume that number will be positive because it was not given in the problem. Regards Mukesh Tiwari --

[algogeeks] Re: Remove spaces

2011-08-12 Thread mukesh tiwari
If its allowed in Haskell then only one line is enough. import Data.List stringWithspace :: String - String stringWithspace xs = unwords.words $ xs You can run this program on ideone [ http://ideone.com/RloOE ] On Aug 12, 8:00 pm, ankit sambyal ankitsamb...@gmail.com wrote: Guys sorry for

[algogeeks] Re: BST+Heap

2011-06-08 Thread mukesh tiwari
What you explained is the property of Treap data structure . You can have a look at wiki [ http://en.wikipedia.org/wiki/Treap ] or you can search google for treap. On Jun 8, 8:15 pm, Akshata Sharma akshatasharm...@gmail.com wrote: A rooted binary tree with keys in its nodes has the binary search

[algogeeks] Re: TLE in KPEQU [ Haskell ]

2011-06-05 Thread mukesh tiwari
Solved . Just changed my count function count :: Integer - Integer - Integer count 0 _ = 0 count n p = div n p + count ( div n p ) p -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Setnja Wrong Answer [ Haskell Code ]

2011-05-19 Thread mukesh tiwari
Hello all , i am trying to solve this problem https://www.spoj.pl/problems/SETNJA/ but getting WA. Could some one please tell me what is wrong with algorithm. import qualified Data.ByteString.Char8 as BS import Data.List as L solve :: BS.ByteString - Integer solve xs = solverHelp xs 1 where

[algogeeks] Re: Recurrence quadratic...

2007-10-21 Thread mukesh tiwari
hello Allysson here is the link for discussion of problem http://groups.google.co.in/group/comp.programming/browse_thread/thread/4a06904cbbd7c2d3/69c5adbf6badbd8c#69c5adbf6badbd8c On Oct 22, 5:19 am, Allysson Costa [EMAIL PROTECTED] wrote: Dear friends, I have a recurrence to solve but I'm

[algogeeks] Spiral number

2007-10-18 Thread mukesh tiwari
Hello everybody , i am trying to solve this(http://online- judge.uva.es/ p/v9/903.html) problem and input constrants are such that it is not possible to store the the numbers in the array and print those numbers. So i use the algorithm 1)get the number and return its coordinate 2) take the

[algogeeks] efficient method of exponation

2007-09-08 Thread mukesh tiwari
hello everybody . for a given value i have to find a lowest possible steps in exponation . i searched on net and i find three ways binary method [steps will be log2(n)+number of 1 bits in binary expression of n -1] ,factor method [l(n)=1+l(n-1) if n is prime else n=k*p then l(n)=l(k)+l(p)] .

[algogeeks] Re: Sum of Gaussian factor

2007-06-27 Thread mukesh tiwari
factors. My solution is very ugly but it does solve the problem in a little bit over 60 seconds. I'm sure there exists more elegant solution for this. Best, -Lego On 6/22/07, mukesh tiwari [EMAIL PROTECTED] wrote: hello everybody . i want to know algorithm for finding gaussian

[algogeeks] Problem with conditional statement

2007-06-18 Thread mukesh tiwari
Hi everybody i am trying to solve problem http://acm.uva.es/p/v105/10512.html. my solution is (x+y)y=P(1) (x-y)x=Q (2) (1+(y/x))xy=P (1)//taking x outside (1-(y/x))x^2=Q (2) dividing 1 and 2 and let (y/x)=k (1+k)k/(1-k)=P/Q; solving for k k=-(P+Q) +-sqrt((P+Q)^2+4PQ)/2Q; since

[algogeeks] Need Algorithm for Persistence number

2007-06-10 Thread mukesh tiwari
Hi everbody , i am trying to solve this problem http://acm.uva.es/p/v105/10527.html but i am not getting any efficient algorithm . One algorithm i applied while(n9) for i=2 to 9 if(n%i=0)//then i is factor of n and may be a digit in the number store i for further processing

[algogeeks] need help for graph problem ...

2007-05-01 Thread mukesh tiwari
hello friends i m trying to solve problem http://online-judge.uva.es/p/v5/523.html in this problem i using floyd's algorithm i m able to figure out total cost but i m not able to figure out the path . may be the reason that i did not understand the algorithm fully and i use it as a black box

[algogeeks] getting wrong answer for problem

2007-03-29 Thread mukesh tiwari
hi friends i m trying to solve this problem http://acm.uva.es/p/v111/11151.html but getting wrong answer.. my algorithm is i m trying to enumarate all the n*(n+1)/2 substrings of string ,where n is string length... and checking for palindrom .. suppose i have input ADAM .then all

[algogeeks] dynamic programming ..

2007-03-03 Thread mukesh tiwari
hi everybody ..i am stuck on a problem ..i need ur help.. problem is that i have k coins(v1,v2,v3..vk) and money S . and i have to find out that whether it is possible or not to make the money S using the given coins...firstly i was using greedy but it failed on some inputs ..like we have 2

[algogeeks] need help of physics

2007-02-18 Thread mukesh tiwari
hi everybody i m trying to solve this problem but i can't sovle it ...plz suggest me algorithm to solve it . link http://students.iitk.ac.in/programmingclub/iopc/problems/ or problem itself is Two electron are confined in a 1D infinite potential well. Each start from opposite ends with

[algogeeks] Re: need help regarding problem..

2007-01-24 Thread mukesh tiwari
Hi Minhaz thnkx for help and pointing me to my mistake but now one thing i know ... is the number of points in the input will be distinct or there may be some duplicate point . like suppose the input is like this... 9 0 1 0 2 1 2 1 3 2 3 3 3 3 0 1 0 1 1 now the output of this program will (0

[algogeeks] Re: need help regarding problem..

2007-01-24 Thread mukesh tiwari
Hi Minhaz thnkx for help and pointing me to my mistake but now one thing i know ... is the number of points in the input will be distinct or there may be some duplicate point . like suppose the input is like this... 9 0 1 0 2 1 2 1 3 2 3 3 3 3 0 1 0 1 1 now the output of this program will (0

[algogeeks] Re: problem regarding lexicographic path

2006-12-13 Thread mukesh tiwari
hi Lego Haryanto i tried ur metoh but still not working ...here is my code and i m tired with this program . i am not getting even a single method to find lexicographic shortest path. #includestdio.h int min1(int k,int m,int n) { int

[algogeeks] problem regarding lexicographic path

2006-12-06 Thread mukesh tiwari
hi friends i am try to solving this question http://online-judge.uva.es/p/v1/116.html for this problem i use left to right dynamic programming so i m getting the total minimum cost but i m not getting how to find out lexicographically shortest path .here is my code .if u can change it fine