Re: [algogeeks] Problem

2012-11-02 Thread prankur gupta
@arun :
Hi,
but how come are you using this particular structure then.
And i'm not sure about that approach, i think there can be some boundary
cases where it can fail.

On Thu, Nov 1, 2012 at 8:27 AM, Arun Kindra wrote:

> @prankur
> can we do in this manner, first find the middle of the array and make it
> as a root, and call recursively from 0 to mid-1 for left subtree and mid+1
> to len-1 for right subtree..?
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
PRANKUR GUPTA

Masters Student (CSE)
State University of New York
Stony Brook University
prgu...@cs.stonybrook.edu

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem

2012-11-01 Thread Arun Kindra
@prankur
can we do in this manner, first find the middle of the array and make it as
a root, and call recursively from 0 to mid-1 for left subtree and mid+1 to
len-1 for right subtree..?

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem

2012-10-31 Thread prankur gupta
Hi,

You can view this problem as
parentValue -> actual value of parent
childValue  -> number of childs associated with it(which can be zero or 1)

so, (8,2) (4,1) (10,2) (2,0) (9,0) (12,0) is the BST.

Thanks.

On Wed, Oct 31, 2012 at 10:01 AM, Arun Kindra
wrote:

> Ques - *
>
> struct node
> {
> int parentValue;
> int childValue;
> }str[10];
>
> how to construct a BT,given an array of structure containing parent and
> child value.
> *
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
PRANKUR GUPTA

Masters Student (CSE)
State University of New York
Stony Brook University
prgu...@cs.stonybrook.edu

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-30 Thread Navin Kumar
Hey answer will be 18 as follows. First ++a(5)+ ++a(6) + a++(6)=17 + one
post increment= 18.

On Thu, May 31, 2012 at 3:13 AM, Prateek Jain wrote:

> okk
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-30 Thread Prateek Jain
okk

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-30 Thread vIGNESH v
 Hai i tried the same in TC compiler. i got the output as 17. I guess the
output should be 17 as explained by Prateek Jain

On 30 May 2012 02:26, rahul ranjan  wrote:

> it first calculates from right to left and then performs addition
> so after a++ its still 4(with a promise to increment in next
> statement). then ++a makes it 5. then further ++a makes it 6
> now the addition phase comes into play value of a is 6 now so total
> 18 if it wud hav been a++ + a++ + a++ sum wud hav been 12
> and for next statement 'a' wud hav been 7
>
>
> On Wed, May 30, 2012 at 1:32 AM, Hassan Monfared wrote:
>
>> I implemented ++ for a simple class and got 17.
>> class A
>> {
>> public :
>> int val;
>> A(int v):val(v){}
>>  int operator++()
>> {
>> cout <<"empty arg called\n";
>>  return ++val;
>> }
>> int operator++(int x)
>>  {
>> cout <> return val++;
>>  }
>> };
>> --
>> A b(4);
>> cout <<++a + ++a +a++<> 
>> 17
>> but  story is different for your sample.
>> let me tell the fact with a simpler  problem :
>> int b=4;
>> cout << ++b + ++b ;
>> will print 12 instead of 11!
>> amazing huh ?
>> what happens from right to left is :
>> in the right statement  : b becomes 5:
>> in the left statement : b becomes 6 ( now be is 6 in both sides !)
>> so right_b + left_b = 6+6 = 12
>>
>> Regards
>>
>>
>> On Tue, May 29, 2012 at 11:43 PM, Prateek Jain > > wrote:
>>
>>> how is it 6?
>>> ++a(5) + ++a(6) + a++(6) it shud be 17
>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-29 Thread Prateek Jain
yups...it is compiler dependent...but a logic is necessary to get 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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-29 Thread atul anand
@all : no need to argue on this ...output is compiler dependent ... it
violates sequence point rule :) :).

On Wed, May 30, 2012 at 2:26 AM, rahul ranjan wrote:

> it first calculates from right to left and then performs addition
> so after a++ its still 4(with a promise to increment in next
> statement). then ++a makes it 5. then further ++a makes it 6
> now the addition phase comes into play value of a is 6 now so total
> 18 if it wud hav been a++ + a++ + a++ sum wud hav been 12
> and for next statement 'a' wud hav been 7
>
>
> On Wed, May 30, 2012 at 1:32 AM, Hassan Monfared wrote:
>
>> I implemented ++ for a simple class and got 17.
>> class A
>> {
>> public :
>> int val;
>> A(int v):val(v){}
>>  int operator++()
>> {
>> cout <<"empty arg called\n";
>>  return ++val;
>> }
>> int operator++(int x)
>>  {
>> cout <> return val++;
>>  }
>> };
>> --
>> A b(4);
>> cout <<++a + ++a +a++<> 
>> 17
>> but  story is different for your sample.
>> let me tell the fact with a simpler  problem :
>> int b=4;
>> cout << ++b + ++b ;
>> will print 12 instead of 11!
>> amazing huh ?
>> what happens from right to left is :
>> in the right statement  : b becomes 5:
>> in the left statement : b becomes 6 ( now be is 6 in both sides !)
>> so right_b + left_b = 6+6 = 12
>>
>> Regards
>>
>>
>> On Tue, May 29, 2012 at 11:43 PM, Prateek Jain > > wrote:
>>
>>> how is it 6?
>>> ++a(5) + ++a(6) + a++(6) it shud be 17
>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-29 Thread rahul ranjan
it first calculates from right to left and then performs addition
so after a++ its still 4(with a promise to increment in next
statement). then ++a makes it 5. then further ++a makes it 6
now the addition phase comes into play value of a is 6 now so total
18 if it wud hav been a++ + a++ + a++ sum wud hav been 12
and for next statement 'a' wud hav been 7

On Wed, May 30, 2012 at 1:32 AM, Hassan Monfared wrote:

