http://acm.mipt.ru/judge/problems.pl?problem=103CGISESSID=250a19da059c5576167cb500c62fa49c
i learned how to play normal NIM game but im not able to find the winning
strategy of misere game please put some light on it.
Thanks Regards
Amritpal singh
--
1st:
freopen(filename,r,stdin);
while(scanf(%s,str)!=-1)
{
printf(%s\n,str);
}
On Sun, Dec 9, 2012 at 3:22 PM, manish untwal manishuntw...@gmail.comwrote:
I gave this interview in August this year, two of the question i was not
able to answer properly
1) how to print the content of file in
find the all possible combination of digits ranging 1 to 9 whose sum is 10,
no digit shud be repeated in any combination.
1234
127
136
145
19
235
28
37
46
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/zLgbYxJdPYwJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
bool checkTree(Tree node)
{
if(node[right]==NULLnode[left]==NULL)
return true;
if(node[right]==NULLnode[left]!=NULL||node[left]==NULLnode[right]!=NULL)
return false;
else
return checkTree(node[right])checkTree(node[left]);
}
i think this algo can solve problem just traverse the node and keep eye
int treeMaxHeight(int index)
{
if(tree[index]==NULL)
return 0;
else
{
return 1+max(treeHeight(2*index),treeHeight(2*index+1));
}
}
int treeMinHeight(int index)
{
if(tree[index]==NULL)
return 0;
else
{
return 1+min(treeHeight(2*index),treeHeight(2*index+1));
}
}
reading from a file is bottle neck so better to read number of line into a
buffer then read it char by char or word by word depend on algo...
On Wed, Jul 4, 2012 at 10:44 PM, Navin Kumar algorithm.i...@gmail.comwrote:
Suppose a file.txt contains : 50 40 30 # # 5 # 10 # #
i want to fetch only
@bhaskar ur algo fails on this case (5+3)-(2+(3/6))
-+53+2/36
63/2+35-+
showing that 6/3 but actually it is 3/6
so i think it could be done by folowing algo
make a binary tree of given expression in O(n) then do postorder traversal
take O(n) so problem can be solved in O(n). and take O(2*n+1)
print statement become
printf(char *str= %c%s%c; main...,34,str,34);
now 34 is ascii value of double quote so first %c will get value
ascii_code_of(34) and %s will get same string and last %c again get
ascii_code_of(34) i.e so total string is char *str=+
Hi. I'm new to segment tree. im solving a problem in which we have to find
most frequent element in given range
so for the below testcase im trying to constructing tree but i stuck.
-1 -1 1 1 1 1 3 8 8 8
[i,j] is range of segment and x is the element that occur frequently and y
is the count of
x+y/(x*y)=1/N!
N!=x*y/(x+y)
assume x=y
N!=x^2/(2x)
x/2=N!
x=2*N!
1/(2*N!)+1/(2*N!)=1/N!
for example for N=4
1/48+1/48=1/24
On Mon, Jun 25, 2012 at 5:30 PM, Kumar Vishal kumar...@gmail.com wrote:
We have to find number of Pair(x,y)
which will satisfy the eq:
1/x + 1/y = 1/(n factorial)
@Mayank coding style not seems gud.. try this...
int main()
{
int testCases;
scanf(%d,testCases);
while(testCases--0)
{
//perform ur logic
//print output for each test case here instead of storing it into
an array.
}
}
return 0;
}
On Thu, Jun 21, 2012 at 10:35 PM,
can we create other methods or we have to use only enqueue and dequeue...?
if yes then simply
for(i=0;i=n/2;i++)
swap(i,n-i);
On Wed, Jun 20, 2012 at 6:46 PM, Navin Kumar algorithm.i...@gmail.comwrote:
@Saurabh: queue will be remain unchanged according to your algorithm.
Because if you will
i doesn't seem possible without using stack...
On Wed, Jun 20, 2012 at 10:13 PM, Navin Kumar algorithm.i...@gmail.comwrote:
@Rishabh: i know using stack or recursion it can be done easily with O(n)
space. I want to know whether there exist more space efficient algo for
this problem or not?
@abhishek pls send link me too... thanks.
On Mon, Jun 4, 2012 at 5:54 PM, Abhishek Sharma abhi120...@gmail.comwrote:
mailing you the link for same
On Mon, Jun 4, 2012 at 1:31 AM, Dhaval Moliya moliyadha...@gmail.comwrote:
If any one have algorithms for interviews by adnan aziz ebook...
#includeiostream
using namespace std;
class complex_number
{
public: int x,*ptr;
ostream operator (ostream out, complex_number c)
{
outsize=c.xendl;
for(int i=0;ic.x;i++)
outc.ptr[i] ;
out\n;
return out;
}
complex_number(int a)
{
complex_number const operator =(complex_number temp) const
{
return *this;
}
what is the job of marked 'const'???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
the others earlier.
Hope this helps :)
Thanks
Ramindar Singh
On Friday, 20 April 2012 23:49:48 UTC+5:30, amrit harry wrote:
http://www.codechef.com/**APRIL12/problems/PDSNUMhttp://www.codechef.com/APRIL12/problems/PDSNUM
--
You received this message because you are subscribed to the Google
a PDS number 36 and also
we have its reverse 63 as a PDS.
So by the time you reach the 9* line you just need to verify the 99 digit
as you have verified the others earlier.
Hope this helps :)
Thanks
Ramindar Singh
On Friday, 20 April 2012 23:49:48 UTC+5:30, amrit harry wrote:
http
http://www.codechef.com/APRIL12/problems/PDSNUM
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/6NhjBLnaw0AJ.
To post to this group, send email to
to connect to Google Talk ? And which library do you use ?
Thanks for answering.
Regards
Andreas
2012/3/25 amrit harry dabbcomput...@gmail.com:
Hi Friends i designed a chatbot for gmail. some time our friend use some
slang terms in chat and we feel hesitation in asking the meaning
Hi Friends i designed a chatbot for gmail. some time our friend use some
slang terms in chat and we feel hesitation in asking the meaning of that
slangs from friends so from now no need to do so or even googling it. just
invite 'slangdeco...@gmail.com' for chat and query those slangs and get
using ajax..hit google for ajax...
On Fri, Mar 23, 2012 at 10:07 AM, Aman Kumar amanas...@gmail.com wrote:
Hii to all
how to make a call of class's method(function) from client side to
server in java?
please replyit's urgent
--
You received this message because you are subscribed to
@sidarth
your method would not work it think.
let a case
sub tree: 4Main tree:
6
5 6
4 7
5
8
inorder traversal of sub tree
hi i found this qstn frum career cup pls help to solve this.
Given an integer n, compute 2 integers x, y satisfying: n=x*y=n+2; |x-y|
is minimal.
Thanks Regards
Amrit
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion
@shady consider this case
Main tree 1
subtree 1
2 3
2
4
3
preorder of Main= 1234 subtree= 123 but not subtree
On Wed, Mar 21, 2012 at 1:24 PM, shady sinv...@gmail.com
traversal= 1353##4##1##4##
sub
5
/\
3 4
preorder traversal 53##4##
now this substring exist in Main substring so it is a sub tree
correct me if me wrong.
Thanks
Amrit
On Wed, Mar 21, 2012 at 1:34 PM, amrit harry dabbcomput
interviewer told me that design a model for car sharing which use same
structure as google groups i designed the below design but i have some
doubts mention as comment pls make them clear.
Class POI// Point of interest
{
Parm:
double Lat,Lon;
}
Class Route
{
Parm:
POI start,end;
Time
that
n!/(r!(n-r)!) = n! * inv(r!) * inv( (n-r)! ) (mod M)
This is what the code is computing. A basic number theory book will
cover this stuff in the early chapters.
On Mar 5, 5:13 am, amrit harry dabbcomput...@gmail.com wrote:
#include cstdio
#define MOD 17
int powmod(int
i miss type recursion it is iterative algo but recursion can be use.
On Sat, Mar 3, 2012 at 6:29 PM, amrit harry dabbcomput...@gmail.com wrote:
use recursion
c[1][1]=1;
c[2][1]=1;
c[2][2]=1;
for(i=0;in;i++)
for(j=0;(2*i)-1;j++)
{
c[i][j]=(c[i-1][j]+c[i-1][j+1])
if(c[i][j]P)
c[i][j]-=P
use recursion
c[1][1]=1;
c[2][1]=1;
c[2][2]=1;
for(i=0;in;i++)
for(j=0;(2*i)-1;j++)
{
c[i][j]=(c[i-1][j]+c[i-1][j+1])
if(c[i][j]P)
c[i][j]-=P;//dont use module because it is slow we know the value never
exceede 2*P because we are adding 2 variable so just use subtract operation.
}
On Sat, Mar 3,
@dave +1.. :)
On Mon, Feb 27, 2012 at 10:55 AM, karthikeya s karthikeya.a...@gmail.comwrote:
oh my bad.really nice concept+1 dave.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
use TRIE to implement it and read about it from wiki... :)
On Fri, Feb 3, 2012 at 5:42 PM, Ravi Ranjan ravi.cool2...@gmail.com wrote:
Implement a MS key suggest like tool where on typing the first letters
will give a list of words starting with the typed text. The corpus will be
provided as a
find the lowest height of the bar multiply it with the number of the bars
in graph. it would be the minimum area.
On Tue, Jan 17, 2012 at 5:33 PM, Ashish Goel ashg...@gmail.com wrote:
You are given an array which represents the heights of every bar of a
histogram. Now all these bars are
sorry for last comment i misunderstand the problem.
On Tue, Jan 17, 2012 at 5:54 PM, amrit harry dabbcomput...@gmail.comwrote:
find the lowest height of the bar multiply it with the number of the bars
in graph. it would be the minimum area.
On Tue, Jan 17, 2012 at 5:33 PM, Ashish Goel ashg
@shady this problem is not from the online contest. i need this in my
project
@utkarsh please elloborate your idea in more detail
On Fri, Jan 6, 2012 at 9:40 AM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:
we can do bfs. from the point A do bfs until distance = R
On Fri, Jan
i also think so data must be represent in some special form i heard
about K-D trees but not yet studied about it
On Fri, Jan 6, 2012 at 12:26 PM, Lucifer sourabhd2...@gmail.com wrote:
@all..
To decide which points are within the range R, we need to look a each
point..Hence the
points and radius R, and only one query
for it...then it just can't be O(n)
2. if N points are fixed and there are like 1+ queries then you can
store it in some dataset and retrieve the result for that in O(logn)
On Fri, Jan 6, 2012 at 12:29 PM, amrit harry dabbcomput...@gmail.comwrote
@kay bigger number is 9918 not 9891...
On Mon, Dec 12, 2011 at 11:39 PM, Lucifer sourabhd2...@gmail.com wrote:
@above..
just to add to the above post... L(n) is basically reordering of the
elements of A[n] which would produce the largest possible integer when
read from L(0) to L(n).
On Dec
nyone pls xpalin the algo
On Sun, Nov 20, 2011 at 2:39 PM, kartik sachan kartik.sac...@gmail.comwrote:
yup using matrix method we can solve it in O(log(n)).
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
http://gplus.to/amolsharma99
http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99
On Sun, Nov 20, 2011 at 3:29 PM, amrit harry dabbcomput...@gmail.comwrote:
nyone pls xpalin the algo
On Sun, Nov 20, 2011 at 2:39 PM, kartik
i have a silly question to ask.
im gud in ALGO and gud in DATA STR. but i can solve a problem if i
know the algorithm or if earlier faced it.
i can't able to think my own logics and solve new mathematical
problems. even i dont know about how to come up with new TEST DATA. i
knw we can develop this
let this statement int x=100,y=5;printf(%*d,x,y);
in this line first x is assign to '*' and it become %100d
and it will padd 100 spaces before print. and if we use( %*d,x)
then x is assign to '*' and garbage value wud be printed.
On Fri, Oct 28, 2011 at 8:53 PM, annarao kataru
use a file...every time we run it... get number from file increment it print
it and again replace back to filedats it.
On Sat, Oct 15, 2011 at 3:56 PM, kumar raja rajkumar.cs...@gmail.comwrote:
you have to write a program which tell about how many times it has run.
ex:
if you run first
we have to find X^N let it would be N
YlogX=log(N)
antiLog(YlogX)=N
antilog for base 10 is power of 10
so 10^(YlogX)=N
and if we want to find 3^5
pow(10,5log3)--- pow(10,2.3856062735)=243
and if u want to find first 2 digits pow(10,(2.3856062735-1))=24.3=24
On Tue, Oct 4, 2011 at 1:46 AM, sunny
http://community.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor
chk it out..
On Wed, Sep 28, 2011 at 11:04 AM, sukran dhawan sukrandha...@gmail.comwrote:
it has already been discussed .. search in the archives
On Wed, Sep 28, 2011 at 10:57 AM, Ankuj Gupta ankuj2...@gmail.com
solve it.
--
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
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this
R U SUREI DONT THINK SOO...? HAD U CHKED IT...?
On Fri, Sep 23, 2011 at 7:58 PM, rahul sharma rahul23111...@gmail.comwrote:
two
On Fri, Sep 23, 2011 at 7:25 PM, amrit harry dabbcomput...@gmail.comwrote:
solve it.
--
You received this message because you are subscribed to the Google
@balaji +1 :)
On Thu, Sep 22, 2011 at 2:01 PM, Anil Arya anilarya...@gmail.com wrote:
thanx Balaji:)
On Thu, Sep 22, 2011 at 6:07 AM, Balaji balaji.subraman...@gmail.comwrote:
Hi Anil,
#a is a preprocessor operator to convert the argument specified as string
or enclosing in double
http://www.spoj.pl/problems/POUR1/
hw the 2nd given test is correct.
2
3
4
first we fill 3 littre jar with water and put into 4 littre jar den
again fill 3 littre and pour it in 2 littre remaining water in jar is
1 littre put it into 4 littre and we can measure 4 littre of water den
why answer is
@dave +1
On Sat, Sep 17, 2011 at 8:10 PM, Dave dave_and_da...@juno.com wrote:
@Amrit: You only have 2 and 3 litre jars. You are trying to get 4
litres into one of them. There is no 4 litre jar, nor any other vessel
into which you can capture the 4 litres.
Dave
On Sep 17, 6:15 am, amrit
dey would only look for OPPS concept with proper working knowledge and DB
concepts..
On Tue, Sep 13, 2011 at 8:15 PM, Brijesh brijeshupadhyay...@gmail.comwrote:
yes..please anyone post questions asked in thoughtworks interview
--
You received this message because you are subscribed to the
Euclid's GCD Algorithm:
http://www.cs.berkeley.edu/~vazirani/s99cs170/notes/lec3.pdf
On Sat, Sep 10, 2011 at 8:54 PM, Neha Singh neha.ndelhi.1...@gmail.comwrote:
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
level order and spiral traversing
On Sat, Sep 10, 2011 at 9:27 PM, sukran dhawan sukrandha...@gmail.comwrote:
level order traversal
On Sat, Sep 10, 2011 at 10:48 AM, ravi maggon maggonr...@gmail.comwrote:
give some traversal other then pre,in and post order to print all elements
of tree?
there is one more way called as.. Level order traversing or spiral
traversing google this term u will find a new method.
On Sat, Sep 10, 2011 at 11:08 AM, ravi maggon maggonr...@gmail.com wrote:
can u elaborate its algo
On Sat, Sep 10, 2011 at 10:58 AM, Shravan Kumar
hey guys fro where i can find open source project to workon??
On Mon, Sep 5, 2011 at 9:44 PM, sukran dhawan sukrandha...@gmail.comwrote:
for singletion class
On Mon, Sep 5, 2011 at 9:42 PM, Sanjay Rajpal srn...@gmail.com wrote:
I think when we have to create a singleton class, we can use
56 matches
Mail list logo