simpleoutput is same as expected
9 8 7 6 5 4 3 2 1
9 8 7 6 5 4 3 2 1 00
On Fri, Jul 22, 2011 at 8:14 AM, naveen ms naveenms...@gmail.com wrote:
ya...it(the 2nd part) is going to infinite loop in dev c++...it is
printing 10 10 10.n going on..
--
You received this message because you
i can't point out the mistake in algo but i can suggest you a good algo for
the same
a[] is the sorted array of size n
b[] is the sorted array of size 2n in which n elements are absent.
now shift all the elements of b[] to the end leaving the first n positions
vacant(sorted order in b[] is still
see this
http://geeksforgeeks.org/?p=726
On Fri, Jul 22, 2011 at 4:29 AM, adhyetha ranjith.kaga...@gmail.com wrote:
reverse(int n)
{
int i, result = 0;
for(i = 0; i 32; i++)
result |= ((n i) 1) (31 - i);
}
assuming 32 bit integer to be reversed and assuming
I am looking for a code which can add without using + sign
i searched the net and found the following code..can anyone explain me
whats happening in this ??
#includestdio.h
#includeconio.h
int main()
{
int a=3000,b=20,sum;
char *p;
p=(char *)a;
sum= (int)p[b]; //adding a b
printf(Answer is
if someone has better idea...then please suggest that.
plz explain how this is calculating sum -- sum= (int)p[b];
On Wed, Jul 13, 2011 at 1:50 PM, nicks crazy.logic.k...@gmail.com wrote:
I am looking for a code which can add without using + sign
i searched the net and found
thnx piyush,anika for explanation
On Wed, Jul 13, 2011 at 1:58 PM, Anika Jain anika.jai...@gmail.com wrote:
a better idea is use this:
int a=9,b=4;
int sum=printf(%*s%*s,a,,b,);
printf(%d\n,sum);
On Wed, Jul 13, 2011 at 1:52 PM, nicks crazy.logic.k...@gmail.com wrote:
if someone has
agree with saurabh.merge sort will be the best.using sorting problem
can be solved in O(nlogn)
else use hashing to solve in O(n)
@shady.ya that would be most obvious solution can be done easily in
O(n^2).
On Wed, Jul 13, 2011 at 8:36 PM, shady sinv...@gmail.com wrote:
what are the
@shady...if modfying is not allowedin that case i think O(n^2) is the
only option left with us...sorting can't be used in that case...
On Wed, Jul 13, 2011 at 9:01 PM, shady sinv...@gmail.com wrote:
@nicks so many problems could be solved in O(n) but it is very difficult to
find a hashing
Hey Guys, plz help me in getting these 2 C output problems
*PROBLEM 1.*
*
*
*#*includestdio.h
int main()
{
short int a,b,c;
scanf(%d%d,a,b);
c=a+b;
printf(%d,c);
return 0;
}
INPUT-
1 1
OUTPUT
1
i am not getting why 1 is coming in the output.what difference is using
short making in the code
Hey Guys, plz help me in getting these 2 C output problems
*PROBLEM 1.*
*
*
*#*includestdio.h
int main()
{
short int a,b,c;
scanf(%d%d,a,b);
c=a+b;
printf(%d,c);
return 0;
}
INPUT-
1 1
OUTPUT
1
i am not getting why 1 is coming in the output.what difference is using
short making in the code
Hey Guys, plz help me in getting these 2 C output problems
*PROBLEM 1.*
*
*
*#*includestdio.h
int main()
{
short int a,b,c;
scanf(%d%d,a,b);
c=a+b;
printf(%d,c);
return 0;
}
INPUT-
1 1
OUTPUT
1
i am not getting why 1 is coming in the output.what difference is using
short making in the code
of tag will remain sizeof(int) irrespective of the number of constants
in it.correct me if i am wrong !!
On Tue, Jul 12, 2011 at 2:20 PM, Anand Saha anands...@gmail.com wrote:
On Tue, Jul 12, 2011 at 1:29 AM, nicks crazy.logic.k...@gmail.com wrote:
*PROBLEM 3.*
*
*
#includestdio.h
main
i thought of this code..i think it should work.correct me if i am
wrong
depth=0;max=0;
while(c=getchar()!=EOF)
{
if(c== '{' )
{
depth+=1
if(depthmax)
max=depth;
}
else if(c== '}' )
{
depth-=1;
}
}
On Tue, Jul 12,
my bad...that should be understood..
On Tue, Jul 12, 2011 at 5:45 PM, Vandana Bachani vandana@gmail.comwrote:
You have the right braces missing, it would result in a 0 depth for all
cases. (Precedence of != is greater than =)
On Tue, Jul 12, 2011 at 5:41 PM, nicks crazy.logic.k
suggest !!
On Tue, Jul 12, 2011 at 5:50 PM, nicks crazy.logic.k...@gmail.com wrote:
my bad...that should be understood..
On Tue, Jul 12, 2011 at 5:45 PM, Vandana Bachani vandana@gmail.comwrote:
You have the right braces missing, it would result in a 0 depth for all
cases. (Precedence
:
On Tue, Jul 12, 2011 at 2:36 PM, nicks crazy.logic.k...@gmail.comwrote:
and in problem 3 what i understood after reading with what you wrote is
that size of tag will remain sizeof(int) irrespective of the number of
constants in it.correct me if i am wrong !!
Right.
--
--
You
for a global
variable
On Tue, Jul 12, 2011 at 6:22 PM, nicks crazy.logic.k...@gmail.comwrote:
igonre the previous code, here is fully working code..previous one
doesn't include check for having { within quotes which should not be counted
for scope depth
#includestdio.h
int main
@saurabh.nice code very well writtencan u plz explain the use of
ungetc in your code
On Wed, Jul 13, 2011 at 7:10 AM, saurabh singh saurab...@gmail.com wrote:
Phew I think all cases covered to the best of my knowledge.
http://www.ideone.com/xHOQ9
http://www.ideone.com/xHOQ9Few that
@saurabh why are you reading the string character by character..why
don't just read it word by word ? . what's the problem in it ?
btw...nice soln...
On Wed, Jul 13, 2011 at 7:32 AM, Gene gene.ress...@gmail.com wrote:
You can recognize a word W, recur to print the rest of the
i can think of a O(n) solution for this problem..though i am using extra
space O(n)
take an extra array array b[] apart from given array a[]
where b[i] denotes the maximum product of continuous ending at i
b[0]=a[0]
traverse the given array a[] and update b[] according as -
if(b[i-1]==0)
Algorithm along with code is explained very well in KR refer page 108;)
On Wed, Jul 13, 2011 at 10:26 AM, rShetty rajeevr...@gmail.com wrote:
Given a very big file of words, a word in each line, sort the words .
Please provide the algorithm and explanation .
--
You received this message
@shilpa...i derived it from maximum subsequence problemnow finding it
totally incorrectthnx for pointing it out..
On Wed, Jul 13, 2011 at 10:32 AM, shilpa gupta shilpagupta...@gmail.comwrote:
@nicks..if i am getting ur algo right than
if input array is
0, -10, -12, 19, 20, -1, -2
@vaibhav.i don't think there is any rule like you mentioned.if it is
plz mention it's source
i think the explanation by aditya is correct it's just due to the precedence
order which is
=
?:
=
in descending order
hence first = is evaluated then ?: followed by =...due to which lvalue
Guys plz help me in understanding the following output
*PROBLEM 1.*
*
*
#includestdio.h
main()
{
int scanf=78;
//int printf=45;
int getchar=6;
printf(%d,scanf);
printf(\n%d,getchar);
}
*OUTPUT-*
78
6
in this problem my problem is using printf and scanf as variable
names.they are functions
will automatically be treated as 2.0 when scanf demands a
floating value. However, if you enter characters in place of numbers or vice
versa. You may experience weird behavior.
Regards,
Sandeep Jain
On Mon, Jul 11, 2011 at 9:37 AM, nicks crazy.logic.k...@gmail.com wrote:
@sandeep,kamakshiithanks
Someone please help me in understanding the following output -
Problem *1.*
#includestdio.h
#ifdef getchar //this expression is evaluated to zero.why is so
happening ??getchar is defined as macro in stdio.h.i mean else
part shouldn't be executed which is happening
#undef
if it is defined in header file.
On Mon, Jul 11, 2011 at 12:38 AM, nicks crazy.logic.k...@gmail.comwrote:
Someone please help me in understanding the following output -
Problem *1.*
#includestdio.h
#ifdef getchar //this expression is evaluated to zero.why is
so happening
that's grt...i didn't knew it !!
On Sat, Jun 25, 2011 at 4:43 AM, Anantha Krishnan
ananthakrishnan@gmail.com wrote:
Good.
On Sat, Jun 25, 2011 at 4:47 PM, RITESH SRIVASTAV
riteshkumar...@gmail.com wrote:
sizeof returns size_t values and size_t is typedef unsigned int
size_t;
but
what's the problem...when t=6 the break statement gets executed and the
control comes out of the for loop..
hence prints 6..
On Mon, Jun 20, 2011 at 12:05 AM, Oppilas jatka.oppimi...@gmail.com wrote:
Sanjay,
Whenever we encounter a break statement does not it means to take the
program
Simple... :)
answer is *8*
logic--
7*7=49
4*9=36
3*6=18
1*8=8
On Mon, Jun 20, 2011 at 1:48 AM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Find Next Number *
*
*
*What is the next number?*
*77, 49, 36, 18 ?*
*
*
*Update Your Answers at : Click
Is it Possible to Sort the stl map on the basis of values though they are
sorted internally on the basis of index ???
--
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
I LIKE YOU LIKE YOU ARE
On Tue, Jun 14, 2011 at 12:09 AM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Sign Puzzle - 14 june
*
*
*
*As the school year was progressing, a teacher was distressed that more
and more of her students were beginning to tease and make fun of one
another. She
What about precedence order then.
http://www.difranco.net/cop2220/op-prec.htm i mean acc. to precedence order
should be evaluated before || in the second exampleresult should be
k=1,j=3 and i= -2
On Mon, Jun 13, 2011 at 11:41 AM, udit sharma sharmaudit...@gmail.comwrote:
hmm. Sry yr...
anybody having idea about preference order ??
On Tue, Jun 14, 2011 at 4:20 AM, nicks crazy.logic.k...@gmail.com wrote:
What about precedence order then.
http://www.difranco.net/cop2220/op-prec.htm i mean acc. to precedence
order should be evaluated before || in the second example
hmm...someone explain...me too confused :(
On Tue, Jun 14, 2011 at 9:14 AM, rahul dixit dixit.rahu...@gmail.comwrote:
bt increment operator has the higher precedence than || and
so all the variables should be incremented first then and then ||
should be evaluated
then how it is
and here is my code I'm Getting TLE i tried to implement binary search
but failed bcoz how will i be able to trace the value from one vector into
another vector if there are any multiple occureneces of any value(i mean i
have count them).in this code i i have used count of algorithm which
arrays, u need to sort one array.. this will be teh vector
in which u do the binary search wit every element of un sorted array..
this is the approach i used... :) hope this helps...
the above functions defined in algorithm
On Sun, Jun 12, 2011 at 12:34 PM, nicks crazy.logic.k
(),a2.end(),value);
}
printf(%d,ans);
return 0;
}
On Sun, Jun 12, 2011 at 1:07 AM, nicks crazy.logic.k...@gmail.com wrote:
@keyan..your advice was really very helpful...the time limit has come under
control ...1.4s but now i am getting WA though my code is giving right ans
@keyan...that solves my problem...got AC...thanks :)
On Sun, Jun 12, 2011 at 1:15 AM, nicks crazy.logic.k...@gmail.com wrote:
forgot to attach the code...here is the modified code..
#includevector
#includeiostream
#includealgorithm
#includecstdio
#includecmath
using namespace std;
int
:28 PM, Vishal Thanki
vishaltha...@gmail.comwrote:
In 1st program, 2nd printf requires one more argument. And basically
%a is used for printing a double value in hex. see man 3 printf.
On Sat, Jun 11, 2011 at 5:29 PM, nicks crazy.logic.k...@gmail.com
wrote:
Hello friends..plz help me
@umesh...thanks :) this explanation seems to be satisfactory but failed to
understand from where @anika and @himanshu were getting 7 6 8i ran
it...output comes out to be 7 6 6 !!
On Sun, Jun 12, 2011 at 6:15 AM, UMESH KUMAR kumar.umesh...@gmail.comwrote:
void call(int a,int b,int c)
{
no it's
a=1 b=1
i=2
i ran it on gcc (linux ubuntu 11.04)
On Sun, Jun 12, 2011 at 6:26 AM, sanjay ahuja sanjayahuja.i...@gmail.comwrote:
with GCC the above code gives a = 1 and b = 2
On Sun, Jun 12, 2011 at 6:39 PM, nicks crazy.logic.k...@gmail.com wrote:
@himanshuwhat abt
but program by anika is giving *7 6 8* on gcc.but *7 6 6 *on
dev-cpp...i am wondering if the output is compiler dependent !!
On Sun, Jun 12, 2011 at 6:33 AM, nicks crazy.logic.k...@gmail.com wrote:
no it's
a=1 b=1
i=2
i ran it on gcc (linux ubuntu 11.04)
On Sun, Jun 12, 2011
Hello friends..plz help me in understanding the following C Output
first one is --
#includestdio.h
#includeconio.h
main()
{
int a=5;
printf(a=%d\n,a);
printf(%a=%d,a);
getch();
}
*OUTPUT - *
a=5
0x1.2ff380p-1021=4199082
and the other one is --
#includestdio.H
# include conio.h
int i=2;
main()
Hers's another one line solution for swapping two variables a and b
a=b+a-(b=a)
On Sat, Jun 11, 2011 at 2:55 PM, Andreas Hahn www.gal...@googlemail.comwrote:
Well, on pod, this is an alternative to swapping two variables with a
third temporary, but be careful with objects!
It won't work on
@ankur..how did you get that...explain..plz
On Fri, Jun 10, 2011 at 3:11 AM, ankur aggarwal aggarwal11...@gmail.comwrote:
42, 49
2011/6/10 • » νιρυℓ « • vipulmehta.1...@gmail.com
42, 47
just guessing according to the pattern.
On Fri, Jun 10, 2011 at 1:37 PM, Lavesh Rawat
i agree with the logici also implemented it...and getting TLE...there
must exist some better method :(
On Fri, Jun 10, 2011 at 2:18 AM, kartik sachan kartik.sac...@gmail.comwrote:
what i understand from the problem was that.
n no of higests are given
and a and b and city no
this problem was discussed some time before on this group
i am picking up a solution discussed there which you would love to see
int i=1;
#define PRINT1 couti++endl;
#define PRINT2 PRINT1 PRINT1
#define PRINT4 PRINT2 PRINT2
#define PRINT8 PRINT4 PRINT4
#define PRINT16 PRINT8 PRINT8
#define
Simple Problem :(
On Thu, Jun 9, 2011 at 1:28 AM, snehi jain snehijai...@gmail.com wrote:
7 4 6 5 8
On Thu, Jun 9, 2011 at 1:48 PM, Naveen Kumar
naveenkumarve...@gmail.comwrote:
7 4 6 5 8
On Thu, Jun 9, 2011 at 1:36 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Secret Code puzzle
gr8 man.awesome :)
On Thu, Jun 9, 2011 at 6:00 AM, sunny agrawal sunny816.i...@gmail.comwrote:
seems like got it..
there is 150 days difference between 20/6(20 june) and 18/11(18 November)
On Thu, Jun 9, 2011 at 6:14 PM, sunny agrawal sunny816.i...@gmail.comwrote:
ha ha .
i
what does the highest chance of survival ? mean.. is it about black's
survival or overall survival.i'm confused
On Wed, Jun 8, 2011 at 1:33 AM, DeVaNsH gUpTa devanshgupta...@gmail.comwrote:
In the air without aiming any of the two.
On 6/8/11, Lavesh Rawat lavesh.ra...@gmail.com
yup.84 years :)
On Tue, Jun 7, 2011 at 1:17 AM, Naveen Kumar naveenkumarve...@gmail.comwrote:
84 years
On Tue, Jun 7, 2011 at 1:33 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:
*Salman age puzzle
*
*
*
**
*salman's youth lasted one sixth of his life. He grew a beard after one
haha...like it !!
On Tue, Jun 7, 2011 at 8:04 AM, anshu anshumishra6...@gmail.com wrote:
For those people who want to get rid of sohail panzer spam
create a filter
From : sohail.panz...@gmail.com
mark on Delete it
--
You received this message because you are subscribed to the Google
Check this is working fine..
int g()
{
return 1;
}
int f(){
g();
return g()+1;
}
int main()
{
g();
f();
}
On Tue, Jun 7, 2011 at 12:29 PM, sourabh jakhar sourabhjak...@gmail.comwrote:
int main()
{
g();
f();
}
inline int f(){
g();
return g()+1;
}
inline int g()
{
return 1;
}
@parmendra..yeah u r right what's ur problem u r not able to implement it r
whatonly winner will win 4 matches runner and 3rd posn will win 3 match
each...
On Mon, Jun 6, 2011 at 12:47 AM, arun kumar kumar0...@gmail.com wrote:
any team which has nt lost a match will win
On Mon, Jun 6,
nice One !!
On Mon, Jun 6, 2011 at 1:02 PM, coder dumca coder.du...@gmail.com wrote:
thanks arpit :)
On Tue, Jun 7, 2011 at 12:43 AM, Arpit Sood soodfi...@gmail.com wrote:
(3 5) (5 7) (11 13) (17 19)
so in short if you do a +1, -1 to these pairs you will get one number
4, 6, 12,
hmm.saw itthanks :) very tricky !!
On Sat, Jun 4, 2011 at 10:55 PM, T3rminal piyush@gmail.com wrote:
@nicks
KR says
A warning: printf uses its first argument to decide how many
arguments follow and what their type are. It will get confused and you
will get wrong answer
i wasn't able to think of other method but why are you using cout(void
*)p; for dereferencing.
cout*x is working to find to the value at memory ocation x.
On Sat, Jun 4, 2011 at 3:09 AM, Navneet Gupta navneetn...@gmail.com wrote:
Can't think of any trivial/straight forward way of
read how the floating numbers are stored in memory it will help
i understood the most except this ---
float p=4.5;
printf(\n%f,%d,p,p);
*output -
*4.50,0
and if we use
printf(\n%d,%f,p,p);
*output -
*0,0.0
i want to know why just changing the order of %d and %f is
i agree this type of expressions are not defined and are depend on the
machine..
it's something like a[i]=i++;
the result may vary from machine to machine !
On Sat, Jun 4, 2011 at 5:00 PM, Rohit Sindhu rohit.sindhu.spec...@gmail.com
wrote:
1. If the operand values is to be stored in
that's what i said changing the order of %f and %d is changing the output in
the 3rd printf.if you put %f before the %d then it gives you the
expected output.
On Sat, Jun 4, 2011 at 9:10 PM, himanshi narang himanshinarang...@gmail.com
wrote:
actualy i want to knw dat if i m using
@vishal
plz help me in understanding fork function...how it is working.??
On Fri, Jun 3, 2011 at 9:58 AM, nitish goyal nitishgoy...@gmail.com wrote:
Hi all,
I am stuck with this code..Can anyone tell me how to implement semaphores
in fork system call
Code:
#includestdio.h
int signal(int
i mean why both the if else statements are working by using fork ?
On Fri, Jun 3, 2011 at 10:20 AM, Naveen Kumar naveenkumarve...@gmail.comwrote:
Process don't share address space when forked.
On Fri, Jun 3, 2011 at 10:40 PM, nitish goyal nitishgoy...@gmail.comwrote:
@ Lalit
You are
this program
in their own address space.
In Modern OSes 99% of the time child comes first so child process is
execute else part and parent will execute if place.
On Fri, Jun 3, 2011 at 10:58 PM, nicks crazy.logic.k...@gmail.com wrote:
i mean why both the if else statements are working
regarding doenloads folder..tiger tree hash(TTH) as we use it in
file sharing (DC++) might help
look this - http://www.dslreports.com/faq/9677
Once DC++ hashes all of your share (yes, this *will* take a while), it will
only hash new files. The hashing thread in DC++ is set to low
65 matches
Mail list logo