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,
you dont need that much to do this problem
modify merge method in mergesort to calculate the sum in nlgn
think about it it's quite easy
you must have heard of Count Inversion problem , this is similar to that
problem
On Tue, Apr 10, 2012 at 6:49 AM, bharath kannan bharathgo...@gmail.comwrote:
how should i approach this problem
https://www.spoj.pl/problems/DCEPC206/
can it be solved 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 algogeeks@googlegroups.com.
To unsubscribe from this
I dont know if it can be solved in O(n). But O(nlogn) can be done using
BIT. Refer topcoder tutorial for Binary indexed trees.
On Mon, Apr 9, 2012 at 10:56 AM, tarun chabarwal admin20...@gmail.comwrote:
how should i approach this problem
https://www.spoj.pl/problems/DCEPC206/
can it be
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
@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
@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
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 anshumishra6...@gmail.comwrote:
string all1Multiple(int x)
{
string s;
setint mySet;
mySet.push(0);
int psize, r=1;
do
{
@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 jondhale.pra...@gmail.com 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
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 anshumishra6...@gmail.comwrote:
string all1Multiple(int x)
{
string s;
setint mySet;
mySet.push(0);
int psize, r=1;
do
{
psize = mySet.size();
s
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
string all1Multiple(int x)
{
string s;
setint 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
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
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,
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 sanjay.raj...@live.inwrote:
Sort the array first and then check for the
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
if extra space is allowed .. can use counting sort
On Sun, Aug 14, 2011 at 8:38 PM, Ankur Garg ankurga...@gmail.com 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
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
18 matches
Mail list logo