> I implemented ++ for a simple class and got 17.
> class A
> {
> public :
> int val;
> A(int v):val(v){}
>  int operator++()
> {
> cout <<"empty arg called\n";
>  return ++val;
> }
> int operator++(int x)
>  {
> cout < return val++;
>  }
> };
> --
> A b(4);
> cout <<++a + ++a +a++< 
> 17
> but  story is different for your sample.
> let me tell the fact with a simpler  problem :
> int b=4;
> cout << ++b + ++b ;
> will print 12 instead of 11!
> amazing huh ?
> what happens from right to left is :
> in the right statement  : b becomes 5:
> in the left statement : b becomes 6 ( now be is 6 in both sides !)
> so right_b + left_b = 6+6 = 12
>
> Regards
>
>
> On Tue, May 29, 2012 at 11:43 PM, Prateek Jain 
> wrote:
>
>> how is it 6?
>> ++a(5) + ++a(6) + a++(6) it shud be 17
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-29 Thread Hassan Monfared
I implemented ++ for a simple class and got 17.
class A
{
public :
int val;
A(int v):val(v){}
int operator++()
{
cout <<"empty arg called\n";
return ++val;
}
int operator++(int x)
{
cout  how is it 6?
> ++a(5) + ++a(6) + a++(6) it shud be 17
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-29 Thread Prateek Jain
how is it 6?
++a(5) + ++a(6) + a++(6) it shud be 17

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with increment operator

2012-05-29 Thread MeHdi KaZemI
At first the value of a is calculated for the statement, that is 6, and
then statement is evaluated with a=6
so it is 6 + 6 + 6 = 18
and as you know after that the value of a becomes 7 for the rest of the
program.

On Mon, May 28, 2012 at 10:02 AM, ashish pant  wrote:

> #include
> int main()
> {
>   int a=4;
>   printf("%d\n",++a + ++a + a++);
>   return 0;
> }
>
> according to me output should be 17, but it is coming out to be 18.
> plz explain 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
   MeHdi KaZemI

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem of fork()

2012-05-24 Thread sumit mahamuni
its not about compilers ... its that new kernels kills all the child
processes, if parent gets killed before.. so that is the reason you
are gettin diff reasons

On 5/24/12, himanshu kansal  wrote:
> i know that the program sholud have printed "hello word" 8 timesbt whn
> i run it, i get diffrnt reslts everytime and on diffrnt compilers...
> please tell the reason
>
> On Thu, May 24, 2012 at 11:11 AM, rajesh singarapu
> wrote:
>
>> main process have completed till the time all processes processes
>> prints Hello World,
>>
>> to prevent it, use wait/wait4 family of fucntions.
>>
>> ~r
>>
>> On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar 
>> wrote:
>> > #include
>> > main()
>> > {
>> > fork();
>> > fork();
>> > fork();
>> > printf("Hello Word\n");
>> > }
>> >
>> > output ---
>> > rajeshkumar@rajeshkumar-laptop:~$ ./a.out
>> > Hello Word
>> > Hello Word
>> > Hello Word
>> > rajeshkumar@rajeshkumarr-laptop:~$ Hello Word
>> > Hello Word
>> > Hello Word
>> > Hello Word
>> > Hello Word
>> >
>> >
>> > Why it is not printed continously?
>> >
>> >
>> > --
>> > 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 group at
>> > http://groups.google.com/group/algogeeks?hl=en.
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
>
>Regards
>  Himanshu Kansal
>Msc Comp. sc.
> (University of Delhi)
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Thanks and Regards,
Sumit Mahamuni.

-- So once you do know what the question actually is, you'll know what the
answer means.
-- Perhaps the most important principal for good algorithm designer is to
refuse to be content. - Aho, Hopcroft and Ullman.
-- I love deadlines. I like the whooshing sound they make as they fly by. -
D. Adams

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem of fork()

2012-05-24 Thread Srikrishan Malik(gmail)
because the process which is executed from prompt has exited and the
children are still alive and printing.


On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar wrote:

> #include
> main()
> {
> fork();
> fork();
> fork();
> printf("Hello Word\n");
> }
>
> output ---
> rajeshkumar@rajeshkumar-laptop:~$ ./a.out
> Hello Word
> Hello Word
> Hello Word
> rajeshkumar@rajeshkumarr-laptop:~$ Hello Word
> Hello Word
> Hello Word
> Hello Word
> Hello Word
>
>
> Why it is not printed continously?
>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
SK Malik

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem of fork()

2012-05-24 Thread sumit mahamuni
arey Dude before child process gets killed, your parent gets killed and it
returns to shell

On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar wrote:

> #include
> main()
> {
> fork();
> fork();
> fork();
> printf("Hello Word\n");
> }
>
> output ---
> rajeshkumar@rajeshkumar-laptop:~$ ./a.out
> Hello Word
> Hello Word
> Hello Word
> rajeshkumar@rajeshkumarr-laptop:~$ Hello Word
> Hello Word
> Hello Word
> Hello Word
> Hello Word
>
>
> Why it is not printed continously?
>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thanks and Regards,
Sumit Mahamuni.

-- So once you do know what the question actually is, you'll know what the
answer means.
-- Perhaps the most important principal for good algorithm designer is to
refuse to be content. - Aho, Hopcroft and Ullman.
-- I love deadlines. I like the whooshing sound they make as they fly by. -
D. Adams

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem of fork()

2012-05-23 Thread himanshu kansal
i know that the program sholud have printed "hello word" 8 timesbt whn
i run it, i get diffrnt reslts everytime and on diffrnt compilers...
please tell the reason

On Thu, May 24, 2012 at 11:11 AM, rajesh singarapu wrote:

> main process have completed till the time all processes processes
> prints Hello World,
>
> to prevent it, use wait/wait4 family of fucntions.
>
> ~r
>
> On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar 
> wrote:
> > #include
> > main()
> > {
> > fork();
> > fork();
> > fork();
> > printf("Hello Word\n");
> > }
> >
> > output ---
> > rajeshkumar@rajeshkumar-laptop:~$ ./a.out
> > Hello Word
> > Hello Word
> > Hello Word
> > rajeshkumar@rajeshkumarr-laptop:~$ Hello Word
> > Hello Word
> > Hello Word
> > Hello Word
> > Hello Word
> >
> >
> > Why it is not printed continously?
> >
> >
> > --
> > 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 group at
> > http://groups.google.com/group/algogeeks?hl=en.
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 

   Regards
 Himanshu Kansal
   Msc Comp. sc.
(University of Delhi)

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem of fork()

2012-05-23 Thread rajesh singarapu
main process have completed till the time all processes processes
prints Hello World,

to prevent it, use wait/wait4 family of fucntions.

~r

On Thu, May 24, 2012 at 8:26 AM, Rajesh Kumar  wrote:
> #include
> main()
> {
> fork();
> fork();
> fork();
> printf("Hello Word\n");
> }
>
> output ---
> rajeshkumar@rajeshkumar-laptop:~$ ./a.out
> Hello Word
> Hello Word
> Hello Word
> rajeshkumar@rajeshkumarr-laptop:~$ Hello Word
> Hello Word
> Hello Word
> Hello Word
> Hello Word
>
>
> Why it is not printed continously?
>
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem

2011-11-18 Thread MeHdi KaZemI
If I'm right you want a subset which has k elements and the difference of
the smallest and the largest element is minimum.

You can do it in O( Nlog(N) ).
*Sort input* in ascending order, then iterate through the array and keep
the difference of the last k elements.
O( nlogn + n ) belongs to O(nlogn)

2 3 5 6 9 11
two iterators, first on 2, second on 5,
then each time ++ both iterators and check the difference of these two
elements, pick the minimum among all these values.

On Fri, Nov 18, 2011 at 5:00 PM, Zyro  wrote:

> Q: Select the K elements in an array of size N which are having the
> minimum difference among them?
> For Example : If you have an array like arr[]={9,5,2,6,3,11} and value
> of K is 3. Then ans would be {2,3,5}.
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
   MeHdi KaZemI

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem

2011-10-31 Thread SAMM
This is like the TOPOLOGY SORT .

Repeat the steps until all the elements of orginal set is visited:-
Do
First need to add all those elements in a set whose inorder is Zero .
 Then create another set whose inorder is 1 , after making set 1 ,
then decrease the inorder by 1 for those elements who was connected to
the elements formed in set 1.
Done

On 10/31/11, teja bala  wrote:
> +1 abhishek
>
> On Mon, Oct 31, 2011 at 6:26 PM, abhishek kumar  wrote:
>
>> Represent the dependencies as a graph. Store all the values in a list. For
>> each vertex in the graph find all values for which there is no edge from
>> the vertex. If these values are there in the list, remove them from the
>> list and create a set of the vertex and the removed values.
>> If the values are not there in the list then create a set with the vertex
>> only. Do this for all the vertices.
>>
>>
>> On Mon, Oct 31, 2011 at 5:51 PM, Bharath 2009503507 CSE <
>> bharathgo...@gmail.com> wrote:
>>
>>> Given a set of values..in which there are some dependencies..
>>>
>>> Eg..  x y z a b
>>>
>>> Dependencies: x,y
>>> a,z
>>>
>>> Note that dependency is not transitive..Is it possible to separate
>>> these elements into sets such that no two elements in the same set are
>>> dependant and we should end up with the least number of sets..
>>>
>>> I could not find a good solution for this..Please help me..
>>>
>>> Regards,
>>>
>>> Bharathwajan
>>>
>>> --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Somnath Singh

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem

2011-10-31 Thread teja bala
+1 abhishek

On Mon, Oct 31, 2011 at 6:26 PM, abhishek kumar  wrote:

> Represent the dependencies as a graph. Store all the values in a list. For
> each vertex in the graph find all values for which there is no edge from
> the vertex. If these values are there in the list, remove them from the
> list and create a set of the vertex and the removed values.
> If the values are not there in the list then create a set with the vertex
> only. Do this for all the vertices.
>
>
> On Mon, Oct 31, 2011 at 5:51 PM, Bharath 2009503507 CSE <
> bharathgo...@gmail.com> wrote:
>
>> Given a set of values..in which there are some dependencies..
>>
>> Eg..  x y z a b
>>
>> Dependencies: x,y
>> a,z
>>
>> Note that dependency is not transitive..Is it possible to separate
>> these elements into sets such that no two elements in the same set are
>> dependant and we should end up with the least number of sets..
>>
>> I could not find a good solution for this..Please help me..
>>
>> Regards,
>>
>> Bharathwajan
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem

2011-10-31 Thread abhishek kumar
Represent the dependencies as a graph. Store all the values in a list. For
each vertex in the graph find all values for which there is no edge from
the vertex. If these values are there in the list, remove them from the
list and create a set of the vertex and the removed values.
If the values are not there in the list then create a set with the vertex
only. Do this for all the vertices.

On Mon, Oct 31, 2011 at 5:51 PM, Bharath 2009503507 CSE <
bharathgo...@gmail.com> wrote:

> Given a set of values..in which there are some dependencies..
>
> Eg..  x y z a b
>
> Dependencies: x,y
> a,z
>
> Note that dependency is not transitive..Is it possible to separate
> these elements into sets such that no two elements in the same set are
> dependant and we should end up with the least number of sets..
>
> I could not find a good solution for this..Please help me..
>
> Regards,
>
> Bharathwajan
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem on overflow

2011-08-27 Thread Avinash LetsUncomplicate..
@dave i was saying if user enter a+b in which a>intmax .. A goes
negative(if a sligtly >intmax)  a+b =no overflow which we know
shouldnt be an answer..

On 8/28/11, Dave  wrote:
> @Kunal: You are very kind.
>
> Dave
>
> On Aug 27, 12:58 pm, Kunal Patil  wrote:
>> @Dave: Still your approach to solve the problem remains correct.
>> (subtracting a number from max possible value & then comparing this
>> difference with another number). So, no need to think that you were brain
>> dead (If you were, you would have posted a movie story here)..[?]
>> Mathematically it is wrong, not in terms of approach..[?]
>>
>> On Sat, Aug 27, 2011 at 11:02 PM, dipit grover
>> wrote:
>>
>>
>>
>> > I think you just need to reverse the comparison operators in Dave's
>> > earlier
>> > post
>>
>> > On Sat, Aug 27, 2011 at 10:59 PM, Dave  wrote:
>>
>> >> @Abishek: I was brain-dead in my earlier posting. Let me try again:
>>
>> >> If either number is zero, the sum will not overflow.
>> >> If the numbers have different signs, the sum will not overflow.
>> >> If both numbers are positive, overflow will occur if b > maxint - a.
>> >> If both numbers are negative, overflow will occur if b < -maxint - a -
>> >> 1.
>>
>> >> Dave
>>
>> >> On Aug 27, 12:18 pm, Abhishek  wrote:
>> >> > @Dave: i didn't understand,
>> >> > suppose a=3, b=31000 and MaxInt=32000;
>> >> > you are saying if (MaxInt-a)>=b; then overflow will occur. but here
>> >> > condition is not satisfying.
>> >> > plz explain.
>>
>> >> --
>> >> 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 group at
>> >>http://groups.google.com/group/algogeeks?hl=en.
>>
>> > --
>> > Dipit Grover
>> > B.Tech in CSE
>> > IIT Roorkee
>>
>> >  --
>> > 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 group at
>> >http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>>
>>  361.gif
>> < 1KViewDownload
>>
>>  360.gif
>> < 1KViewDownload- Hide quoted text -
>>
>> - Show quoted text -
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
Sent from my mobile device

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding output??

2011-08-10 Thread Arun Vishwanathan
@ankit: does that mean that after the compiler is informed that the void
pointer will point to integer witht he typecast statement and then we point
it to some other type , it will be an error?
i mean after that typecast statement, if i do
char a;
k=&a;is it wrng?

On Tue, Aug 9, 2011 at 2:06 PM, ankit sambyal wrote:

> The typecasting tells the compiler that the void pointer is now pointing to
> an integer and when we use this pointer to access the integer it takes value
> from 4 bytes. But when we try to increment that pointer, it will point to
> the next byte.  Try taking k as pointer to double instead of void, u will c
> the same result.
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
 "People often say that motivation doesn't last. Well, neither does bathing
- that's why we recommend it daily."

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding output??

2011-08-09 Thread Raman
I read somewhere that arithmetic operations can't be performed to void 
pointers?? How does v++ does'nt giv error??

-- 
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/-/Q-uYKYySUdYJ.
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding output??

2011-08-09 Thread Rohit Srivastava
typecast only temporarily changes the pointer type of LHS but cannot change
that of RHS or even LHS permanently

On Tue, Aug 9, 2011 at 5:36 PM, ankit sambyal wrote:

> The typecasting tells the compiler that the void pointer is now pointing to
> an integer and when we use this pointer to access the integer it takes value
> from 4 bytes. But when we try to increment that pointer, it will point to
> the next byte.  Try taking k as pointer to double instead of void, u will c
> the same result.
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding output??

2011-08-09 Thread ankit sambyal
The typecasting tells the compiler that the void pointer is now pointing to
an integer and when we use this pointer to access the integer it takes value
from 4 bytes. But when we try to increment that pointer, it will point to
the next byte.  Try taking k as pointer to double instead of void, u will c
the same result.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding output??

2011-08-09 Thread sagar pareek
Yeah same
but ankit k is typecasted to int*  then y?

On Tue, Aug 9, 2011 at 5:27 PM, ankit sambyal wrote:

> its because void pointer is incremented by 1, when we do k++
> whereas integer pointer is incremented by 4, when we do j++
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding output??

2011-08-09 Thread Rajesh Kumar
thanx Ankit

On Tue, Aug 9, 2011 at 5:27 PM, ankit sambyal wrote:

> its because void pointer is incremented by 1, when we do k++
> whereas integer pointer is incremented by 4, when we do j++
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Rajesh Kumar

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding output??

2011-08-09 Thread ankit sambyal
its because void pointer is incremented by 1, when we do k++
whereas integer pointer is incremented by 4, when we do j++

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with array

2011-08-03 Thread Arshad Alam
@Subramanian--  great man, thanx alot. actually what I does is I had define
array3 inside the main function instead of globally, you had told me to
define array3 globally but by mistake I defined it inside the main function
which was my fault... thanx alot brother.

On Wed, Aug 3, 2011 at 1:36 PM, Thavasi Subramanian wrote:

>
> @Alam, Try this revised code
>
> #include
> #include
> int array3[10];
> main()
> {
> clrscr();
> int *take,i;
> int array1[10]={1,2,3,4,5,6,7,8,9,10};
> int* modify(int*);
> take=modify(array1);
> for(i=0;i<10;i++)
> printf("%d ",*(take+i));
> getch();
> }
>
>
> int* modify(int* array2)
> {
> int i;
> for(i=0;i<10;i++)
> {
> array3[i]=3*array2[i];
>//printf(" %d",array3[i]);
> }
> return array3;
> }
>
>
> On 3 August 2011 13:31, Thavasi Subramanian  wrote:
>
>> @Alam: Can u mail tat revised code
>>
>>
>> On 3 August 2011 11:54, Arshad Alam  wrote:
>>
>>>
>>> @Subramanian, I made the changes what you have told, it is running
>>> fine,not giving any warning or error but output is not desirable
>>>
>>>
>>> On Wed, Aug 3, 2011 at 11:41 AM, Thavasi Subramanian <
>>> sktthav...@gmail.com> wrote:
>>>
 Here take is a pointer local to fn main() and array3[10] is local to fn
 modify. So array3's entire locations are not visible to main().
 "return array3" will retun only the reference of the first element of
 the array.
 So the pointer will store only one value 3(the first value in array3) in
 address "take".

 The problem here is the scope of array3. If you declare array3 as a
 global variable then you will get what you are in need of.


 On 3 August 2011 10:57, Arshad Alam  wrote:

> WHY THERE IS ERROR AT THE "BOLD LINE" THAT IS L-VALUE REQUIRED
>
> /*
> Write a program which performs the following tasks:
> - initialize an integer array of 10 elements in main( )
> - pass the entire array to a function modify( )
> - in modify( ) multiply each element of array by 3
> - return the control to main( ) and print the new array elements in
> main( )
> */
>
> #include
> #include
> void main()
> {
> clrscr();
> int take[10],i;
> int array1[10]={1,2,3,4,5,6,7,8,9,10};
> int* modify(int*);
> *take=modify(array1);*
> for(i=0;i<10;i++)
> printf("%d ",take[i]);
> getch();
> }
>
>
> int* modify(int* array2)
> {
> int i;
> int array3[10];
> for(i=0;i<10;i++)
> {
> array3[i]=3*array2[i];
>//printf(" %d",array3[i]);
> }
> return array3;
> }
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Thavasi

 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Thavasi
>>
>
>
>
> --
> Thavasi
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with array

2011-08-03 Thread Thavasi Subramanian
@Alam, Try this revised code

#include
#include
int array3[10];
main()
{
clrscr();
int *take,i;
int array1[10]={1,2,3,4,5,6,7,8,9,10};
int* modify(int*);
take=modify(array1);
for(i=0;i<10;i++)
printf("%d ",*(take+i));
getch();
}


int* modify(int* array2)
{
int i;
for(i=0;i<10;i++)
{
array3[i]=3*array2[i];
   //printf(" %d",array3[i]);
}
return array3;
}


On 3 August 2011 13:31, Thavasi Subramanian  wrote:

> @Alam: Can u mail tat revised code
>
>
> On 3 August 2011 11:54, Arshad Alam  wrote:
>
>>
>> @Subramanian, I made the changes what you have told, it is running
>> fine,not giving any warning or error but output is not desirable
>>
>>
>> On Wed, Aug 3, 2011 at 11:41 AM, Thavasi Subramanian <
>> sktthav...@gmail.com> wrote:
>>
>>> Here take is a pointer local to fn main() and array3[10] is local to fn
>>> modify. So array3's entire locations are not visible to main().
>>> "return array3" will retun only the reference of the first element of the
>>> array.
>>> So the pointer will store only one value 3(the first value in array3) in
>>> address "take".
>>>
>>> The problem here is the scope of array3. If you declare array3 as a
>>> global variable then you will get what you are in need of.
>>>
>>>
>>> On 3 August 2011 10:57, Arshad Alam  wrote:
>>>
 WHY THERE IS ERROR AT THE "BOLD LINE" THAT IS L-VALUE REQUIRED

 /*
 Write a program which performs the following tasks:
 - initialize an integer array of 10 elements in main( )
 - pass the entire array to a function modify( )
 - in modify( ) multiply each element of array by 3
 - return the control to main( ) and print the new array elements in
 main( )
 */

 #include
 #include
 void main()
 {
 clrscr();
 int take[10],i;
 int array1[10]={1,2,3,4,5,6,7,8,9,10};
 int* modify(int*);
 *take=modify(array1);*
 for(i=0;i<10;i++)
 printf("%d ",take[i]);
 getch();
 }


 int* modify(int* array2)
 {
 int i;
 int array3[10];
 for(i=0;i<10;i++)
 {
 array3[i]=3*array2[i];
//printf(" %d",array3[i]);
 }
 return array3;
 }

 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Thavasi
>>>
>>> --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thavasi
>



-- 
Thavasi

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with array

2011-08-03 Thread Thavasi Subramanian
@Alam: Can u mail tat revised code

On 3 August 2011 11:54, Arshad Alam  wrote:

>
> @Subramanian, I made the changes what you have told, it is running fine,not
> giving any warning or error but output is not desirable
>
>
> On Wed, Aug 3, 2011 at 11:41 AM, Thavasi Subramanian  > wrote:
>
>> Here take is a pointer local to fn main() and array3[10] is local to fn
>> modify. So array3's entire locations are not visible to main().
>> "return array3" will retun only the reference of the first element of the
>> array.
>> So the pointer will store only one value 3(the first value in array3) in
>> address "take".
>>
>> The problem here is the scope of array3. If you declare array3 as a global
>> variable then you will get what you are in need of.
>>
>>
>> On 3 August 2011 10:57, Arshad Alam  wrote:
>>
>>> WHY THERE IS ERROR AT THE "BOLD LINE" THAT IS L-VALUE REQUIRED
>>>
>>> /*
>>> Write a program which performs the following tasks:
>>> - initialize an integer array of 10 elements in main( )
>>> - pass the entire array to a function modify( )
>>> - in modify( ) multiply each element of array by 3
>>> - return the control to main( ) and print the new array elements in main(
>>> )
>>> */
>>>
>>> #include
>>> #include
>>> void main()
>>> {
>>> clrscr();
>>> int take[10],i;
>>> int array1[10]={1,2,3,4,5,6,7,8,9,10};
>>> int* modify(int*);
>>> *take=modify(array1);*
>>> for(i=0;i<10;i++)
>>> printf("%d ",take[i]);
>>> getch();
>>> }
>>>
>>>
>>> int* modify(int* array2)
>>> {
>>> int i;
>>> int array3[10];
>>> for(i=0;i<10;i++)
>>> {
>>> array3[i]=3*array2[i];
>>>//printf(" %d",array3[i]);
>>> }
>>> return array3;
>>> }
>>>
>>> --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Thavasi
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thavasi

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with array

2011-08-02 Thread Arshad Alam
@Subramanian, I made the changes what you have told, it is running fine,not
giving any warning or error but output is not desirable


On Wed, Aug 3, 2011 at 11:41 AM, Thavasi Subramanian
wrote:

> Here take is a pointer local to fn main() and array3[10] is local to fn
> modify. So array3's entire locations are not visible to main().
> "return array3" will retun only the reference of the first element of the
> array.
> So the pointer will store only one value 3(the first value in array3) in
> address "take".
>
> The problem here is the scope of array3. If you declare array3 as a global
> variable then you will get what you are in need of.
>
>
> On 3 August 2011 10:57, Arshad Alam  wrote:
>
>> WHY THERE IS ERROR AT THE "BOLD LINE" THAT IS L-VALUE REQUIRED
>>
>> /*
>> Write a program which performs the following tasks:
>> - initialize an integer array of 10 elements in main( )
>> - pass the entire array to a function modify( )
>> - in modify( ) multiply each element of array by 3
>> - return the control to main( ) and print the new array elements in main(
>> )
>> */
>>
>> #include
>> #include
>> void main()
>> {
>> clrscr();
>> int take[10],i;
>> int array1[10]={1,2,3,4,5,6,7,8,9,10};
>> int* modify(int*);
>> *take=modify(array1);*
>> for(i=0;i<10;i++)
>> printf("%d ",take[i]);
>> getch();
>> }
>>
>>
>> int* modify(int* array2)
>> {
>> int i;
>> int array3[10];
>> for(i=0;i<10;i++)
>> {
>> array3[i]=3*array2[i];
>>//printf(" %d",array3[i]);
>> }
>> return array3;
>> }
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thavasi
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with array

2011-08-02 Thread sagar pareek
here u have taken array "*take*[]"  as constant...change its declaration  to
int* yake;
then it will not give u error

On Wed, Aug 3, 2011 at 11:41 AM, Thavasi Subramanian
wrote:

> Here take is a pointer local to fn main() and array3[10] is local to fn
> modify. So array3's entire locations are not visible to main().
> "return array3" will retun only the reference of the first element of the
> array.
> So the pointer will store only one value 3(the first value in array3) in
> address "take".
>
> The problem here is the scope of array3. If you declare array3 as a global
> variable then you will get what you are in need of.
>
>
>
> On 3 August 2011 10:57, Arshad Alam  wrote:
>
>> WHY THERE IS ERROR AT THE "BOLD LINE" THAT IS L-VALUE REQUIRED
>>
>> /*
>> Write a program which performs the following tasks:
>> - initialize an integer array of 10 elements in main( )
>> - pass the entire array to a function modify( )
>> - in modify( ) multiply each element of array by 3
>> - return the control to main( ) and print the new array elements in main(
>> )
>> */
>>
>> #include
>> #include
>> void main()
>> {
>> clrscr();
>> int take[10],i;
>> int array1[10]={1,2,3,4,5,6,7,8,9,10};
>> int* modify(int*);
>> *take=modify(array1);*
>> for(i=0;i<10;i++)
>> printf("%d ",take[i]);
>> getch();
>> }
>>
>>
>> int* modify(int* array2)
>> {
>> int i;
>> int array3[10];
>> for(i=0;i<10;i++)
>> {
>> array3[i]=3*array2[i];
>>//printf(" %d",array3[i]);
>> }
>> return array3;
>> }
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thavasi
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with array

2011-08-02 Thread Thavasi Subramanian
Also take[] cannot be an array... It should be a pointer since function
cannot return more than one value.

On 3 August 2011 11:41, Thavasi Subramanian  wrote:

> Here take is a pointer local to fn main() and array3[10] is local to fn
> modify. So array3's entire locations are not visible to main().
> "return array3" will retun only the reference of the first element of the
> array.
> So the pointer will store only one value 3(the first value in array3) in
> address "take".
>
> The problem here is the scope of array3. If you declare array3 as a global
> variable then you will get what you are in need of.
>
>
>
> On 3 August 2011 10:57, Arshad Alam  wrote:
>
>> WHY THERE IS ERROR AT THE "BOLD LINE" THAT IS L-VALUE REQUIRED
>>
>> /*
>> Write a program which performs the following tasks:
>> - initialize an integer array of 10 elements in main( )
>> - pass the entire array to a function modify( )
>> - in modify( ) multiply each element of array by 3
>> - return the control to main( ) and print the new array elements in main(
>> )
>> */
>>
>> #include
>> #include
>> void main()
>> {
>> clrscr();
>> int take[10],i;
>> int array1[10]={1,2,3,4,5,6,7,8,9,10};
>> int* modify(int*);
>> *take=modify(array1);*
>> for(i=0;i<10;i++)
>> printf("%d ",take[i]);
>> getch();
>> }
>>
>>
>> int* modify(int* array2)
>> {
>> int i;
>> int array3[10];
>> for(i=0;i<10;i++)
>> {
>> array3[i]=3*array2[i];
>>//printf(" %d",array3[i]);
>> }
>> return array3;
>> }
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thavasi
>



-- 
Thavasi

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem with array

2011-08-02 Thread Thavasi Subramanian
Here take is a pointer local to fn main() and array3[10] is local to fn
modify. So array3's entire locations are not visible to main().
"return array3" will retun only the reference of the first element of the
array.
So the pointer will store only one value 3(the first value in array3) in
address "take".

The problem here is the scope of array3. If you declare array3 as a global
variable then you will get what you are in need of.


On 3 August 2011 10:57, Arshad Alam  wrote:

> WHY THERE IS ERROR AT THE "BOLD LINE" THAT IS L-VALUE REQUIRED
>
> /*
> Write a program which performs the following tasks:
> - initialize an integer array of 10 elements in main( )
> - pass the entire array to a function modify( )
> - in modify( ) multiply each element of array by 3
> - return the control to main( ) and print the new array elements in main( )
> */
>
> #include
> #include
> void main()
> {
> clrscr();
> int take[10],i;
> int array1[10]={1,2,3,4,5,6,7,8,9,10};
> int* modify(int*);
> *take=modify(array1);*
> for(i=0;i<10;i++)
> printf("%d ",take[i]);
> getch();
> }
>
>
> int* modify(int* array2)
> {
> int i;
> int array3[10];
> for(i=0;i<10;i++)
> {
> array3[i]=3*array2[i];
>//printf(" %d",array3[i]);
> }
> return array3;
> }
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thavasi

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem of structur

2011-07-31 Thread rajeev bharshetty
*#include*
*
*
*
*
*struct emp*
*{*
*char name[20];*
*int age;*
*};*
*f(struct emp ee)*
*{*
*printf("%s ...%d\n",ee.name,ee.age);*
*}*
*main()*
*{*
*struct emp e={"qwe",12};*
*f(e);*
*}*

This above code works fine on gcc 4.3.2
output  : qwe ...12

On Sun, Jul 31, 2011 at 8:38 PM, Anika Jain  wrote:

> In C default return type is int and as you havent given return type for f
> function compiler assumes it as int but u r not returning any integer from
> that function
>
> On Sun, Jul 31, 2011 at 8:33 PM, Rajesh Kumar wrote:
>
>> What is Error in This program??plzrply
>> #include
>> f(struct epm);
>> struct emp
>> {
>> char name[20];
>> int age;
>> };
>> main()
>> {
>> struct emp e={"qwe",12};
>> f(e);
>> }
>> f(struct emp ee)
>> {
>> printf("%s ...%d\n",ee.name,ee.age);
>> }
>>
>>
>> --
>> Rajesh Kumar
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem of structur

2011-07-31 Thread Pratz mary
i think its because when ur declaring func f ur passing a struct which hasnt
been declared yet...put the structure declaraion before the func declaration

On 31 July 2011 20:33, Rajesh Kumar  wrote:

> What is Error in This program??plzrply
> #include
> f(struct epm);
> struct emp
> {
> char name[20];
> int age;
> };
> main()
> {
> struct emp e={"qwe",12};
> f(e);
> }
> f(struct emp ee)
> {
> printf("%s ...%d\n",ee.name,ee.age);
> }
>
>
> --
> Rajesh Kumar
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
regards Pratima :)

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem of structur

2011-07-31 Thread Anika Jain
In C default return type is int and as you havent given return type for f
function compiler assumes it as int but u r not returning any integer from
that function

On Sun, Jul 31, 2011 at 8:33 PM, Rajesh Kumar wrote:

> What is Error in This program??plzrply
> #include
> f(struct epm);
> struct emp
> {
> char name[20];
> int age;
> };
> main()
> {
> struct emp e={"qwe",12};
> f(e);
> }
> f(struct emp ee)
> {
> printf("%s ...%d\n",ee.name,ee.age);
> }
>
>
> --
> Rajesh Kumar
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
AFAIK , it is adaptation of gcc standards, which is the problem with mingw
as well . So i use ideone to check my answer as it uses spoj engine which is
 considered more standard.  I guess that is the reason, i cant think of
other

On Fri, Jul 29, 2011 at 11:51 PM, rajeev bharshetty wrote:

> @ankur: But the same above code wont show any error on my gcc 4.3.2 running
> on Open Suse 11.4 
>
>
> On Fri, Jul 29, 2011 at 11:48 PM, Ankur Khurana 
> wrote:
>
>> http://ideone.com/OaCDR
>>
>>
>> On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty > > wrote:
>>
>>> @ankur :which compiler are u using??
>>>
>>>
>>> On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana <
>>> ankur.kkhur...@gmail.com> wrote:
>>>
 @rajeev: your code gives compilation error.


