www.spoj.pl
www.topcoder.com/tc
www.codechef.com
Solve problems from these sites..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send
After preprocessing
Where ever there is 'A' in your program, it is replaced by 'B'
Where ever there is 'B' in your program, it is replaced by 'B'
this will be the program look like
#includestdio.h
int main(){
int B =4;
printf(%d,B);
return 0;
}
therefore, the program will compile and run :)
HI,
Here are some fact related to macros..
its a preprocessor directory so before comping the code will replaced by
appropriate macros... these are not comping or executing ..so macros
replaced one by one and other fact macro will not replaced the content of
other macros...
so code of 1st code
Thanks a lot umesh...but still i am in confusion that:
after first processing : A is replaced by B
after second proecessing B is replaced by A
then why again this A is not being replaced by #define A macro..
why it is not going in an infinite loop...because i think there is no fiexed
order of
Instead of blindly looking for answer, do gcc -E yourfilename.c. It
will produce o/p after preprocessing. See what's happening there?
On Sep 10, 3:55 pm, saurabh agrawal saurabh...@gmail.com wrote:
Thanks a lot umesh...but still i am in confusion that:
after first processing : A is replaced by
i think my concept is right
lets us take array a[1..n];={1,1,1,2,1,3};
n=6;
n/2+1=4;
so take another array aux[];
which is very helpful to findout hw much time each elemnt arrive in a
so its count teh no. of time..
fro i=0 to n
aux[a[i]]++;
so aux now contains aux[]={0,4,1,1,0,0};
and just
One problem in your algorithm is that the additional array has to be
large enough to handle all of the values in the array, so, e.g.,
multiply all of your values by a million and you will see that the
work goes up by a factor of a million.
It can be done without the additional array, and
Hi Bittu,
Your algorithm uses Linear extra space. which is proportional to the
input used.
There is a better algorithm which is linear in time and does alot
better .
int Majoritycount(int [] A) {
int ctr=1;
//counter is a variable to indicate the relative importance of the
element. as
first all the preprocessor statementa are executed where all A's are replace
by B
now the code looks like
#includestdio.h
int main(){
int B =4;
#define A B
#define B B
printf(%d,B);
return 0;
}
after words second preprocessor statement get executed and all B's by B get
replaced
#includestdio.h
Q Given an array, find out if there exists a pair of nos. that adds up
to a sum 'x'
in O(n) possible,,
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from
Hi,
O(n) solution is possible if the array is presorted!
Else i think it is NOT.
1.Have two ptrs (one from first and other to track the array from
last)
2.s=a[left]+a[right]
3.if(ssum) left++;
else if(ssum) right--;
else
print sum found
On Sep 10, 10:19 pm, bittu shashank7andr...@gmail.com
visit computerscienceppt.blogspot.com to download free PPT and PDF
files related to computer science..site updated daily!
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To
Excellent Compilation of Interview Questions
Visit
http://www.cracktheinterview.org/
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
aham aham
On Fri, Sep 10, 2010 at 12:56 PM, Shashank Krishna sasan...@gmail.comwrote:
Excellent Compilation of Interview Questions
Visit
http://www.cracktheinterview.org/
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
Really nice awesome
On Fri, Sep 10, 2010 at 1:06 PM, ashish agarwal
ashish.cooldude...@gmail.com wrote:
aham aham
On Fri, Sep 10, 2010 at 12:56 PM, Shashank Krishna sasan...@gmail.comwrote:
Excellent Compilation of Interview Questions
Visit
http://www.cracktheinterview.org/
--
15 matches
Mail list logo