Please explain the output of following C code
#includestdio.hchar *str = char *str = %c%s%c; main(){ printf(str,
34, str, 34);};
int main()
{
printf(str, 34, str, 34);
return 0;
}
Output--
char *str = char *str = %c%s%c; main(){ printf(str, 34, str, 34);};
main(){ printf(str, 34, str,
As nothing is written about space complexity, I am assuming that we can
take extra space.
Take a temporary array of length n.
1. Maintain a counter for the length of temporary array filled till now.
2. Traverse the given array. If value contained is negative insert it in
new array and update
Let array contains 3 types of elements R,G,B.
Now, if we place all the R elements from the left and B elements from the
right then G elements will automatically be between the two.
Thus we only have to keep indexes for the R and B elements inserted till
now and update their positions accordingly
*const char* a* is *equivalent* to *char const * a*
A simple method which most people use in coding is that const is written
after the value which needs to be constant.
So,
*char const *a* means a is a pointer that points to a character which is a
constant i.e you can not change the value which a
The following is a simple C program which tries to multiply an integer by 5
using the bitwise operations. But it doesn't do so. Explain the reason for
the wrong behavior of the program.
#include stdio.h
#define PrintInt(expr) printf(%s : %d\n,#expr,(expr))
*int* FiveTimes(*int* a)
{
@Gene: Can you tell some other ways of graph representation in case of
sparse matrix as till now I consider adjacency list as the best method for
the same.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
then how static can be an extern?
Extern means that this variable can be used in other files also, whereas
static means this variable is initialized only once and its scope is static
with respect to its scope which can be either a function or file. So we
cant declare a variable static and extern
We can find the longest path in a graph by applying 2 bfs.
1st BFS is from our start node. The node which appear in last will be the
one farthest from the start node.Let this node be end1.
Now again apply bfs from end1 and the last node which appears will be the
another end.
Here I have made
Hi all, I was going through Binary Index Tree (BIT) tutorial through
topcoder , although the concept is clear to me, I want to do some more
practice questions. So it will be helpful if you provide me link of some
questions of BIT in spoj.
--
You received this message because you are subscribed
Can anyone explain why ((n%p)*(m%p))%p will give wrong answer ?
--
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
10 matches
Mail list logo