 On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana <
 ankur.kkhur...@gmail.com> wrote:

> no ,
> n[0] is *(n+0)
> so actually n is being dereferenced here .Check the basci diff
>
> p is a pointer , but n is a pointer to a pointer.
>
>
> On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam wrote:
>
>> wow great... but why it is so yaar?
>> ptr=n and ptr=n[0] is same na?
>>
>>
>> On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty <
>> rajeevr...@gmail.com> wrote:
>>
>>>#include
>>>
>>>void main()
>>> {
>>>   int n[3][3]= {
>>>  2,4,3,
>>>6,8,5,
>>>  3,5,1
>>>  };
>>>   int i,*ptr;
>>>  ptr= n;
>>>  for(i=0;i<=8;i++)
>>>   printf("\n%d",*(ptr+i));
>>>
>>> }
>>>
>>> In gcc 4.3.2 no error ,it is just showing a warning as
>>>
>>> ms50.c: In function ‘main’:
>>> ms50.c:11:8: warning: assignment from incompatible pointer type
>>>
>>> change the statement as ptr = n[0] warning vanishes
>>>
>>> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam wrote:
>>>
 what's the problem with line number 12?

 1#include
 2#include
 3void main()
 4   {
 5clrscr();
 6int n[3][3]= {
 7 2,4,3,
 8 6,8,5,
 9 3,5,1
 10 };
 11  int i,*ptr;
 12 ptr=n;
 13 for(i=0;i<=8;i++)
 14printf("\n%d",*(ptr+i));
 15 getch();
 }

 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Regards
>>> Rajeev N B 
>>>
>>> "*Winners Don't do Different things , they do things Differently"*
>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Ankur Khurana
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
>
>


