[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, cons

[algogeeks] How to solve this

2011-12-23 Thread Ankur Garg
Suggest an algo with which u can find a random node in an infinitely long linked list -- 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

Re: [algogeeks] How to Solve This

2011-10-12 Thread anshu mishra
@amol I was not sure that for every number that has 3 in its unit place has one multiple which has all one. So I used that is if the remainder is coming that already appeared stop there coz it will make stuck in a loop. for ex. remainders are 1 3 19 23 37 1 3 19 that will repeat. but it in th

Re: [algogeeks] How to Solve This

2011-10-12 Thread Amol Sharma
@anshu- your code works fine.but can you plz explain how you concluded this codei mean what's the logic behind to check myset.size() > psize ?? ...as you are assuming that it will be increase string and check until this condition satisfies ?? -- Amol Sharma Third Year Student C

Re: [algogeeks] How to Solve This

2011-10-11 Thread shady
thanks a lot for replying to the post... but try posting algorithm rather than actual code... On Mon, Oct 10, 2011 at 2:17 PM, anshu mishra wrote: > string all1Multiple(int x) > { > string s; > set mySet; > mySet.push(0); > int psize, r=1; > do > { > psize = mySet.size(); > s += '1'; > r = r % x;

Re: [algogeeks] How to Solve This

2011-10-11 Thread Deoki Nandan
@moderator now is it not voilation of ur group terms ...Another code has been posted ... What u 'll say now.. On 12 October 2011 03:30, prasad jondhale wrote: > 23 has 3 in its unit place but it is not multiple of 111 or 11 or . > will u pls elaborate on the problem statement? > > > On Mon,

Re: [algogeeks] How to Solve This

2011-10-11 Thread prasad jondhale
23 has 3 in its unit place but it is not multiple of 111 or 11 or . will u pls elaborate on the problem statement? On Mon, Oct 10, 2011 at 2:17 PM, anshu mishra wrote: > string all1Multiple(int x) > { > string s; > set mySet; > mySet.push(0); > int psize, r=1; > do > { > psize = mySet.size();

Re: [algogeeks] How to Solve This

2011-10-10 Thread anshu mishra
string all1Multiple(int x) { string s; set mySet; mySet.push(0); int psize, r=1; do { psize = mySet.size(); s += '1'; r = r % x; mySet.push(r); r = r * 10 + 1; } while(mySet.size() > psize); if (r != 1) return "not Possible"; return s; } -- You received this message because you are subscribed to

[algogeeks] How to Solve This

2011-10-10 Thread VIHARRI
For every number that has 3 in its units place has one multiple which has all one's i.e. 111 is such multiple and 13 has a multiple 11. Write a program to find such multiple for any number that has 3 at its units place. -- You received this message because you are subscribed to the Google Gro

[algogeeks] How to solve this algorithm graph problem in polynomial time?

2011-09-26 Thread drealecs
I have a software problem and I'm searching for a solution but tried different algorithm approach and nothing came out. I'm not very familiar with all the graph algorithms and I hope there is already a way to solve this kind of problems in polynomial time. I need the algorithm for different task b

Re: [algogeeks] how to solve this

2011-08-16 Thread Sanjay Rajpal
Sort in increasing order. Sanjay Kumar B.Tech Final Year Department of Computer Engineering National Institute of Technology Kurukshetra Kurukshetra - 136119 Haryana, India On Tue, Aug 16, 2011 at 7:48 PM, Sanjay Rajpal wrote: > Sort the array first and then check for the given conditions. >

Re: [algogeeks] how to solve this

2011-08-16 Thread Sanjay Rajpal
Sort the array first and then check for the given conditions. Sorting the array takes O(nlog n) in the worst case. Sanjay Kumar B.Tech Final Year Department of Computer Engineering National Institute of Technology Kurukshetra Kurukshetra - 136119 Haryana, India On Tue, Aug 16, 2011 at 6:16 PM,

[algogeeks] how to solve this

2011-08-16 Thread Raghavan
A zero-indexed array A consisting of N integers is given. A triplet (P, Q, R) is triangular if and A[P] + A[Q] > A[R], A[Q] + A[R] > A[P], A[R] + A[P] > A[Q]. For example, consider array A such that A[0] = 10A[1] = 2A[2] = 5 A[3] = 1A[4] = 8A[5] = 20 Triplet (0, 2, 4) is triang

Re: [algogeeks] How to solve this problem

2011-08-14 Thread *$*
if extra space is allowed .. can use counting sort On Sun, Aug 14, 2011 at 8:38 PM, Ankur Garg wrote: > This is one question from Coreman > > 3rd Edition - > > 8-3-4 -- Sort n integers in the range 0 to n^3 -1 in O(n) time > > > Any ideas how to do this in O(n) > > -- > You received this messag

[algogeeks] How to solve this problem

2011-08-14 Thread Ankur Garg
This is one question from Coreman 3rd Edition - 8-3-4 -- Sort n integers in the range 0 to n^3 -1 in O(n) time Any ideas how to do this in O(n) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeek

[algogeeks] How to solve this problem efficiently?

2007-09-04 Thread Ray
He has lost many books, since many of his friends borrow his books and never bother to return them. He does not want to lose any more books and has decided to keep a record of all books that he lends to his friends. To make the task of borrowing a book a little difficult, he has given the followin

[algogeeks] how to solve this problem about minimal result?

2005-11-22 Thread fangvv
Given n point coordinate value {x1,y1}.{xn,yn} and weight w1.wn, How to find point P(X,Y) meet : X >= min{x1,x2,xn} , X <= max{x1, x2,.xn} Y >= min{y1,y2,yn} , Y <= max{y1, y2,.yn} dis(i, P) = sqrt((yi - Y)*(yi - Y) + (xi - X)*(xi - X)) min{ abs[w1*((y1-Y)/dis(1,P) + .