 --
 Ankur Khurana
 Computer Science
 Netaji Subhas Institute Of Technology
 Delhi.

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Regards
>>> Rajeev N B 
>>>
>>> "*Winners Don't do Different things , they do things Differently"*
>>>
>>>  --
>>> 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.co

Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
Thanks for pointing that out, my apologies  . .  .

On Fri, Jul 29, 2011 at 11:53 PM, rajeev bharshetty wrote:

> @ankur : Dude I think you compiled in ideone as C++ language but it is C :)
> http://ideone.com/HZhHu
>
>
> On Fri, Jul 29, 2011 at 11:51 PM, rajeev bharshetty 
> wrote:
>
>> @ankur: But the same above code wont show any error on my gcc 4.3.2
>> running on Open Suse 11.4 
>>
>>
>> On Fri, Jul 29, 2011 at 11:48 PM, Ankur Khurana > > wrote:
>>
>>> http://ideone.com/OaCDR
>>>
>>>
>>> On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty <
>>> rajeevr...@gmail.com> wrote:
>>>
 @ankur :which compiler are u using??


 On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana <
 ankur.kkhur...@gmail.com> wrote:

> @rajeev: your code gives compilation error.
>
>
> On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana <
> ankur.kkhur...@gmail.com> wrote:
>
>> no ,
>> n[0] is *(n+0)
>> so actually n is being dereferenced here .Check the basci diff
>>
>> p is a pointer , but n is a pointer to a pointer.
>>
>>
>> On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam wrote:
>>
>>> wow great... but why it is so yaar?
>>> ptr=n and ptr=n[0] is same na?
>>>
>>>
>>> On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty <
>>> rajeevr...@gmail.com> wrote:
>>>
#include

void main()
 {
   int n[3][3]= {
  2,4,3,
6,8,5,
  3,5,1
  };
   int i,*ptr;
  ptr= n;
  for(i=0;i<=8;i++)
   printf("\n%d",*(ptr+i));

 }

 In gcc 4.3.2 no error ,it is just showing a warning as

 ms50.c: In function ‘main’:
 ms50.c:11:8: warning: assignment from incompatible pointer type

 change the statement as ptr = n[0] warning vanishes

 On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam 
 wrote:

> what's the problem with line number 12?
>
> 1#include
> 2#include
> 3void main()
> 4   {
> 5clrscr();
> 6int n[3][3]= {
> 7 2,4,3,
> 8 6,8,5,
> 9 3,5,1
> 10 };
> 11  int i,*ptr;
> 12 ptr=n;
> 13 for(i=0;i<=8;i++)
> 14printf("\n%d",*(ptr+i));
> 15 getch();
> }
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Regards
 Rajeev N B 

 "*Winners Don't do Different things , they do things Differently"*

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Ankur Khurana
>> Computer Science
>> Netaji Subhas Institute Of Technology
>> Delhi.
>>
>>
>
>
> --
> Ankur Khurana
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Regards
 Rajeev N B 

 "*Winners Don't do Different things , they do things Differently"*

Re: [algogeeks] problem at line number 12

2011-07-29 Thread rajeev bharshetty
@ankur : Dude I think you compiled in ideone as C++ language but it is C :)
http://ideone.com/HZhHu

On Fri, Jul 29, 2011 at 11:51 PM, rajeev bharshetty wrote:

> @ankur: But the same above code wont show any error on my gcc 4.3.2 running
> on Open Suse 11.4 
>
>
> On Fri, Jul 29, 2011 at 11:48 PM, Ankur Khurana 
> wrote:
>
>> http://ideone.com/OaCDR
>>
>>
>> On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty > > wrote:
>>
>>> @ankur :which compiler are u using??
>>>
>>>
>>> On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana <
>>> ankur.kkhur...@gmail.com> wrote:
>>>
 @rajeev: your code gives compilation error.


 On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana <
 ankur.kkhur...@gmail.com> wrote:

> no ,
> n[0] is *(n+0)
> so actually n is being dereferenced here .Check the basci diff
>
> p is a pointer , but n is a pointer to a pointer.
>
>
> On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam wrote:
>
>> wow great... but why it is so yaar?
>> ptr=n and ptr=n[0] is same na?
>>
>>
>> On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty <
>> rajeevr...@gmail.com> wrote:
>>
>>>#include
>>>
>>>void main()
>>> {
>>>   int n[3][3]= {
>>>  2,4,3,
>>>6,8,5,
>>>  3,5,1
>>>  };
>>>   int i,*ptr;
>>>  ptr= n;
>>>  for(i=0;i<=8;i++)
>>>   printf("\n%d",*(ptr+i));
>>>
>>> }
>>>
>>> In gcc 4.3.2 no error ,it is just showing a warning as
>>>
>>> ms50.c: In function ‘main’:
>>> ms50.c:11:8: warning: assignment from incompatible pointer type
>>>
>>> change the statement as ptr = n[0] warning vanishes
>>>
>>> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam wrote:
>>>
 what's the problem with line number 12?

 1#include
 2#include
 3void main()
 4   {
 5clrscr();
 6int n[3][3]= {
 7 2,4,3,
 8 6,8,5,
 9 3,5,1
 10 };
 11  int i,*ptr;
 12 ptr=n;
 13 for(i=0;i<=8;i++)
 14printf("\n%d",*(ptr+i));
 15 getch();
 }

 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Regards
>>> Rajeev N B 
>>>
>>> "*Winners Don't do Different things , they do things Differently"*
>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Ankur Khurana
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
>
>


 --
 Ankur Khurana
 Computer Science
 Netaji Subhas Institute Of Technology
 Delhi.

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Regards
>>> Rajeev N B 
>>>
>>> "*Winners Don't do Different things , they do things Differently"*
>>>
>>>  --
>>> 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 

Re: [algogeeks] problem at line number 12

2011-07-29 Thread rajeev bharshetty
@ankur: But the same above code wont show any error on my gcc 4.3.2 running
on Open Suse 11.4 

On Fri, Jul 29, 2011 at 11:48 PM, Ankur Khurana wrote:

> http://ideone.com/OaCDR
>
>
> On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty 
> wrote:
>
>> @ankur :which compiler are u using??
>>
>>
>> On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana > > wrote:
>>
>>> @rajeev: your code gives compilation error.
>>>
>>>
>>> On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana <
>>> ankur.kkhur...@gmail.com> wrote:
>>>
 no ,
 n[0] is *(n+0)
 so actually n is being dereferenced here .Check the basci diff

 p is a pointer , but n is a pointer to a pointer.


 On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam wrote:

> wow great... but why it is so yaar?
> ptr=n and ptr=n[0] is same na?
>
>
> On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty <
> rajeevr...@gmail.com> wrote:
>
>>#include
>>
>>void main()
>> {
>>   int n[3][3]= {
>>  2,4,3,
>>6,8,5,
>>  3,5,1
>>  };
>>   int i,*ptr;
>>  ptr= n;
>>  for(i=0;i<=8;i++)
>>   printf("\n%d",*(ptr+i));
>>
>> }
>>
>> In gcc 4.3.2 no error ,it is just showing a warning as
>>
>> ms50.c: In function ‘main’:
>> ms50.c:11:8: warning: assignment from incompatible pointer type
>>
>> change the statement as ptr = n[0] warning vanishes
>>
>> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam wrote:
>>
>>> what's the problem with line number 12?
>>>
>>> 1#include
>>> 2#include
>>> 3void main()
>>> 4   {
>>> 5clrscr();
>>> 6int n[3][3]= {
>>> 7 2,4,3,
>>> 8 6,8,5,
>>> 9 3,5,1
>>> 10 };
>>> 11  int i,*ptr;
>>> 12 ptr=n;
>>> 13 for(i=0;i<=8;i++)
>>> 14printf("\n%d",*(ptr+i));
>>> 15 getch();
>>> }
>>>
>>> --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Rajeev N B 
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Ankur Khurana
 Computer Science
 Netaji Subhas Institute Of Technology
 Delhi.


>>>
>>>
>>> --
>>> Ankur Khurana
>>> Computer Science
>>> Netaji Subhas Institute Of Technology
>>> Delhi.
>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Rajeev N B 
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Ankur Khurana
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
>
>  --
> 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 t

Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
http://ideone.com/OaCDR

On Fri, Jul 29, 2011 at 11:45 PM, rajeev bharshetty wrote:

> @ankur :which compiler are u using??
>
>
> On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana 
> wrote:
>
>> @rajeev: your code gives compilation error.
>>
>>
>> On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana > > wrote:
>>
>>> no ,
>>> n[0] is *(n+0)
>>> so actually n is being dereferenced here .Check the basci diff
>>>
>>> p is a pointer , but n is a pointer to a pointer.
>>>
>>>
>>> On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam wrote:
>>>
 wow great... but why it is so yaar?
 ptr=n and ptr=n[0] is same na?


 On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty <
 rajeevr...@gmail.com> wrote:

>#include
>
>void main()
> {
>   int n[3][3]= {
>  2,4,3,
>6,8,5,
>  3,5,1
>  };
>   int i,*ptr;
>  ptr= n;
>  for(i=0;i<=8;i++)
>   printf("\n%d",*(ptr+i));
>
> }
>
> In gcc 4.3.2 no error ,it is just showing a warning as
>
> ms50.c: In function ‘main’:
> ms50.c:11:8: warning: assignment from incompatible pointer type
>
> change the statement as ptr = n[0] warning vanishes
>
> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam wrote:
>
>> what's the problem with line number 12?
>>
>> 1#include
>> 2#include
>> 3void main()
>> 4   {
>> 5clrscr();
>> 6int n[3][3]= {
>> 7 2,4,3,
>> 8 6,8,5,
>> 9 3,5,1
>> 10 };
>> 11  int i,*ptr;
>> 12 ptr=n;
>> 13 for(i=0;i<=8;i++)
>> 14printf("\n%d",*(ptr+i));
>> 15 getch();
>> }
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Ankur Khurana
>>> Computer Science
>>> Netaji Subhas Institute Of Technology
>>> Delhi.
>>>
>>>
>>
>>
>> --
>> Ankur Khurana
>> Computer Science
>> Netaji Subhas Institute Of Technology
>> Delhi.
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem at line number 12

2011-07-29 Thread rajeev bharshetty
@ankur :which compiler are u using??

On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana wrote:

> @rajeev: your code gives compilation error.
>
>
> On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana 
> wrote:
>
>> no ,
>> n[0] is *(n+0)
>> so actually n is being dereferenced here .Check the basci diff
>>
>> p is a pointer , but n is a pointer to a pointer.
>>
>>
>> On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam  wrote:
>>
>>> wow great... but why it is so yaar?
>>> ptr=n and ptr=n[0] is same na?
>>>
>>>
>>> On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty <
>>> rajeevr...@gmail.com> wrote:
>>>
#include

void main()
 {
   int n[3][3]= {
  2,4,3,
6,8,5,
  3,5,1
  };
   int i,*ptr;
  ptr= n;
  for(i=0;i<=8;i++)
   printf("\n%d",*(ptr+i));

 }

 In gcc 4.3.2 no error ,it is just showing a warning as

 ms50.c: In function ‘main’:
 ms50.c:11:8: warning: assignment from incompatible pointer type

 change the statement as ptr = n[0] warning vanishes

 On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam wrote:

> what's the problem with line number 12?
>
> 1#include
> 2#include
> 3void main()
> 4   {
> 5clrscr();
> 6int n[3][3]= {
> 7 2,4,3,
> 8 6,8,5,
> 9 3,5,1
> 10 };
> 11  int i,*ptr;
> 12 ptr=n;
> 13 for(i=0;i<=8;i++)
> 14printf("\n%d",*(ptr+i));
> 15 getch();
> }
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Regards
 Rajeev N B 

 "*Winners Don't do Different things , they do things Differently"*

  --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Ankur Khurana
>> Computer Science
>> Netaji Subhas Institute Of Technology
>> Delhi.
>>
>>
>
>
> --
> Ankur Khurana
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
@rajeev: your code gives compilation error.

On Fri, Jul 29, 2011 at 11:39 PM, Ankur Khurana wrote:

> no ,
> n[0] is *(n+0)
> so actually n is being dereferenced here .Check the basci diff
>
> p is a pointer , but n is a pointer to a pointer.
>
>
> On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam  wrote:
>
>> wow great... but why it is so yaar?
>> ptr=n and ptr=n[0] is same na?
>>
>>
>> On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty > > wrote:
>>
>>>#include
>>>
>>>void main()
>>> {
>>>   int n[3][3]= {
>>>  2,4,3,
>>>6,8,5,
>>>  3,5,1
>>>  };
>>>   int i,*ptr;
>>>  ptr= n;
>>>  for(i=0;i<=8;i++)
>>>   printf("\n%d",*(ptr+i));
>>>
>>> }
>>>
>>> In gcc 4.3.2 no error ,it is just showing a warning as
>>>
>>> ms50.c: In function ‘main’:
>>> ms50.c:11:8: warning: assignment from incompatible pointer type
>>>
>>> change the statement as ptr = n[0] warning vanishes
>>>
>>> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam wrote:
>>>
 what's the problem with line number 12?

 1#include
 2#include
 3void main()
 4   {
 5clrscr();
 6int n[3][3]= {
 7 2,4,3,
 8 6,8,5,
 9 3,5,1
 10 };
 11  int i,*ptr;
 12 ptr=n;
 13 for(i=0;i<=8;i++)
 14printf("\n%d",*(ptr+i));
 15 getch();
 }

 --
 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 group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Regards
>>> Rajeev N B 
>>>
>>> "*Winners Don't do Different things , they do things Differently"*
>>>
>>>  --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Ankur Khurana
> Computer Science
> Netaji Subhas Institute Of Technology
> Delhi.
>
>


-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
no ,
n[0] is *(n+0)
so actually n is being dereferenced here .Check the basci diff

p is a pointer , but n is a pointer to a pointer.


On Fri, Jul 29, 2011 at 11:34 PM, Arshad Alam  wrote:

> wow great... but why it is so yaar?
> ptr=n and ptr=n[0] is same na?
>
>
> On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty 
> wrote:
>
>>#include
>>
>>void main()
>> {
>>   int n[3][3]= {
>>  2,4,3,
>>6,8,5,
>>  3,5,1
>>  };
>>   int i,*ptr;
>>  ptr= n;
>>  for(i=0;i<=8;i++)
>>   printf("\n%d",*(ptr+i));
>>
>> }
>>
>> In gcc 4.3.2 no error ,it is just showing a warning as
>>
>> ms50.c: In function ‘main’:
>> ms50.c:11:8: warning: assignment from incompatible pointer type
>>
>> change the statement as ptr = n[0] warning vanishes
>>
>> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam  wrote:
>>
>>> what's the problem with line number 12?
>>>
>>> 1#include
>>> 2#include
>>> 3void main()
>>> 4   {
>>> 5clrscr();
>>> 6int n[3][3]= {
>>> 7 2,4,3,
>>> 8 6,8,5,
>>> 9 3,5,1
>>> 10 };
>>> 11  int i,*ptr;
>>> 12 ptr=n;
>>> 13 for(i=0;i<=8;i++)
>>> 14printf("\n%d",*(ptr+i));
>>> 15 getch();
>>> }
>>>
>>> --
>>> 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 group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Rajeev N B 
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem at line number 12

2011-07-29 Thread Arshad Alam
wow great... but why it is so yaar?
ptr=n and ptr=n[0] is same na?


On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty wrote:

>#include
>
>void main()
> {
>   int n[3][3]= {
>  2,4,3,
>6,8,5,
>  3,5,1
>  };
>   int i,*ptr;
>  ptr= n;
>  for(i=0;i<=8;i++)
>   printf("\n%d",*(ptr+i));
>
> }
>
> In gcc 4.3.2 no error ,it is just showing a warning as
>
> ms50.c: In function ‘main’:
> ms50.c:11:8: warning: assignment from incompatible pointer type
>
> change the statement as ptr = n[0] warning vanishes
>
> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam  wrote:
>
>> what's the problem with line number 12?
>>
>> 1#include
>> 2#include
>> 3void main()
>> 4   {
>> 5clrscr();
>> 6int n[3][3]= {
>> 7 2,4,3,
>> 8 6,8,5,
>> 9 3,5,1
>> 10 };
>> 11  int i,*ptr;
>> 12 ptr=n;
>> 13 for(i=0;i<=8;i++)
>> 14printf("\n%d",*(ptr+i));
>> 15 getch();
>> }
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem at line number 12

2011-07-29 Thread Ankur Khurana
try this
 #include

   void main()
{
  int n[3][3]= {
 2,4,3,
   6,8,5,
 3,5,1
 };
  int i,*ptr;
 ptr= (int *) n;
 for(i=0;i<=8;i++)
  printf("\n%d",*(ptr+i));

}

On Fri, Jul 29, 2011 at 11:27 PM, rajeev bharshetty wrote:

>#include
>
>void main()
> {
>   int n[3][3]= {
>  2,4,3,
>6,8,5,
>  3,5,1
>  };
>   int i,*ptr;
>  ptr= n;
>  for(i=0;i<=8;i++)
>   printf("\n%d",*(ptr+i));
>
> }
>
> In gcc 4.3.2 no error ,it is just showing a warning as
>
> ms50.c: In function ‘main’:
> ms50.c:11:8: warning: assignment from incompatible pointer type
>
> change the statement as ptr = n[0] warning vanishes
>
> On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam  wrote:
>
>> what's the problem with line number 12?
>>
>> 1#include
>> 2#include
>> 3void main()
>> 4   {
>> 5clrscr();
>> 6int n[3][3]= {
>> 7 2,4,3,
>> 8 6,8,5,
>> 9 3,5,1
>> 10 };
>> 11  int i,*ptr;
>> 12 ptr=n;
>> 13 for(i=0;i<=8;i++)
>> 14printf("\n%d",*(ptr+i));
>> 15 getch();
>> }
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Ankur Khurana
Computer Science
Netaji Subhas Institute Of Technology
Delhi.

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem at line number 12

2011-07-29 Thread rajeev bharshetty
   #include

   void main()
{
  int n[3][3]= {
 2,4,3,
   6,8,5,
 3,5,1
 };
  int i,*ptr;
 ptr= n;
 for(i=0;i<=8;i++)
  printf("\n%d",*(ptr+i));

}

In gcc 4.3.2 no error ,it is just showing a warning as

ms50.c: In function ‘main’:
ms50.c:11:8: warning: assignment from incompatible pointer type

change the statement as ptr = n[0] warning vanishes

On Fri, Jul 29, 2011 at 11:17 PM, Arshad Alam  wrote:

> what's the problem with line number 12?
>
> 1#include
> 2#include
> 3void main()
> 4   {
> 5clrscr();
> 6int n[3][3]= {
> 7 2,4,3,
> 8 6,8,5,
> 9 3,5,1
> 10 };
> 11  int i,*ptr;
> 12 ptr=n;
> 13 for(i=0;i<=8;i++)
> 14printf("\n%d",*(ptr+i));
> 15 getch();
> }
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Rajeev N B 

"*Winners Don't do Different things , they do things Differently"*

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem tree minimum sum in binary

2011-07-26 Thread SkRiPt KiDdIe
for(i=sz-2;i>=0;i--)
for(j=0;j<=i;j++)
ar[i][j]+=min(ar[i+1][j],ar[i+1][j+1]);

cout

Re: [algogeeks] problem tree minimum sum in binary

2011-07-26 Thread Ravinder Kumar
Do inorder traversal and maintain a bit vector equal to height of tree also
keep an current shortest path bit vector
in last print path using shortest path bit vector.

keep updating shortest path bit vector when path shorter than current
shortest path is found.


On Tue, Jul 26, 2011 at 9:57 AM, Charlotte Swazki
wrote:

> Hi,
>
> I want to implement an algorithm to determine the shortest path from the
> top to down.
>
> like:
>
>
> int py_path_shoretest(int size, int **map);  // return the shortest path
> value. size is the height.
>
>
> int main(void)
> {
>  int map =  {
> {1},
>{2, 3},
>   {8, 0, 2},
>  {1, 3, 9, 3}
>   };
> printf("%d\n", py_path_shoretest(4, map));  // will return 6.
>
>
>
> }
>
> Do I have to travel all posibilities, to calculate everything?do you have
> any idea ?
>
> I have all in a
> struct node
> {
> int val;
> struct *node r;
> struct *node l;
> };
>
> Regards,
> Charlotte.
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
*With Regards :*

Ravinder Kumar
B.Tech Final Year
Computer Science and Engineering
MNNIT Allahabad

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem tree minimum sum in binary

2011-07-26 Thread sunny agrawal
It dont look like a tree
its more like a triangle
and if the values are stored in the matrix can be simply done using a
Dynamic Programming bottom up approach


On Tue, Jul 26, 2011 at 2:27 PM, Charlotte Swazki
wrote:

> Hi,
>
> I want to implement an algorithm to determine the shortest path from the
> top to down.
>
> like:
>
>
> int py_path_shoretest(int size, int **map);  // return the shortest path
> value. size is the height.
>
>
> int main(void)
> {
>  int map =  {
> {1},
>{2, 3},
>   {8, 0, 2},
>  {1, 3, 9, 3}
>   };
> printf("%d\n", py_path_shoretest(4, map));  // will return 6.
>
>
>
> }
>
> Do I have to travel all posibilities, to calculate everything?do you have
> any idea ?
>
> I have all in a
> struct node
> {
> int val;
> struct *node r;
> struct *node l;
> };
>
> Regards,
> Charlotte.
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Sunny Aggrawal
B-Tech IV year,CSI
Indian Institute Of Technology,Roorkee

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem

2011-05-11 Thread Supraja Jayakumar
isnt this  a DP problem ?
I think its there in CLRS.

Let me know.

Cheers
Supraja J

On Wed, May 11, 2011 at 7:55 AM, Harshit Gangal wrote:

> How can we calculate the number of divisors a number have in minimum time
> or having minimum Time Complexity.
>
> --
> Harshit Gangal
> Fourth Year Undergraduate Student
> Dept. of Computer Science
> JIIT, Noida , India
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
U

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding gcc installation

2011-05-01 Thread hary rathor
type on terminal " sudo apt-get install gcc"
you will get latest gcc automatically

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding gcc installation

2011-04-29 Thread jaladhi dave
I second Charles thought . The quality of the list is detoriating day by
day, due to such off topic questions.

On 30-Apr-2011 12:27 AM, "Charles Turner"  wrote:
> On 29/04/2011 19:52, himanshu kansal wrote:
>> yeah i knw dt well...bt i jus asked if sum1 cd help me
> I really don't think people who have subscribed to read algorithm
> related discussions want to read about your problems installing a
> compiler. When you find the appropriate list (see hints in my previous
> mail) another tip I can give you is to actually explain the problem,
> such as what errors you see.
>
> Please, refrain from polluting this list with off-topic help requests.
>
> Charles.
>
> --
> 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 group at
http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding gcc installation

2011-04-29 Thread Charles Turner

On 29/04/2011 19:52, himanshu kansal wrote:

yeah i knw dt well...bt i jus asked if sum1 cd help me
I really don't think people who have subscribed to read algorithm 
related discussions want to read about your problems installing a 
compiler. When you find the appropriate list (see hints in my previous 
mail) another tip I can give you is to actually explain the problem, 
such as what errors you see.


Please, refrain from polluting this list with off-topic help requests.

Charles.

--
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding gcc installation

2011-04-29 Thread himanshu kansal
yeah i knw dt well...bt i jus asked if sum1 cd help me

On Sat, Apr 30, 2011 at 12:20 AM, Charles Turner  wrote:

> On 29/04/2011 19:31, himanshu kansal wrote:
>
>> i am using ubuntu 8.04 nd currently installed gcc 4.2
>> do anyone knws the steps of installing gcc of version greater thn 4.4
>> on ubuntu 8.04.
>> i hv searched a lot on net bt couldnt find 1...
>>
> This is *not* the correct mailing list to ask such questions. I'd suggest
> you ask either a Ubuntu or GCC oriented list.
>
> Thank you for your cooperation.
>
> Charles.
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem regarding gcc installation

2011-04-29 Thread Charles Turner

On 29/04/2011 19:31, himanshu kansal wrote:

i am using ubuntu 8.04 nd currently installed gcc 4.2
do anyone knws the steps of installing gcc of version greater thn 4.4
on ubuntu 8.04.
i hv searched a lot on net bt couldnt find 1...
This is *not* the correct mailing list to ask such questions. I'd 
suggest you ask either a Ubuntu or GCC oriented list.


Thank you for your cooperation.

Charles.

--
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem regarding MySql server Installation

2011-04-28 Thread shashi kant
http://forums.mysql.com/read.php?11,278745,278745
this works  for me will work for you too


On Fri, Apr 29, 2011 at 8:34 AM, shashi kant  wrote:

> try this http://www.fixya.com/support/t840251-mysql_error_messeage
>
>
>
> On Fri, Apr 29, 2011 at 12:34 AM, Aniket  wrote:
>
>> I was trying to install mysql 5.5. in Windows XP.After installation
>> during configuration phase when there was to apply security settings I
>> m always getting an error
>>
>> Error No 1045
>> Access Denied for user 'root'@localhost(using password: NO).
>>
>> I have tried all possibilities in Firewall but it dint work.Hope
>> anybody here will help me out of this problem.I am totally screwed
>> up!!!
>>
>> --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> *Shashi Kant *
> ***"Think positive and find fuel in failure"*
> *+919002943948*
> Final Yr. Cse ,Undergraduate Student,
> *National Institute Of Technology Durgapur.*
>
>
>


-- 
*Shashi Kant *
***"Think positive and find fuel in failure"*
*+919002943948*
Final Yr. Cse ,Undergraduate Student,
*National Institute Of Technology Durgapur.*

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem regarding MySql server Installation

2011-04-28 Thread shashi kant
try this http://www.fixya.com/support/t840251-mysql_error_messeage



On Fri, Apr 29, 2011 at 12:34 AM, Aniket  wrote:

> I was trying to install mysql 5.5. in Windows XP.After installation
> during configuration phase when there was to apply security settings I
> m always getting an error
>
> Error No 1045
> Access Denied for user 'root'@localhost(using password: NO).
>
> I have tried all possibilities in Firewall but it dint work.Hope
> anybody here will help me out of this problem.I am totally screwed
> up!!!
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
*Shashi Kant *
***"Think positive and find fuel in failure"*
*+919002943948*
Final Yr. Cse ,Undergraduate Student,
*National Institute Of Technology Durgapur.*

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem; print the largest subset of negative number in array of integers

2011-04-21 Thread Rujin Cao
I think O(n) is the best time complexity. Try to think about one sequence
with all negative numbers or positive numbers. we can't get the full
information without one time iteration, or we can just say the data reading
time will cost O(n).

2011/4/21 hary rathor 

> Problem; print the largest subset of negative number in array of integers
>
> i have code it in following way which is give solution in O(n) and and
> required memory in O(n)
>  any tell me other method better then this O(n) .
> pls tell me is it any bug in the code
>
>
> #include
>
> int count=0,ind=-1,len,i=0;
> void largestNegSubset(int arr[])
> {
> if(i>len)
> return ;
> int t=0;
> while(arr[i++]<0&&i<=len)t++;
> if(t>count){count=t;ind=i-1;}
> largestNegSubset(arr);
> }
> int main()
> {
> int arr[]={1,0,1,-6,-7,-2,-2,4,-3,-5,-6,7,-8,-9};
> len=(sizeof(arr)/sizeof(int));
> largestNegSubset(arr);
> for(i=ind-1;i>(ind-count-1);i--)
> printf("%d,",arr[i]);
> return 0;
> }
>
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem

2011-03-27 Thread Akash Mukherjee
d&c nt givin tle??

On Mon, Mar 28, 2011 at 11:42 AM, sukhmeet singh wrote:

> Well this was asked by codechef on it's intern contest...!! Make a
> recursive algorithm using divide and conquer paradigm
>
> On Thu, Mar 10, 2011 at 11:20 AM, Akash Mukherjee wrote:
>
>> hi,
>>
>> can anybody plzz look at this problem. i tried a recursive greedy approach
>> but it was too slow i guess
>>
>>
>>  You have a truck that you need to completely fill up with merchandise.
>> You have an infinite supply of merchandise of dimension 1x1x1, 2x2x2, 4x4x4,
>> 8x8x8, 16x16x16, ..., 2k x 2k x 2k for all k ≥ 0. (Infinite supply of
>> merchandise of each dimension too!)
>>
>> You wish to fill the truck of dimension AxBxC completely using only these
>> merchandise. Given A, B & C, what is the smallest number of merchandise you
>> will need to fill the truck completely?
>>
>> The first line of the input will contain a number T (1 ≤ T ≤ 1000)
>> containing the number of test cases. Each line that follows is a separate
>> test case which has exactly 3 space separated integers A B C (1 ≤ A, B, C <
>> 106) which denotes the dimensions of the truck. Additionally, min(A,B,C)
>> < 1000.
>>
>> For each case, output a single line containing the minimum number of items
>> needed to fill the entire truck.
>> *Sample Input:*
>>
>> 5
>> 1 1 1
>> 1 2 3
>> 3 4 5
>> 4 5 6
>> 123 12345 123456
>>
>> *Sample Output:*
>>
>> 1
>> 6
>> 32
>> 29
>> 1951997538
>>
>>
>>  --
>> 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 group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem

2011-03-27 Thread sukhmeet singh
Well this was asked by codechef on it's intern contest...!! Make a recursive
algorithm using divide and conquer paradigm

On Thu, Mar 10, 2011 at 11:20 AM, Akash Mukherjee wrote:

> hi,
>
> can anybody plzz look at this problem. i tried a recursive greedy approach
> but it was too slow i guess
>
>
>  You have a truck that you need to completely fill up with merchandise. You
> have an infinite supply of merchandise of dimension 1x1x1, 2x2x2, 4x4x4,
> 8x8x8, 16x16x16, ..., 2k x 2k x 2k for all k ≥ 0. (Infinite supply of
> merchandise of each dimension too!)
>
> You wish to fill the truck of dimension AxBxC completely using only these
> merchandise. Given A, B & C, what is the smallest number of merchandise you
> will need to fill the truck completely?
>
> The first line of the input will contain a number T (1 ≤ T ≤ 1000)
> containing the number of test cases. Each line that follows is a separate
> test case which has exactly 3 space separated integers A B C (1 ≤ A, B, C <
> 106) which denotes the dimensions of the truck. Additionally, min(A,B,C) <
> 1000.
>
> For each case, output a single line containing the minimum number of items
> needed to fill the entire truck.
> *Sample Input:*
>
> 5
> 1 1 1
> 1 2 3
> 3 4 5
> 4 5 6
> 123 12345 123456
>
> *Sample Output:*
>
> 1
> 6
> 32
> 29
> 1951997538
>
>
>  --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] problem

2011-03-06 Thread adheer chandravanshi
Hello Akash,

I think the approach is simple. You just need to figure out a way to
count all the numbers where 3 follows 1, and those numbers should be
less than N.

And the number of configurations will be N - (count of numbers where 3
follows 1) - 1.
The last subtraction with 1 in the end is for dish number 0.

Eg. In case of N=1113, no. of configurations is 1064 because

The count of numbers where 3 follows 1 is 48. The numbers are as follows:

13, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139,
103, 113, 123, 143. 153, 163, 173, 183,193,
213, 313, 413, 513, 613, 713, 813, 913,
1013, 1023, 1033, 1043, 1053, 1063, 1073, 1083, 1093,
1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1113

So, 1113 - 48 - 1 = 1064  -- The subtraction with 1 denotes
consideration of dish 0.

The numbers above show a pattern that can be used to find the count of
such numbers. But now the task is to find and use an efficient data
structure that can help us achieve that.

I could come up with only this solution now and I know its not an
efficient one but can be considered as a rough approach.(A food for
thought)!



On 3/5/11, Akash Mukherjee  wrote:
> Hi,
>
> I need some help. I am still a nube so if this is too easy, plz don't flame.
> I cannot understand how to approach the problem. Would appreciate any help.
>
> At CodeChef, The Chef can make 10 types of dishes numbered 0 through 9. He
> can however only make dishes one after another. Suppose The Chef made dishes
> 1, 4, 2, 1, 2, 1 on a given day, the number configuration that day would be
> 142121. On a given day, he makes any number of dishes as long as:
>
>1. The number configuration for that day is greater than zero(0) and less
>than or equal to 'N'.
>2. Dish 3 is never made *after* dish 1 has been made.
>3. Dish 0 is never the first dish of the day, to be prepared.
>
>
> How many such unique number configurations exist for a given 'N'?
>
> Examples:
>
>- 1 is a valid configuration
>- 52 is a valid configuration
>- 12 is a valid configuration
>- 32 is a valid configuration
>- 321 is a valid configuration
>- 3231 is a valid configuration
>- 120 is a valid configuration
>- 012 is not a valid configuration
>- 123 is not a valid configuration
>- 32123 is not a valid configuration
>
>  The first line of the input will contain a number T (1 ≤ T ≤ 1000)
> containing the number of test cases. Each line that follows is a separate
> test case which has exactly 1 integer 'N' (1 ≤ N < 1018). For each case,
> output a single line containing the number of configurations possible for
> that 'N'.
> *Sample Input:*
>
> 5
> 10
> 15
> 115
> 1113
> 123456789
>
> *Sample Output:*
>
> 10
> 14
> 112
> 1064
> 92470733
>
> Thanks
> Akash
>
> --
> 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 group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread BALARUKESH SIVARAMAN
In the first post the problem was that m_speed is not public also u should
access m_speed using Scope resolution operator as m_speed is not a member of
B.
class A
{
public:
virtual int speed()=0;
int m_speed;
};
class B:public A
{
public:
int speed()
{
return A::m_speed;
}
};
For ur second question...

int main()
{
A *aptr=new B;
cout

Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread Rohit Saraf
Put the function speed or its declaration inside the class b. Did u forget that?

-- 
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread akshay khatri
It gives this error:
error: prototype for ‘int B::speed()’ does not match any in class ‘B’.

Should I include this in class B(in B.h)
class B:public A
{
public:
virtual int speed(); //wouldn't this override the speed() from A ?
private:
int m_speed();
}

class A (in A.h)is defined as this
class A
{
public:
virtual int speed();
}

Another Question:
If I want to use speed() from class B via an object of class A, how can I do
this ?
(in a third file which has: #include) or is there a better way to do
this ?


On 13 June 2010 12:54, Rohit Saraf  wrote:

> yes.. it should... make sure your virtual function is either public or
> protected but not private.
> and if it doesn't can u tell me the error?
> --
> Rohit Saraf
> Second Year Undergraduate,
> Dept. of Computer Science and Engineering
> IIT Bombay
> http://www.cse.iitb.ac.in/~rohitfeb14
>
>
> On Sun, Jun 13, 2010 at 12:47 PM, akshay khatri  > wrote:
>
>> I meant this:
>> let me explain it like this.
>> I have *virtual int speed()* in class A.(in file A.h)
>> I inherited class in class B(in file B.h) as class B:public A
>> class B have a private member m_speed.
>> Now I have to return m_speed from speed() from class B as I would
>> instantiate an object of class B to use it.
>> So if write my prgram like this:
>>
>> class B:public A
>> {
>> private:
>> int m_speed();
>> }
>>
>> int B::speed()
>> {
>> return m_speed;
>> }
>>
>> would it work ?
>>
>>
>>
>> On 13 June 2010 12:37, Rohit Saraf  wrote:
>>
>>> Make those functions public
>>> And even if M_speed is public of another class, it is still it another
>>> class, you cannot just address it like m_speed in other classes.
>>> Does it help?
>>>
>>> --
>>> Rohit Saraf
>>> Second Year Undergraduate,
>>> Dept. of Computer Science and Engineering
>>> IIT Bombay
>>> http://www.cse.iitb.ac.in/~rohitfeb14
>>>
>>>
>>> On Sun, Jun 13, 2010 at 12:31 PM, akshay khatri <
>>> akshaykhatri...@gmail.com> wrote:
>>>
 Hi

 On 13 June 2010 12:26, Rohit Saraf  wrote:

> M-speed is private and you cannot call it from outside myPlugin.
> (though i did not understand what u wanted to say)
> Can you write ur prob explicitly?
>

 I want to use speed() and direction() defined in myPlugin.h in
 otherPlugin.cpp. How can I use it(syntax) ? If I try to return a variable
 such as m_speed(even if defined in public part of class otherPlugin) , it
 gives an error.



> --
>  Rohit Saraf
> Second Year Undergraduate,
> Dept. of Computer Science and Engineering
> IIT Bombay
> http://www.cse.iitb.ac.in/~rohitfeb14
>
>
>
> On Sun, Jun 13, 2010 at 12:20 PM, akshay khatri <
> akshaykhatri...@gmail.com> wrote:
>
>> I have the following code structure
>> in my file myPlugin.h , i have defined this
>>
>>virtual int speed();
>>
>> and gave a dummy implementation in myPlugin.cpp
>>
>> In another file otherPlugin.h I have included this line:
>>
>>#include 
>>private:
>>int m_speed;
>>
>> also class otherPlugin inherits myPlugin (public scope)
>> I want to redefine speed in otherPlugin.cpp
>> How should I return a value fromspeed() in it ?
>>
>>  int myPlugin::speed()
>>{
>>   return m_speed;
>>}
>> or
>>int otherPlugin::speed()
>>{
>>  return m_speed;
>>}
>>
>> or anything else ?
>>
>> The error I get is that: m_speed was not declared in this scope.
>>
>> --
>> 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
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
> --
> 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
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

  --
 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
 algogeeks+unsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algo

Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread Rohit Saraf
yes.. it should... make sure your virtual function is either public or
protected but not private.
and if it doesn't can u tell me the error?
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14


On Sun, Jun 13, 2010 at 12:47 PM, akshay khatri
wrote:

> I meant this:
> let me explain it like this.
> I have *virtual int speed()* in class A.(in file A.h)
> I inherited class in class B(in file B.h) as class B:public A
> class B have a private member m_speed.
> Now I have to return m_speed from speed() from class B as I would
> instantiate an object of class B to use it.
> So if write my prgram like this:
>
> class B:public A
> {
> private:
> int m_speed();
> }
>
> int B::speed()
> {
> return m_speed;
> }
>
> would it work ?
>
>
>
> On 13 June 2010 12:37, Rohit Saraf  wrote:
>
>> Make those functions public
>> And even if M_speed is public of another class, it is still it another
>> class, you cannot just address it like m_speed in other classes.
>> Does it help?
>>
>> --
>> Rohit Saraf
>> Second Year Undergraduate,
>> Dept. of Computer Science and Engineering
>> IIT Bombay
>> http://www.cse.iitb.ac.in/~rohitfeb14
>>
>>
>> On Sun, Jun 13, 2010 at 12:31 PM, akshay khatri <
>> akshaykhatri...@gmail.com> wrote:
>>
>>> Hi
>>>
>>> On 13 June 2010 12:26, Rohit Saraf  wrote:
>>>
 M-speed is private and you cannot call it from outside myPlugin. (though
 i did not understand what u wanted to say)
 Can you write ur prob explicitly?

>>>
>>> I want to use speed() and direction() defined in myPlugin.h in
>>> otherPlugin.cpp. How can I use it(syntax) ? If I try to return a variable
>>> such as m_speed(even if defined in public part of class otherPlugin) , it
>>> gives an error.
>>>
>>>
>>>
 --
  Rohit Saraf
 Second Year Undergraduate,
 Dept. of Computer Science and Engineering
 IIT Bombay
 http://www.cse.iitb.ac.in/~rohitfeb14



 On Sun, Jun 13, 2010 at 12:20 PM, akshay khatri <
 akshaykhatri...@gmail.com> wrote:

> I have the following code structure
> in my file myPlugin.h , i have defined this
>
>virtual int speed();
>
> and gave a dummy implementation in myPlugin.cpp
>
> In another file otherPlugin.h I have included this line:
>
>#include 
>private:
>int m_speed;
>
> also class otherPlugin inherits myPlugin (public scope)
> I want to redefine speed in otherPlugin.cpp
> How should I return a value fromspeed() in it ?
>
>  int myPlugin::speed()
>{
>   return m_speed;
>}
> or
>int otherPlugin::speed()
>{
>  return m_speed;
>}
>
> or anything else ?
>
> The error I get is that: m_speed was not declared in this scope.
>
> --
> 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
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
 --
 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
 algogeeks+unsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>  --
>>> 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
>>> algogeeks+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>> --
>> 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
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Group

Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread akshay khatri
I meant this:
let me explain it like this.
I have *virtual int speed()* in class A.(in file A.h)
I inherited class in class B(in file B.h) as class B:public A
class B have a private member m_speed.
Now I have to return m_speed from speed() from class B as I would
instantiate an object of class B to use it.
So if write my prgram like this:

class B:public A
{
private:
int m_speed();
}

int B::speed()
{
return m_speed;
}

would it work ?



On 13 June 2010 12:37, Rohit Saraf  wrote:

> Make those functions public
> And even if M_speed is public of another class, it is still it another
> class, you cannot just address it like m_speed in other classes.
> Does it help?
>
> --
> Rohit Saraf
> Second Year Undergraduate,
> Dept. of Computer Science and Engineering
> IIT Bombay
> http://www.cse.iitb.ac.in/~rohitfeb14
>
>
> On Sun, Jun 13, 2010 at 12:31 PM, akshay khatri  > wrote:
>
>> Hi
>>
>> On 13 June 2010 12:26, Rohit Saraf  wrote:
>>
>>> M-speed is private and you cannot call it from outside myPlugin. (though
>>> i did not understand what u wanted to say)
>>> Can you write ur prob explicitly?
>>>
>>
>> I want to use speed() and direction() defined in myPlugin.h in
>> otherPlugin.cpp. How can I use it(syntax) ? If I try to return a variable
>> such as m_speed(even if defined in public part of class otherPlugin) , it
>> gives an error.
>>
>>
>>
>>> --
>>>  Rohit Saraf
>>> Second Year Undergraduate,
>>> Dept. of Computer Science and Engineering
>>> IIT Bombay
>>> http://www.cse.iitb.ac.in/~rohitfeb14
>>>
>>>
>>>
>>> On Sun, Jun 13, 2010 at 12:20 PM, akshay khatri <
>>> akshaykhatri...@gmail.com> wrote:
>>>
 I have the following code structure
 in my file myPlugin.h , i have defined this

virtual int speed();

 and gave a dummy implementation in myPlugin.cpp

 In another file otherPlugin.h I have included this line:

#include 
private:
int m_speed;

 also class otherPlugin inherits myPlugin (public scope)
 I want to redefine speed in otherPlugin.cpp
 How should I return a value fromspeed() in it ?

  int myPlugin::speed()
{
   return m_speed;
}
 or
int otherPlugin::speed()
{
  return m_speed;
}

 or anything else ?

 The error I get is that: m_speed was not declared in this scope.

 --
 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
 algogeeks+unsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


>>> --
>>> 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
>>> algogeeks+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> 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
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> 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
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread Rohit Saraf
Make those functions public
And even if M_speed is public of another class, it is still it another
class, you cannot just address it like m_speed in other classes.
Does it help?
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14


On Sun, Jun 13, 2010 at 12:31 PM, akshay khatri
wrote:

> Hi
>
> On 13 June 2010 12:26, Rohit Saraf  wrote:
>
>> M-speed is private and you cannot call it from outside myPlugin. (though i
>> did not understand what u wanted to say)
>> Can you write ur prob explicitly?
>>
>
> I want to use speed() and direction() defined in myPlugin.h in
> otherPlugin.cpp. How can I use it(syntax) ? If I try to return a variable
> such as m_speed(even if defined in public part of class otherPlugin) , it
> gives an error.
>
>
>
>> --
>>  Rohit Saraf
>> Second Year Undergraduate,
>> Dept. of Computer Science and Engineering
>> IIT Bombay
>> http://www.cse.iitb.ac.in/~rohitfeb14
>>
>>
>>
>> On Sun, Jun 13, 2010 at 12:20 PM, akshay khatri <
>> akshaykhatri...@gmail.com> wrote:
>>
>>> I have the following code structure
>>> in my file myPlugin.h , i have defined this
>>>
>>>virtual int speed();
>>>
>>> and gave a dummy implementation in myPlugin.cpp
>>>
>>> In another file otherPlugin.h I have included this line:
>>>
>>>#include 
>>>private:
>>>int m_speed;
>>>
>>> also class otherPlugin inherits myPlugin (public scope)
>>> I want to redefine speed in otherPlugin.cpp
>>> How should I return a value fromspeed() in it ?
>>>
>>>  int myPlugin::speed()
>>>{
>>>   return m_speed;
>>>}
>>> or
>>>int otherPlugin::speed()
>>>{
>>>  return m_speed;
>>>}
>>>
>>> or anything else ?
>>>
>>> The error I get is that: m_speed was not declared in this scope.
>>>
>>> --
>>> 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
>>> algogeeks+unsubscr...@googlegroups.com
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>> --
>> 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
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> 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
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem with Virtual Function

2010-06-13 Thread akshay khatri
Hi

On 13 June 2010 12:26, Rohit Saraf  wrote:

> M-speed is private and you cannot call it from outside myPlugin. (though i
> did not understand what u wanted to say)
> Can you write ur prob explicitly?
>

I want to use speed() and direction() defined in myPlugin.h in
otherPlugin.cpp. How can I use it(syntax) ? If I try to return a variable
such as m_speed(even if defined in public part of class otherPlugin) , it
gives an error.



> --
> Rohit Saraf
> Second Year Undergraduate,
> Dept. of Computer Science and Engineering
> IIT Bombay
> http://www.cse.iitb.ac.in/~rohitfeb14
>
>
>
> On Sun, Jun 13, 2010 at 12:20 PM, akshay khatri  > wrote:
>
>> I have the following code structure
>> in my file myPlugin.h , i have defined this
>>
>>virtual int speed();
>>
>> and gave a dummy implementation in myPlugin.cpp
>>
>> In another file otherPlugin.h I have included this line:
>>
>>#include 
>>private:
>>int m_speed;
>>
>> also class otherPlugin inherits myPlugin (public scope)
>> I want to redefine speed in otherPlugin.cpp
>> How should I return a value fromspeed() in it ?
>>
>>  int myPlugin::speed()
>>{
>>   return m_speed;
>>}
>> or
>>int otherPlugin::speed()
>>{
>>  return m_speed;
>>}
>>
>> or anything else ?
>>
>> The error I get is that: m_speed was not declared in this scope.
>>
>> --
>> 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
>> algogeeks+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
> --
> 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
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Problem with Virtual Function

2010-06-12 Thread Rohit Saraf
M-speed is private and you cannot call it from outside myPlugin. (though i
did not understand what u wanted to say)
Can you write ur prob explicitly?
--
Rohit Saraf
Second Year Undergraduate,
Dept. of Computer Science and Engineering
IIT Bombay
http://www.cse.iitb.ac.in/~rohitfeb14


On Sun, Jun 13, 2010 at 12:20 PM, akshay khatri
wrote:

> I have the following code structure
> in my file myPlugin.h , i have defined this
>
>virtual int speed();
>
> and gave a dummy implementation in myPlugin.cpp
>
> In another file otherPlugin.h I have included this line:
>
>#include 
>private:
>int m_speed;
>
> also class otherPlugin inherits myPlugin (public scope)
> I want to redefine speed in otherPlugin.cpp
> How should I return a value fromspeed() in it ?
>
>  int myPlugin::speed()
>{
>   return m_speed;
>}
> or
>int otherPlugin::speed()
>{
>  return m_speed;
>}
>
> or anything else ?
>
> The error I get is that: m_speed was not declared in this scope.
>
> --
> 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
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.