[algogeeks] INMOBI

2011-08-22 Thread priya ramesh
guys plz post inmobi's recruitment experience!

-- 
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] Re: Given an array, find out whether there exists a triplet which can form sides of triangle.

2011-08-22 Thread Raghavan
A[0] = 10A[1] = 2A[2] =  5
A[3] =  1A[4] = 8A[5] = 20

Triplet  10,5,8 is triangular.

Dave, do your solution do it?

On Tue, Aug 23, 2011 at 11:55 AM, Amol Sharma wrote:

> +1 for dave's solution.i will also do the same
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>   
> 
>
>
>
>
>
> On Tue, Aug 23, 2011 at 11:25 AM, Dave  wrote:
>
>> @Saurabh: If you can use O(n) extra space, make a copy of the array
>> and sort it: O(n log n). Then, if there is a solution, there will be a
>> solution of the form (a[i], a[i+1], a[i+2]), where 0 <=  i < n-2,
>> which can be checked with a simple for loop: O(n). Thus, the
>> complexity is O(n log n).
>>
>> Dave
>>
>> On Aug 23, 12:04 am, saurabh agrawal  wrote:
>> > Given an array, find out whether there exists a triplet which can form
>> sides
>> > of triangle.
>> > You are not allowed to modify the array.
>> >
>> > PLease dont give o(n^3) solution
>> >
>> > there exists a solution with nlog(n) i think
>>
>> --
>> 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.
>



-- 
Thanks and Regards,
Raghavan KL

-- 
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] Re: Given an array, find out whether there exists a triplet which can form sides of triangle.

2011-08-22 Thread Amol Sharma
+1 for dave's solution.i will also do the same
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
 






On Tue, Aug 23, 2011 at 11:25 AM, Dave  wrote:

> @Saurabh: If you can use O(n) extra space, make a copy of the array
> and sort it: O(n log n). Then, if there is a solution, there will be a
> solution of the form (a[i], a[i+1], a[i+2]), where 0 <=  i < n-2,
> which can be checked with a simple for loop: O(n). Thus, the
> complexity is O(n log n).
>
> Dave
>
> On Aug 23, 12:04 am, saurabh agrawal  wrote:
> > Given an array, find out whether there exists a triplet which can form
> sides
> > of triangle.
> > You are not allowed to modify the array.
> >
> > PLease dont give o(n^3) solution
> >
> > there exists a solution with nlog(n) i think
>
> --
> 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] Re: C-question

2011-08-22 Thread Vijay Khandar
Thanks ...got it..

On Tue, Aug 23, 2011 at 11:30 AM, binayakranjan das  wrote:

> In this case = has right to left associativity  and as such < has no
> associativity.but,the parsing occurs from left to right.so first (x is checked which evaluates to 0 then (0 that is what is assigned to i.
>
> On Aug 23, 10:33 am, Vijay Khandar  wrote:
> > main()
> > {
> > int x=10,y=10,z=5;
> > int i=x > pf("\n%d",i);
> >
> > }
> >
> > o/p is 1 .pls any1 explain me hw is it printing?
>
> --
> 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] C-question

2011-08-22 Thread Vijay Khandar
Thank,,,Now got it.

On Tue, Aug 23, 2011 at 11:22 AM, nagarajan  wrote:

> Hi Vijay,
>
> i = 10 < 10 < 5
>
> => 0 < 5
>
> => 1
>
> On Tue, Aug 23, 2011 at 11:03 AM, Vijay Khandar 
> wrote:
>
>> main()
>> {
>> int x=10,y=10,z=5;
>> int i=x> pf("\n%d",i);
>>
>> }
>> o/p is 1 .pls any1 explain me hw is it printing?
>>
>> --
>> 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.
>>
>>
>
>
> --
>
>
> Nagarajan S
>
>  --
> 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.



[algogeeks] Re: Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)

2011-08-22 Thread Dave
Given today's pipelined arithmetic units and optimizing compilers,
Horner's rule may not be the fastest way to evaluate the polynomial,
because it only executes one addition or multiplication at a time, in
sequential order. Rearranging the polynomial may give more
opportunities for parallelism, and thus speed up execution.

For example, the polynomial y = a + b*x + c*x^2 + d*x^3 + e*x^4 +
f*x^5, where ^ represents "to the power," might be evaluated faster if
it is written

t = x * x;
y = (a + t * (c + e * t)) + x * (b + t * (d + f * t));

because the two expressions in the outer parentheses may be evaluated
simultaneously.

Dave

On Aug 22, 11:58 pm, SAMM  wrote:
> horner's  rule
>
> On 8/23/11, saurabh agrawal  wrote:
>
> > Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)
>
> > --
> > 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.



[algogeeks] Re: C-question

2011-08-22 Thread binayakranjan das
In this case = has right to left associativity  and as such < has no
associativity.but,the parsing occurs from left to right.so first (x wrote:
> main()
> {
> int x=10,y=10,z=5;
> int i=x pf("\n%d",i);
>
> }
>
> o/p is 1 .pls any1 explain me hw is it printing?

-- 
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.



[algogeeks] Re: Given an array, find out whether there exists a triplet which can form sides of triangle.

2011-08-22 Thread Dave
@Saurabh: If you can use O(n) extra space, make a copy of the array
and sort it: O(n log n). Then, if there is a solution, there will be a
solution of the form (a[i], a[i+1], a[i+2]), where 0 <=  i < n-2,
which can be checked with a simple for loop: O(n). Thus, the
complexity is O(n log n).

Dave

On Aug 23, 12:04 am, saurabh agrawal  wrote:
> Given an array, find out whether there exists a triplet which can form sides
> of triangle.
> You are not allowed to modify the array.
>
> PLease dont give o(n^3) solution
>
> there exists a solution with nlog(n) i think

-- 
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] C-question

2011-08-22 Thread nagarajan
Hi Vijay,

i = 10 < 10 < 5

=> 0 < 5

=> 1

On Tue, Aug 23, 2011 at 11:03 AM, Vijay Khandar wrote:

> main()
> {
> int x=10,y=10,z=5;
> int i=x pf("\n%d",i);
>
> }
> o/p is 1 .pls any1 explain me hw is it printing?
>
> --
> 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.
>
>


-- 


Nagarajan S

-- 
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] Re: C dot

2011-08-22 Thread siddharam suresh
how much they are offering ?
Thank you,
Siddharam


On Tue, Aug 23, 2011 at 11:12 AM, ranjith kumar
wrote:

>
>
> They shortlist candidates based on cgpa and select the highest cgpa
> candidate.
>
> --
> 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] Re: C dot

2011-08-22 Thread ranjith kumar
They shortlist candidates based on cgpa and select the highest cgpa
candidate.

-- 
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.



[algogeeks] C-question

2011-08-22 Thread Vijay Khandar
main()
{
int x=10,y=10,z=5;
int i=xhttp://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Given an array, find out whether there exists a triplet which can form sides of triangle.

2011-08-22 Thread saurabh agrawal
Given an array, find out whether there exists a triplet which can form sides
of triangle.
You are not allowed to modify the array.

PLease dont give o(n^3) solution

there exists a solution with nlog(n) i think

-- 
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] Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)

2011-08-22 Thread SAMM
horner's  rule

On 8/23/11, saurabh agrawal  wrote:
> Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)
>
> --
> 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] Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)

2011-08-22 Thread aditya kumar
(x(x(b+x(c+dx

On Tue, Aug 23, 2011 at 10:21 AM, saurabh agrawal wrote:

> Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)
>
> --
> 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.



[algogeeks] Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)

2011-08-22 Thread saurabh agrawal
Compute a+bx2+cx3+dx4+... efficiently (a,b,c...given)

-- 
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] Re: Concept of Pointer

2011-08-22 Thread Sanjay Rajpal
+1 to ADITI.


Sanju
:)



On Mon, Aug 22, 2011 at 2:51 PM, Ashish Sachdeva  wrote:

> for the 1st printf i hv this explanation:
> precedence of ++ is greater then *   ... but associativity of both of
> them is right to left...
> thats why dereferenced takes place 1st and then the pointer is
> incremented...
>
> rest is fine...
>
> correct me if i m wrong...
>
> On Aug 22, 3:47 pm, aditi garg  wrote:
> > in frst printf we acess *s and s is incremented later...so it prints A bt
> at
> > the same time s points to B now...
> > In 2nd printf s is incremented frst and thn dereferencd...after
> incrementing
> > it points to C and whn we dereference it we get C
> > in the third printf *s=C whn we increment this we get D
> > so the ans wud be ACD...
> > I hope its  clear
> >
> >
> >
> >
> >
> >
> >
> >
> >
>  > On Mon, Aug 22, 2011 at 4:03 PM, MANNU  wrote:
> > > main()
> > > {
> > > char ch[]="ABCD";
> > > char *s;
> > > s=ch;
> > > printf("%c",*s++);
> > > printf("%c",*++s);
> > > printf("%c",++*s);
> > > }
> >
> > > Can anyone plz tell me the concept behind output??
> >
> > > --
> > > 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.
> >
> > --
> > Aditi Garg
> > Undergraduate Student
> > Electronics & Communication Divison
> > NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> > Sector 3, Dwarka
> > New 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.
>
>

-- 
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] C output

2011-08-22 Thread sukran dhawan
its 10
On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:

> #include
>
> #define max(a,b) (a>b?a:b)
>
>
> int main()
> {
>
>  int j=max(3+2,2+8);
>  printf("%d",j);
>
>return 0;
> }
>
>why this program show output as 9 ? please help me
>
> --
> 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] Re: Search an array of unknown length

2011-08-22 Thread saurabh singh
Just a small code to back up my point...
http://www.ideone.com/woRiT

On Tue, Aug 23, 2011 at 7:33 AM, saurabh singh  wrote:

> That would take all the fun awaywhat if you are given only the address
> of the array?This wont work in that case
>
>
> On Mon, Aug 22, 2011 at 10:39 PM, asdqwe  wrote:
>
>> If i am not wrong, the only possible solution can be
>> len=sizeof(arr)/sizeof(arr[0])
>> i.e. find the length from the array itself.
>>
>>
>> On Aug 22, 9:01 pm, saurabh singh  wrote:
>> > @dave or anyone??? response please
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Sun, Aug 21, 2011 at 12:43 PM, saurabh singh 
>> wrote:
>> > > kkk...not sure
>> > > assume no number is greater than 1000(I mentioned There has to be some
>> > > additional constraints to make the problem solvable)
>> > > Now check 1st element if not the desired element keep multiplying with
>> 2
>> > > the previous range till either one of these condition is satisfied
>> > > *1.An exception is caught*
>> > > *2.Number greater than 1000 occurs.*
>> > > suppose this happens for *1024 *for the given example.
>> > > then we will check out for (512+1024)/2 th element for the above
>> condition.
>> > > If true than again branch like binary search.This way can element
>> which on
>> > > left side doesn't gives any exception and maintains the constraints
>> while on
>> > > the right it violates the same.So we may land up with the desired
>> index and
>> > > can then perform binary search...
>> >
>> > > PS:There are lots of assumption in this approach and the more I write
>> the
>> > > more I get convinced that its a plain stupid idea...
>> >
>> > > --
>> > > Saurabh Singh
>> > > B.Tech (Computer Science)
>> > > MNNIT ALLAHABAD
>> >
>> > --
>> > Saurabh Singh
>> > B.Tech (Computer Science)
>> > 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.
>>
>>
>
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD
>
>
>


-- 
Saurabh Singh
B.Tech (Computer Science)
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] Re: Search an array of unknown length

2011-08-22 Thread saurabh singh
That would take all the fun awaywhat if you are given only the address
of the array?This wont work in that case

On Mon, Aug 22, 2011 at 10:39 PM, asdqwe  wrote:

> If i am not wrong, the only possible solution can be
> len=sizeof(arr)/sizeof(arr[0])
> i.e. find the length from the array itself.
>
>
> On Aug 22, 9:01 pm, saurabh singh  wrote:
> > @dave or anyone??? response please
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Sun, Aug 21, 2011 at 12:43 PM, saurabh singh 
> wrote:
> > > kkk...not sure
> > > assume no number is greater than 1000(I mentioned There has to be some
> > > additional constraints to make the problem solvable)
> > > Now check 1st element if not the desired element keep multiplying with
> 2
> > > the previous range till either one of these condition is satisfied
> > > *1.An exception is caught*
> > > *2.Number greater than 1000 occurs.*
> > > suppose this happens for *1024 *for the given example.
> > > then we will check out for (512+1024)/2 th element for the above
> condition.
> > > If true than again branch like binary search.This way can element which
> on
> > > left side doesn't gives any exception and maintains the constraints
> while on
> > > the right it violates the same.So we may land up with the desired index
> and
> > > can then perform binary search...
> >
> > > PS:There are lots of assumption in this approach and the more I write
> the
> > > more I get convinced that its a plain stupid idea...
> >
> > > --
> > > Saurabh Singh
> > > B.Tech (Computer Science)
> > > MNNIT ALLAHABAD
> >
> > --
> > Saurabh Singh
> > B.Tech (Computer Science)
> > 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.
>
>


-- 
Saurabh Singh
B.Tech (Computer Science)
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.



[algogeeks] "Strange Billboard" of Judge Spoj

2011-08-22 Thread Victor Manuel Grijalva Altamirano
I am trying the problem http://www.spoj.pl/problems/CERC07B/  and
http://www.spoj.pl/problems/DFLOOR/  but i don´t have idea how to solve,
anyone can help me???

-- 
Victor Manuel Grijalva Altamirano
Universidad Tecnologica de La Mixteca

-- 
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] Re: print all paths which sum up to a value.

2011-08-22 Thread Anil Arya
I'm very sry dude..It was not me as any intelligent person can
understand.

On Tue, Aug 23, 2011 at 3:49 AM, Anil Arya  wrote:

> fuck
>
>
> On Mon, Aug 22, 2011 at 12:52 AM, Dhriti Khanna wrote:
>
>> void search_path( root , int i )
>> {
>>static char str[100];
>>if(root == null)
>>  return;
>>
>>if( i == 0 )
>>   str[i] = root->data;
>>
>>else  str[i] = str[i-1] + root->data; // Maintaining the cumulative
>> sum of all the sums till now.
>>
>>if ( str[i] == value )
>>{
>>   // A path has been found. As the cumulative sum till now is
>> equal to the value.
>>   print_path(str , i , 0);
>>}
>>
>> else
>> {
>> // Check for an embedded path. As u said a path may not
>> start from root.
>> for( int j=0 ; j> {
>>if ( (str[i] - str[j]) == value )
>>{
>>   print_path(str , i , 0);
>>   break;
>>}
>> }
>> } //else
>>
>>  search_path(root->left , i+1);
>>  search_path(root->right , i+1);
>> }
>>
>> void print_path(char str[] , int i , int sum) // just printing the path in
>> top to down manner.. Using recursion.
>> {
>>   int temp = str[i] - str[i-1] ;
>>   sum = sum + temp;
>>   if( sum == value )
>>   {
>> cout << temp;
>> return;
>>   }
>>
>>   print_path( str , i-1 , sum);
>>   cout << temp;
>> }
>>
>> --
>> 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.
>>
>
>
>
> --
> *Anil  Arya,
> Computer Science *
> *Motilal Nehru National Institute of Technology,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.
>



-- 
Anil Kumar Arya
2nd  year student
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] Re: print all paths which sum up to a value.

2011-08-22 Thread Anil Arya
fuck

On Mon, Aug 22, 2011 at 12:52 AM, Dhriti Khanna wrote:

> void search_path( root , int i )
> {
>static char str[100];
>if(root == null)
>  return;
>
>if( i == 0 )
>   str[i] = root->data;
>
>else  str[i] = str[i-1] + root->data; // Maintaining the cumulative
> sum of all the sums till now.
>
>if ( str[i] == value )
>{
>   // A path has been found. As the cumulative sum till now is
> equal to the value.
>   print_path(str , i , 0);
>}
>
> else
> {
> // Check for an embedded path. As u said a path may not
> start from root.
> for( int j=0 ; j {
>if ( (str[i] - str[j]) == value )
>{
>   print_path(str , i , 0);
>   break;
>}
> }
> } //else
>
>  search_path(root->left , i+1);
>  search_path(root->right , i+1);
> }
>
> void print_path(char str[] , int i , int sum) // just printing the path in
> top to down manner.. Using recursion.
> {
>   int temp = str[i] - str[i-1] ;
>   sum = sum + temp;
>   if( sum == value )
>   {
> cout << temp;
> return;
>   }
>
>   print_path( str , i-1 , sum);
>   cout << temp;
> }
>
> --
> 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.
>



-- 
*Anil  Arya,
Computer Science *
*Motilal Nehru National Institute of Technology,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] thanx...

2011-08-22 Thread Anil Arya
f

2011/8/22 A for ♥ღAakasHღ♥ 

>
> it was done in 4 rounds
>>
>> written
>> 1. aptitude: containing data interpretation and logical reasoning
>>
>> 2.technical: 20 ques from c/c++ basicaly frm pointers..., 5 ques from OS
>> and 5 ques from ds..
>>
>> interview
>> 3.technical: question frm c basic and code related to ds
>>
>
> and if u have done some kind of project,they'll ask from the project max
> time..:)
>
>
>>
>> 4.HR: simple questions like "tell me about urself, ur +ve nd -ve points
>> etc"
>
>
>> i hope these info may help som1
>>
>>
>
> *Aakash Abhishek Pradhan**
> **MCA Final Year,
> NIT 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.
>



-- 
*Anil  Arya,
Computer Science *
*Motilal Nehru National Institute of Technology,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] Microsoft :)

2011-08-22 Thread Anil Arya
@harshal congo dude.:

On Mon, Aug 22, 2011 at 10:07 PM, ghsjgl k  wrote:

> @Harshal
>
>
> congratulations
>
> can u tell me if u know any other help full links regarding placements
>
>
>
> On Mon, Aug 22, 2011 at 12:39 AM, Ankur Garg  wrote:
>
>> @Harsha
>>
>> Bro I am unable to read ur blog ..It says this
>>
>> http://harshal-theone.blogspot.com/
>>
>> It doesn't look like you have been invited to read this blog. If you think
>> this is a mistake, you might want to contact the blog author and request an
>> invitation.
>>
>> Is there anything I need to do to view this blog of urs man !
>>
>> Regards
>>
>> Ankur
>>
>> On Sun, Aug 21, 2011 at 1:54 PM, Vijay Khandar 
>> wrote:
>>
>>> Congrates Harshal!!
>>>
>>> On Sat, Aug 6, 2011 at 12:15 PM, Harshal  wrote:
>>>
 Algogeeks is really awesome and very informative. I got a job in
 microsoft, and this group has played vital role in building concepts. So I
 just want to thank this group and the people here..
 keep it up guys! All the best :)


 --
 Best Regards,
 Harshal Choudhary
 7th Semester, CSE Dept.
 NIT Surathkal, India.
 "The road to knowledge runs through the land of confusion."

 Mobile: +91 9844667142
 Email : hc4...@gmail.com
   
 
    
 


  --
 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.
>



-- 
*Anil  Arya,
Computer Science *
*Motilal Nehru National Institute of Technology,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.



[algogeeks] Re: Concept of Pointer

2011-08-22 Thread Ashish Sachdeva
for the 1st printf i hv this explanation:
precedence of ++ is greater then *   ... but associativity of both of
them is right to left...
thats why dereferenced takes place 1st and then the pointer is
incremented...

rest is fine...

correct me if i m wrong...

On Aug 22, 3:47 pm, aditi garg  wrote:
> in frst printf we acess *s and s is incremented later...so it prints A bt at
> the same time s points to B now...
> In 2nd printf s is incremented frst and thn dereferencd...after incrementing
> it points to C and whn we dereference it we get C
> in the third printf *s=C whn we increment this we get D
> so the ans wud be ACD...
> I hope its  clear
>
>
>
>
>
>
>
>
>
> On Mon, Aug 22, 2011 at 4:03 PM, MANNU  wrote:
> > main()
> > {
> > char ch[]="ABCD";
> > char *s;
> > s=ch;
> > printf("%c",*s++);
> > printf("%c",*++s);
> > printf("%c",++*s);
> > }
>
> > Can anyone plz tell me the concept behind output??
>
> > --
> > 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.
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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.



[algogeeks] Re: Longest palindrome

2011-08-22 Thread icy`
sorry, I meant to joke about  (0.5 * n^2)  ;P

On Aug 22, 4:46 pm, "icy`"  wrote:
> brute force...    http://codepad.org/D07BNo91    There are some
> checks to  help reduce O(n^2),  so I want to say..  O(1.5n) ?    =)
>
> #output for str = 'abaccddccefe'
> #ccddcc 6
>
> #for str = 'abraxyzarba'
> #a 1
>
> On Aug 22, 1:09 pm, uma  wrote:
>
>
>
>
>
>
>
> > can yo tell exactly , how the suffix tree is used for finding
> > palindromes?
>
> > On Aug 22, 3:58 am, WgpShashank  wrote:
>
> > > Hey Geeks I think question can be solved by many ways . some of the
> > > algorithms are i have implemented & aware of are ->
>
> > > 1st. Algo
> > >  Generate all palindromes (even & odd length ) of given string while keep
> > > tracking of their length in last just compare max (evenlength_palindrome ,
> > > oddlength_palindrome) .
> > >  Time Complexity O(N^2) where N is length of String
>
> > > 2nd . Algo. For Those Who are just saying Use DP :)
> > >   Find The LCS(Longest Common Sub-sequence of String (say s1)& reverse of
> > > String (say s2) ) It Involves  
> > >   DP to solve efficiently but guaranteed optimal solution
> > >   Time Complexity O(N^2) where N is length of String
> > >   Space  Complexity O(N^2)  for table
>
> > > 3rd. Use Suffix Tree ( Need to Work On It)  basic idea is to build the
> > > suffix tree of string & reverse string check no every node where suffix
> > > belongs to , the deepest common node will us longest palindrome in given
> > > string.
>
> > > Correct me if i missed something ?
>
> > > Thanks
> > > Shashank Mani
> > > Computer Science
> > > Birla Institute of Technology ,Mesra

-- 
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.



[algogeeks] Re: Longest palindrome

2011-08-22 Thread icy`
brute force...http://codepad.org/D07BNo91 There are some
checks to  help reduce O(n^2),  so I want to say..  O(1.5n) ?=)

#output for str = 'abaccddccefe'
#ccddcc 6

#for str = 'abraxyzarba'
#a 1


On Aug 22, 1:09 pm, uma  wrote:
> can yo tell exactly , how the suffix tree is used for finding
> palindromes?
>
> On Aug 22, 3:58 am, WgpShashank  wrote:
>
>
>
>
>
>
>
> > Hey Geeks I think question can be solved by many ways . some of the
> > algorithms are i have implemented & aware of are ->
>
> > 1st. Algo
> >  Generate all palindromes (even & odd length ) of given string while keep
> > tracking of their length in last just compare max (evenlength_palindrome ,
> > oddlength_palindrome) .
> >  Time Complexity O(N^2) where N is length of String
>
> > 2nd . Algo. For Those Who are just saying Use DP :)
> >   Find The LCS(Longest Common Sub-sequence of String (say s1)& reverse of
> > String (say s2) ) It Involves  
> >   DP to solve efficiently but guaranteed optimal solution
> >   Time Complexity O(N^2) where N is length of String
> >   Space  Complexity O(N^2)  for table
>
> > 3rd. Use Suffix Tree ( Need to Work On It)  basic idea is to build the
> > suffix tree of string & reverse string check no every node where suffix
> > belongs to , the deepest common node will us longest palindrome in given
> > string.
>
> > Correct me if i missed something ?
>
> > Thanks
> > Shashank Mani
> > Computer Science
> > Birla Institute of Technology ,Mesra

-- 
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] C output

2011-08-22 Thread code pool
10 as 3+2>2+8?3+2:2+8  5>10?5:10   ' + ' has more precedence then ?: as well
as > s o/p is 10..

correct me if i am wrong.

On Tue, Aug 23, 2011 at 12:50 AM, gmagog...@gmail.com
wrote:

> output is 10 using gcc 4.5.2
>
> Yanan Cao
>
>
>
> On Mon, Aug 22, 2011 at 2:18 PM, sagar pareek wrote:
>
>> Yeah its o/p is 10 :)
>>
>>
>> On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg wrote:
>>
>>> its output is
>>>
>>> 10
>>>
>>>
>>> On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:
>>>
 #include

 #define max(a,b) (a>b?a:b)


 int main()
 {

  int j=max(3+2,2+8);
  printf("%d",j);

return 0;
 }

why this program show output as 9 ? please help me

 --
 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.D.I.T
>>>
>>> Sent by Nokia OVI (c)
>>>
>>>  --
>>> 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.
>>
>
>  --
> 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] constructor ques

2011-08-22 Thread JAIDEV YADAV
yeah D first ...

On Mon, Aug 22, 2011 at 10:53 PM, sagar pareek wrote:

> +1 coder
>
>
> On Mon, Aug 22, 2011 at 9:41 PM, sukran dhawan wrote:
>
>> hey sorry didnt notice virtual :)
>>
>>
>> On Mon, Aug 22, 2011 at 9:38 PM, coder dumca wrote:
>>
>>> @sukran ur r wrong man
>>> the construdor of virtual base class are called first  otherwise it is
>>> from left to right
>>> so the correct order is
>>> D A B C Z
>>> On Mon, Aug 22, 2011 at 8:25 AM, Sanjay Rajpal  wrote:
>>>
  agree with sukran.


 Sanju
 :)



 On Mon, Aug 22, 2011 at 8:20 AM, sukran dhawan 
 wrote:

> its left to right always !
>
>
> On Mon, Aug 22, 2011 at 8:49 PM, Sanjay Rajpal wrote:
>
>>  A
>> B
>> C
>> D
>>
>>
>> Sanju
>> :)
>>
>>
>>
>> On Mon, Aug 22, 2011 at 8:17 AM, sivaviknesh s <
>> sivavikne...@gmail.com> wrote:
>>
>>> you have 4 classes A,B,C,D and class Z is derived from all these
>>> classes
>>> using
>>> Class Z: public A,private B,Protected C, Virtual D
>>> What is the order of constructor call?
>>>
>>> ...plz reason out also
>>>
>>> --
>>> Regards,
>>> $iva
>>>
>>> --
>>> 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.

>>>
>>>  --
>>> 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
> 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.
>



-- 
JaiDev Yadav
(National Yoga Champion)
Computer Engg. Dept.
National Institute of Technology
Kurukshetra,Haryana

-- 
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.



[algogeeks] shortest path

2011-08-22 Thread cegprakash
i'm trying to solve this spoj problem SHPATH / TSHPATH
i'm sure that my algorithm is correct
i'm getting Runtime error (SIGABRT) again and again

i've posted my code here http://ideone.com/O1qu3

help pls..

-- 
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] Re: question on fork()

2011-08-22 Thread gmagog...@gmail.com
Infinite times
Yanan Cao



On Mon, Aug 22, 2011 at 2:43 PM, Don  wrote:

> // DO NOT RUN THIS! By inspection, how many times will it print "Hello
> world"?
> // If you find out by running it, that is cheating. Don't do it!
> int main()
> {
>  int i=0, j=0;
>  for(i = 0; i*j < 20; ++i)
>  {
>if (fork() > 0) ++j;
>else i = j =  0;
>printf("Hello world\n");
>  }
>  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] Re: question on fork()

2011-08-22 Thread gmagog...@gmail.com
I am getting 6 red and 8 green as expected using the original code
Yanan Cao



On Mon, Aug 22, 2011 at 2:38 PM, Yasir  wrote:

> Surprisingly, if I comment the last if condition ( which is AFTER red()
> call ), it is printing red only 6 times as expected..
> http://ideone.com/XMHzC
>
>  main()
> {
>   fork();
>   int color=fork();
>   if(color==0)
>   fork();
>   red();
> //if(color==0)
> //   fork();
>   green();
>   getch();
>
> }
>
> --
> 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/-/1o7KQKelcswJ.
>
> 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.



[algogeeks] Re: question on fork()

2011-08-22 Thread Don
// DO NOT RUN THIS! By inspection, how many times will it print "Hello
world"?
// If you find out by running it, that is cheating. Don't do it!
int main()
{
  int i=0, j=0;
  for(i = 0; i*j < 20; ++i)
  {
if (fork() > 0) ++j;
else i = j =  0;
printf("Hello world\n");
  }
  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.



[algogeeks] Re: question on fork()

2011-08-22 Thread Yasir
Surprisingly, if I comment the last if condition ( which is AFTER red() call 
), it is printing red only 6 times as expected..  http://ideone.com/XMHzC

 main()
{
  fork();
  int color=fork();
  if(color==0)
  fork();
  red();
//if(color==0)
//   fork();
  green();
  getch();
  
}

-- 
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/-/1o7KQKelcswJ.
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] Re:

2011-08-22 Thread Sanjay Rajpal
It might give a run time error because q contains a garbage value, when we
do q+j, this address may belong to some other process. Since memory of a
process is protected from others, it may give a run time error.


Sanju
:)



On Mon, Aug 22, 2011 at 11:56 AM, sagar pareek wrote:

> it gives runtime error...
> coz u have to allocate memory to *q
>
> On Tue, Aug 23, 2011 at 12:02 AM, Abhishek 
> wrote:
>
>> i think.. it will not produce error, but o/p 'may' be garbage values.
>> since the memory locations adjacent to *q will be overwritten.
>>
>> --
>> 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/-/X1CZmpVjhxEJ.
>>
>> 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.
>

-- 
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] Re:

2011-08-22 Thread code pool
@ahishek i was thinking the same and even from one pdf i have read this but
it s showing error..confused..

On Tue, Aug 23, 2011 at 12:26 AM, sagar pareek wrote:

> it gives runtime error...
> coz u have to allocate memory to *q
>
> On Tue, Aug 23, 2011 at 12:02 AM, Abhishek 
> wrote:
>
>> i think.. it will not produce error, but o/p 'may' be garbage values.
>> since the memory locations adjacent to *q will be overwritten.
>>
>>  --
>> 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/-/X1CZmpVjhxEJ.
>>
>> 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.
>

-- 
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] Accessing private members of Derived class ?

2011-08-22 Thread Sanjay Rajpal
Stephen Prata C++ Primer Plus .


Sanju
:)



On Mon, Aug 22, 2011 at 9:08 AM, sukran dhawan wrote:

> which is the best book for c++ ? complete reference or prata or c++ by
> stroustroup?
>
>  On Mon, Aug 22, 2011 at 11:40 AM, Sanjay Rajpal  wrote:
>
>>  Here concept of v-tables comes into picture. Refer to C++ Primer Plus by
>> Stephen Prata.
>>
>>
>> Sanju
>> :)
>>
>>
>>
>> On Sun, Aug 21, 2011 at 11:05 PM, JAIDEV YADAV  wrote:
>>
>>> because Access control check is done at compile time while using virtual
>>> make fun not available to the base class pointer till runtime ... so no
>>> access check to derived class ... hope u understand and correct me to if
>>> there is any mistake ...
>>>
>>>
>>> On Mon, Aug 22, 2011 at 10:57 AM, Decipher wrote:
>>>
 class Base
 {
 public :
   virtual void show()
   {
   cout<<"\n Base ";
   }

 };
 class Derived : public Base
 {
   private :
 void show()
 {
  cout<<"\n Derived ";
 }
 };
 int main()
 {
 Base *d = new Derived();
 d->show();
 getch();
 }

 Why Derived::show is called even though it is private ? (Ran this code
 on Dev - C++)

 --
 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/-/MKvMpI_KOLUJ.
 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.

>>>
>>>
>>>
>>> --
>>> JaiDev Yadav
>>> (National Yoga Champion)
>>> Computer Engg. Dept.
>>> National Institute of Technology
>>> Kurukshetra,Haryana
>>>
>>> --
>>> 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] C output

2011-08-22 Thread gmagog...@gmail.com
output is 10 using gcc 4.5.2

Yanan Cao



On Mon, Aug 22, 2011 at 2:18 PM, sagar pareek  wrote:

> Yeah its o/p is 10 :)
>
>
> On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg wrote:
>
>> its output is
>>
>> 10
>>
>>
>> On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:
>>
>>> #include
>>>
>>> #define max(a,b) (a>b?a:b)
>>>
>>>
>>> int main()
>>> {
>>>
>>>  int j=max(3+2,2+8);
>>>  printf("%d",j);
>>>
>>>return 0;
>>> }
>>>
>>>why this program show output as 9 ? please help me
>>>
>>> --
>>> 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.D.I.T
>>
>> Sent by Nokia OVI (c)
>>
>>  --
>> 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.
>

-- 
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] C output

2011-08-22 Thread sagar pareek
Yeah its o/p is 10 :)

On Tue, Aug 23, 2011 at 12:45 AM, Deepak Garg wrote:

> its output is
>
> 10
>
>
> On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:
>
>> #include
>>
>> #define max(a,b) (a>b?a:b)
>>
>>
>> int main()
>> {
>>
>>  int j=max(3+2,2+8);
>>  printf("%d",j);
>>
>>return 0;
>> }
>>
>>why this program show output as 9 ? please help me
>>
>> --
>> 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.D.I.T
>
> Sent by Nokia OVI (c)
>
>  --
> 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] C output

2011-08-22 Thread Deepak Garg
its output is

10

On Tue, Aug 23, 2011 at 12:03 AM, rohit  wrote:

> #include
>
> #define max(a,b) (a>b?a:b)
>
>
> int main()
> {
>
>  int j=max(3+2,2+8);
>  printf("%d",j);
>
>return 0;
> }
>
>why this program show output as 9 ? please help me
>
> --
> 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.D.I.T

Sent by Nokia OVI (c)

-- 
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.



[algogeeks] binary tree ques

2011-08-22 Thread Coder Coder
Print the coordinates of nodes of a binary tree.

eg.   A
  BC
   D   EF  G
A(3,2)
B(1,1)
C(5,1)
D(0,0)
E(2,0)
F(4,0)
G(6,0)


*Snehil Saxena
NIT Warangal
3rd yr*

-- 
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] Re:

2011-08-22 Thread sagar pareek
it gives runtime error...
coz u have to allocate memory to *q

On Tue, Aug 23, 2011 at 12:02 AM, Abhishek wrote:

> i think.. it will not produce error, but o/p 'may' be garbage values.
> since the memory locations adjacent to *q will be overwritten.
>
>  --
> 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/-/X1CZmpVjhxEJ.
>
> 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.



[algogeeks] C output

2011-08-22 Thread rohit
#include

#define max(a,b) (a>b?a:b)


int main()
{

 int j=max(3+2,2+8);
 printf("%d",j);

return 0;
}

why this program show output as 9 ? please help me

-- 
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.



[algogeeks] Re:

2011-08-22 Thread Abhishek
i think.. it will not produce error, but o/p 'may' be garbage values.
since the memory locations adjacent to *q will be overwritten.

-- 
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/-/X1CZmpVjhxEJ.
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.



[algogeeks]

2011-08-22 Thread code pool
main( )
{
char *q;
int j;
for (j=0; j<3; j++) scanf("%s" ,(q+j));
for (j=0; j<3; j++) printf("%c" ,*(q+j));
for (j=0; j<3; j++) printf("%s" ,(q+j));
}

Will the program give some o/p or error ???

-- 
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] amazon

2011-08-22 Thread Jagannath Prasad Das
In formal arguments compiler comes to  know about the type of its arguments.
In the actual parameter compiler also knows what is the type of parameter
passed.
Actually the type conversion takes place when the function is called at the
runtime during assignment of actual to formal argument.
So when the function is called ,first of all the the expression representing
actual parameter is evaluated and a copy of it made/copy constructor is
called incase of object passing.


So i feel "both" is the answer

cheers
jagannath

On Mon, Aug 22, 2011 at 10:28 PM, sukran dhawan wrote:

> if u dont want messages pl unsubscribe from the group :)
>
>
> On Mon, Aug 22, 2011 at 10:26 PM, raj Kumar 
> wrote:
>
>> please dont send me messages
>>
>>  --
>> 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.



[algogeeks] Re: amazon question

2011-08-22 Thread Ankuj Gupta
But the o/p at

http://ideone.com/zKZuS

seems to be different than what one is getting from parent child tree

On Aug 8, 10:41 am, Kamakshii Aggarwal  wrote:
> what will be the o/p of the following program:
>
> main()
> {
> int ret;
> ret=fork();
> ret=fork();
> ret=fork();
> ret=fork();
>
> if(!ret)
> printf("one");
> else
> printf("two");
>
> }
>
> --
> Regards,
> Kamakshi
> kamakshi...@gmail.com

-- 
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.



[algogeeks] Re: question on fork()

2011-08-22 Thread Ankuj Gupta
I am getting 6 calls to red and 8 calls to green when i built parent
child tree but when i ran this code

http://ideone.com/UBaBB

I got 10 calls to red and 10 calls to green.

Can some explain this ?
On Aug 22, 9:31 pm, ghsjgl k  wrote:
> i saw this question in one of DREAM companies
>
> i dont know the answer
>
>
>
>
>
>
>
> On Mon, Aug 22, 2011 at 11:43 AM, dexter does  wrote:
> > void red()
> > {
>
> > }
> > void green()
> > {
>
> > }
> > main()
> > {
> >       fork();
> >       int color=fork();
> >       if(color==0)
> >                   fork();
> >       red();
> >       if(color==0)
> >                   fork();
> >       green();
> >       getch();
>
> > }
>
> > How many times red and green are called and pls give an explanation for
> > your answer
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > 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] Please share experiences if any body has faced Samsung Engineering Labs(SIEL)

2011-08-22 Thread sagar pareek
one more thing simple questions on OS in interview
very basic like what is process?
diff b/w process and threads
why thread call light process ...

On Mon, Aug 22, 2011 at 11:15 PM, sonu kumar  wrote:

> aptitude test as sagar said.then tech test consists of
> c- 20 ques,
> ds-5 ques,
> os- 5 ques.
>
> then in interview  only c and c++,and ds asked.
> they mostly emphasize on code 2 write.
>
>
> On Mon, Aug 22, 2011 at 2:08 PM, saurabh  wrote:
>
>> Can Please tell about the type of question if any body has faced
>> SIEL .
>>
>> Saurabh sah
>> NIT Jaipur.
>>
>> --
>> 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
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] Please share experiences if any body has faced Samsung Engineering Labs(SIEL)

2011-08-22 Thread sonu kumar
aptitude test as sagar said.then tech test consists of
c- 20 ques,
ds-5 ques,
os- 5 ques.

then in interview  only c and c++,and ds asked.
they mostly emphasize on code 2 write.

On Mon, Aug 22, 2011 at 2:08 PM, saurabh  wrote:

> Can Please tell about the type of question if any body has faced
> SIEL .
>
> Saurabh sah
> NIT Jaipur.
>
> --
> 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] Mentor Graphics Help !!

2011-08-22 Thread Ankur Garg
Also to add,

If you post profile in their portal no reply comes...How to apply ...can any
one here refer my candidature for Mentor Graphics ..I have 2 yrs work ex
working with IBM ISL

Regards
Ankur

On Mon, Aug 22, 2011 at 7:23 PM, Mangal Dass wrote:

> Anybody pls tell me the questions coming into Information-Mosaic campus
> test.
> Pls tell me both the pattern as well as questions whatever u r remembered.
>
> Thanks a lot,
>
> On 8/22/11, sourabh jakhar  wrote:
> > i also want to know abt the off campus recruitment  of mentor graphics
> > On Mon, Aug 22, 2011 at 6:49 PM, Decipher 
> wrote:
> >
> >> Can anyone tell me the interview procedure of Mentor Graphics along with
> >> some interview questions ??
> >>
> >> --
> >> 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/-/NiJZzcypKH0J.
> >> 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.
> >>
> >
> >
> >
> > --
> > SOURABH JAKHAR,(CSE)(Final year)
> > ROOM NO 167 ,
> > TILAK,HOSTEL
> > 'MNNIT ALLAHABAD
> >
> > The Law of Win says, "Let's not do it your way or my way; let's do it the
> > best way."
> >
> > --
> > 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] Output question

2011-08-22 Thread Abhishek
+1 to sagar.
@vartika: if you don't know the concept of Union then understanding this 
program will be quite lenghty, because it will involve lot of calculation. 
try to check some simple examples, like:

union a
{
int a;
char c;
};
int main()
{
 union a xy;
 xy.a=65;
 printf("%c",xy.c);
 xy.c=65;
 printf(" %d",xy.a);
return 0;
}

-- 
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/-/_FK5paJXWCEJ.
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] constructor ques

2011-08-22 Thread sagar pareek
+1 coder

On Mon, Aug 22, 2011 at 9:41 PM, sukran dhawan wrote:

> hey sorry didnt notice virtual :)
>
>
> On Mon, Aug 22, 2011 at 9:38 PM, coder dumca wrote:
>
>> @sukran ur r wrong man
>> the construdor of virtual base class are called first  otherwise it is
>> from left to right
>> so the correct order is
>> D A B C Z
>> On Mon, Aug 22, 2011 at 8:25 AM, Sanjay Rajpal  wrote:
>>
>>>  agree with sukran.
>>>
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>
>>> On Mon, Aug 22, 2011 at 8:20 AM, sukran dhawan 
>>> wrote:
>>>
 its left to right always !


 On Mon, Aug 22, 2011 at 8:49 PM, Sanjay Rajpal wrote:

>  A
> B
> C
> D
>
>
> Sanju
> :)
>
>
>
> On Mon, Aug 22, 2011 at 8:17 AM, sivaviknesh s  > wrote:
>
>> you have 4 classes A,B,C,D and class Z is derived from all these
>> classes
>> using
>> Class Z: public A,private B,Protected C, Virtual D
>> What is the order of constructor call?
>>
>> ...plz reason out also
>>
>> --
>> Regards,
>> $iva
>>
>> --
>> 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.
>>>
>>
>>  --
>> 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
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] Please share experiences if any body has faced Samsung Engineering Labs(SIEL)

2011-08-22 Thread sagar pareek
50 apti (25 DI + 25 reasoning) in 60 mis

20 tech 30 mins

1tech + 1 hr
 and u are done

On Mon, Aug 22, 2011 at 9:36 PM, ghsjgl k  wrote:

> i attended for SISO
>
>
> On Mon, Aug 22, 2011 at 2:08 PM, saurabh  wrote:
>
>> Can Please tell about the type of question if any body has faced
>> SIEL .
>>
>> Saurabh sah
>> NIT Jaipur.
>>
>> --
>> 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
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.



[algogeeks] Re: Longest palindrome

2011-08-22 Thread uma
can yo tell exactly , how the suffix tree is used for finding
palindromes?

On Aug 22, 3:58 am, WgpShashank  wrote:
> Hey Geeks I think question can be solved by many ways . some of the
> algorithms are i have implemented & aware of are ->
>
> 1st. Algo
>  Generate all palindromes (even & odd length ) of given string while keep
> tracking of their length in last just compare max (evenlength_palindrome ,
> oddlength_palindrome) .
>  Time Complexity O(N^2) where N is length of String
>
> 2nd . Algo. For Those Who are just saying Use DP :)
>   Find The LCS(Longest Common Sub-sequence of String (say s1)& reverse of
> String (say s2) ) It Involves  
>   DP to solve efficiently but guaranteed optimal solution
>   Time Complexity O(N^2) where N is length of String
>   Space  Complexity O(N^2)  for table
>
> 3rd. Use Suffix Tree ( Need to Work On It)  basic idea is to build the
> suffix tree of string & reverse string check no every node where suffix
> belongs to , the deepest common node will us longest palindrome in given
> string.
>
> Correct me if i missed something ?
>
> Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology ,Mesra

-- 
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.



[algogeeks] Re: Search an array of unknown length

2011-08-22 Thread asdqwe
If i am not wrong, the only possible solution can be
len=sizeof(arr)/sizeof(arr[0])
i.e. find the length from the array itself.


On Aug 22, 9:01 pm, saurabh singh  wrote:
> @dave or anyone??? response please
>
>
>
>
>
>
>
>
>
> On Sun, Aug 21, 2011 at 12:43 PM, saurabh singh  wrote:
> > kkk...not sure
> > assume no number is greater than 1000(I mentioned There has to be some
> > additional constraints to make the problem solvable)
> > Now check 1st element if not the desired element keep multiplying with 2
> > the previous range till either one of these condition is satisfied
> > *1.An exception is caught*
> > *2.Number greater than 1000 occurs.*
> > suppose this happens for *1024 *for the given example.
> > then we will check out for (512+1024)/2 th element for the above condition.
> > If true than again branch like binary search.This way can element which on
> > left side doesn't gives any exception and maintains the constraints while on
> > the right it violates the same.So we may land up with the desired index and
> > can then perform binary search...
>
> > PS:There are lots of assumption in this approach and the more I write the
> > more I get convinced that its a plain stupid idea...
>
> > --
> > Saurabh Singh
> > B.Tech (Computer Science)
> > MNNIT ALLAHABAD
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> 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] Output question

2011-08-22 Thread sagar pareek
U should know that union's elements share memory alloted through the largest
data type like in this case 10 bytes is alloted and is shared by all the
union elements.

So in union x :- last element modified is c, so that's why it is printing
garbage values for int and char[] elements...
actually if u convert float value in binary then u will see that what's its
actual integer value is? same case for char[]

in union y : last modified element is integer thats y it is printing 100 for
integer... ascii value of 'd' is 100 thats y printing 'd' for char[] and
0.000 for float

On Mon, Aug 22, 2011 at 4:53 PM, vartika wrote:

> #include
> #include
> int main()
> {
>  typedef union
>  {
>  int a;
>  char b[10];
>  float c;
>  }
>  Union;
>
>  Union x,y = {100};
>  x.a = 50;
>  strcpy(x.b,"hello");
>  x.c = 21.50;
>
>  printf("Union x : %d %s %f \n",x.a,x.b,x.c );
>  printf("Union y :%d %s%f \n",y.a,y.b,y.c);
>  return 0;
> }
>
> Someone pls explain the output
>
> --
> 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] amazon

2011-08-22 Thread sukran dhawan
if u dont want messages pl unsubscribe from the group :)

On Mon, Aug 22, 2011 at 10:26 PM, raj Kumar wrote:

> please dont send me messages
>
>  --
> 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] amazon

2011-08-22 Thread raj Kumar
please dont send me messages

-- 
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] amazon

2011-08-22 Thread sukran dhawan
when u pass a string as a argument only the starting address is passed not
the complete string.so char n[] is converted to char *n

On Mon, Aug 22, 2011 at 10:14 PM, Ashima .  wrote:

> can anyone explain wy these 2 will be different ,atleast wen they are
> passed as actual or formal parameters.
> As in case of actual parameters, both will be passed as "n"--> some address
> value.
> In  case of formal parameters,char n[]  takes the form of char*n. So where
> is the difference highlighted in both the cases.
> Ashima
> M.Sc.(Tech)Information Systems
> 4th year
> BITS Pilani
> Rajasthan
>
>
>
>
> On Mon, Aug 22, 2011 at 9:34 PM, sukran dhawan wrote:
>
>> take the size of char * p and char p [] to confirm the same
>>
>>
>> On Mon, Aug 22, 2011 at 9:32 PM, Anand Prasad wrote:
>>
>>> yea,, true.. spot on actually..
>>> Anand
>>>
>>>
>>>
>>> On Mon, Aug 22, 2011 at 9:30 PM, sukran dhawan 
>>> wrote:
>>>
 they are different !!! char p[] is a constant pointer and char * p is
 not.
 u can do something like this

 char * p;
 p="dgdfg";

 but not the same for char p[]

 On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
 love.for.programm...@gmail.com> wrote:

> The compiler will distinguish between char n[] and char * in which part
> of the prog??
> 1. In actual parameters of function arguments
> 2. In formal parameters of function arguments
> 3. in both
>
> generally after 1st online technical round what is the cut off for
> amazon??
>
> --
> 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.
>>
>
>  --
> 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] amazon

2011-08-22 Thread Ashima .
can anyone explain wy these 2 will be different ,atleast wen they are
passed as actual or formal parameters.
As in case of actual parameters, both will be passed as "n"--> some address
value.
In  case of formal parameters,char n[]  takes the form of char*n. So where
is the difference highlighted in both the cases.
Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Mon, Aug 22, 2011 at 9:34 PM, sukran dhawan wrote:

> take the size of char * p and char p [] to confirm the same
>
>
> On Mon, Aug 22, 2011 at 9:32 PM, Anand Prasad wrote:
>
>> yea,, true.. spot on actually..
>> Anand
>>
>>
>>
>> On Mon, Aug 22, 2011 at 9:30 PM, sukran dhawan wrote:
>>
>>> they are different !!! char p[] is a constant pointer and char * p is
>>> not.
>>> u can do something like this
>>>
>>> char * p;
>>> p="dgdfg";
>>>
>>> but not the same for char p[]
>>>
>>> On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
>>> love.for.programm...@gmail.com> wrote:
>>>
 The compiler will distinguish between char n[] and char * in which part
 of the prog??
 1. In actual parameters of function arguments
 2. In formal parameters of function arguments
 3. in both

 generally after 1st online technical round what is the cut off for
 amazon??

 --
 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.
>

-- 
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] Re: Longest palindrome

2011-08-22 Thread coder dumca
@ harry how it is possible man

On Mon, Aug 22, 2011 at 3:58 AM, WgpShashank wrote:

> Hey Geeks I think question can be solved by many ways . some of the
> algorithms are i have implemented & aware of are ->
>
> 1st. Algo
>  Generate all palindromes (even & odd length ) of given string while keep
> tracking of their length in last just compare max (evenlength_palindrome ,
> oddlength_palindrome) .
>  Time Complexity O(N^2) where N is length of String
>
> 2nd . Algo. For Those Who are just saying Use DP :)
>   Find The LCS(Longest Common Sub-sequence of String (say s1)& reverse of
> String (say s2) ) It Involves
>   DP to solve efficiently but guaranteed optimal solution
>   Time Complexity O(N^2) where N is length of String
>   Space  Complexity O(N^2)  for table
>
> 3rd. Use Suffix Tree ( Need to Work On It)  basic idea is to build the
> suffix tree of string & reverse string check no every node where suffix
> belongs to , the deepest common node will us longest palindrome in given
> string.
>
> Correct me if i missed something ?
>
> Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology ,Mesra
>
> --
> 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/-/56GQiQVlUukJ.
>
> 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] Microsoft :)

2011-08-22 Thread ghsjgl k
@Harshal


congratulations

can u tell me if u know any other help full links regarding placements


On Mon, Aug 22, 2011 at 12:39 AM, Ankur Garg  wrote:

> @Harsha
>
> Bro I am unable to read ur blog ..It says this
>
> http://harshal-theone.blogspot.com/
>
> It doesn't look like you have been invited to read this blog. If you think
> this is a mistake, you might want to contact the blog author and request an
> invitation.
>
> Is there anything I need to do to view this blog of urs man !
>
> Regards
>
> Ankur
>
> On Sun, Aug 21, 2011 at 1:54 PM, Vijay Khandar wrote:
>
>> Congrates Harshal!!
>>
>> On Sat, Aug 6, 2011 at 12:15 PM, Harshal  wrote:
>>
>>> Algogeeks is really awesome and very informative. I got a job in
>>> microsoft, and this group has played vital role in building concepts. So I
>>> just want to thank this group and the people here..
>>> keep it up guys! All the best :)
>>>
>>>
>>> --
>>> Best Regards,
>>> Harshal Choudhary
>>> 7th Semester, CSE Dept.
>>> NIT Surathkal, India.
>>> "The road to knowledge runs through the land of confusion."
>>>
>>> Mobile: +91 9844667142
>>> Email : hc4...@gmail.com
>>>   
>>> 
>>>    
>>> 
>>>
>>>
>>>  --
>>> 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] Important

2011-08-22 Thread coder dumca
hi manglu

On Mon, Aug 22, 2011 at 7:05 AM, Mangal Dass wrote:

> Anybody pls tell me the questions coming into Information-Mosaic campus
> test.
> Mosaic has changed its pattern.
> Pls post both the pattern as well as questions(if something u remembered) .
>
> Thanks a lot,
>
> --
> 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] Re: amazon q

2011-08-22 Thread sagar pareek
@shashank
what about min heap?
Check this out --> http://en.wikipedia.org/wiki/Heap_%28data_structure%29

On Mon, Aug 22, 2011 at 4:13 PM, WgpShashank wrote:

> Only Balanced BST (its guaranteed that we can search element in o(logn) ,
>
> i am assuming its maxheap .In a max heap, the smallest element is always
> present at a leaf node. So we need to check for all leaf nodes for the
> minimum value. Worst case complexity will be O(n)
>
> 12
> / \
> / \
> 8 7
> / \ / \ try to search 5 in this using Heap & balanced BST
> / \ / \
> 2 3 4 5
>
> As searching is main constraints on complexity we can't use Heap to achieve
> O(logn) it will take linear time but using Balanced BST (e.g. AVL/RB Tree)
> we can search element in O(logn) :)
>
>
> Shashank
> CSE,BIT Mesra
>
> --
> 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/-/fmXlF2-kcFwJ.
>
> 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] Re: Amazon Ques

2011-08-22 Thread Ashima .
Since its not a Linked list,
so get middle value from "top"
pop till middle element and push elements in a new stack.
again push the elemetns back to original stack,except for the middle
element.
Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Mon, Aug 22, 2011 at 8:49 PM, *$*  wrote:

> Hi,
>  How about the following approach.
>
> lets take stack is stack1.
> lets take 2 pointers , p1 and p2
> for every pop , keep increment p1 , so that p1 will point to latest pop'ed
> out element.
> increment p2 for every odd count of pop's...
>
> increment p2 , for 1 , 3 , 5 , pop'ings etc..
> so at the end , p2 will point to middle element of the stack.
>
>
> Thx,
> --Gopi
>
>
> On Mon, Aug 22, 2011 at 8:04 PM, muthu raj  wrote:
>
>> Sorry i dint read the question properly :)
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>> On Mon, Aug 22, 2011 at 7:24 AM, sukran dhawan wrote:
>>
>>> count is required since its not implemented as LL
>>>
>>>
>>> On Mon, Aug 22, 2011 at 7:47 PM, shady  wrote:
>>>
 i wish u had read the question... it is simple.. push to new stack and
 then pop back... number of elements count need to be there


 On Mon, Aug 22, 2011 at 7:44 PM, muthu raj wrote:

> No need to count the number of nodes. Since its implemented as a linked
> list traverse the list with two two pointers one incremented one node next
> and other incremented two nodes next simultaneously.
>
> void delete_MiddleStack(node **h)
> {
>
>  if(*h==NULL)
>  return;
>  node *p,*q;
> p=*h;
>   q=*h;
>  while(q->next!=NULL)
> {
> p=p->next;
> if(q->next==NULL)
> q=q->next;
>   else q=q->next->next;
> }
> p->ele=p->next->ele;
> q=p->next;
> p->next=p->next->next;
> free(q);
> }
>
>
>
>
>
>
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
>
> On Mon, Aug 22, 2011 at 5:08 AM, vikas wrote:
>
>> why to bother this much...? just count the elements when popping and
>> output the middle one .
>> while(!s.empty()){
>> e= s.pop()
>> count++
>> q.enq(e);
>> }
>>
>> count <<= 2;
>>
>> while(count){
>> e = q.deq();
>> s.push(e);
>> count --;
>> }
>> output s.top()
>>
>> while(!q.empty()){
>> e = q.deq();
>> s.push(e);
>> }
>>
>>
>> On Aug 22, 4:27 pm, Shravan Kumar  wrote:
>> > Pop each element and en-queue it twice and de-queue it once. When
>> stack is
>> > empty the front of the queue will be middle element.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Mon, Aug 22, 2011 at 4:01 PM, Ankur Garg 
>> wrote:
>> > > Find the middle of the stack..(Time complexity should be minimum)
>> >
>> > > Stack is not implemented as Linked List ...u have normal stack
>> with
>> > > push,pop and top
>> >
>> > > How to do this ??
>> >
>> > > --
>> > > 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.

>>>
>>>  --
>>> 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 op

Re: [algogeeks] question on fork()

2011-08-22 Thread ghsjgl k
i saw this question in one of DREAM companies

i dont know the answer

On Mon, Aug 22, 2011 at 11:43 AM, dexter does  wrote:

> void red()
> {
>
> }
> void green()
> {
>
> }
> main()
> {
>   fork();
>   int color=fork();
>   if(color==0)
>   fork();
>   red();
>   if(color==0)
>   fork();
>   green();
>   getch();
>
> }
>
>
> How many times red and green are called and pls give an explanation for
> your answer
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> 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] Syllogism

2011-08-22 Thread ghsjgl k
Yes, the conclusion is true u have no need to re think

 i recently studied things related to syllogism in Logical and Analytical
reasoning from Arihant publications



On Sat, Aug 20, 2011 at 10:26 AM, geek_one wrote:

> Statement: Some girls are beautiful.
> Conclusion: Some girls are not beautiful.
>
> is the conclusion is true on the basis of Statement?
>
> --
> 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/-/SGSGlmwYFBAJ.
> 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] amazon

2011-08-22 Thread sukran dhawan
take the size of char * p and char p [] to confirm the same

On Mon, Aug 22, 2011 at 9:32 PM, Anand Prasad wrote:

> yea,, true.. spot on actually..
> Anand
>
>
>
> On Mon, Aug 22, 2011 at 9:30 PM, sukran dhawan wrote:
>
>> they are different !!! char p[] is a constant pointer and char * p is not.
>> u can do something like this
>>
>> char * p;
>> p="dgdfg";
>>
>> but not the same for char p[]
>>
>> On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
>> love.for.programm...@gmail.com> wrote:
>>
>>> The compiler will distinguish between char n[] and char * in which part
>>> of the prog??
>>> 1. In actual parameters of function arguments
>>> 2. In formal parameters of function arguments
>>> 3. in both
>>>
>>> generally after 1st online technical round what is the cut off for
>>> amazon??
>>>
>>> --
>>> 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] constructor ques

2011-08-22 Thread sukran dhawan
hey sorry didnt notice virtual :)

On Mon, Aug 22, 2011 at 9:38 PM, coder dumca  wrote:

> @sukran ur r wrong man
> the construdor of virtual base class are called first  otherwise it is from
> left to right
> so the correct order is
> D A B C Z
> On Mon, Aug 22, 2011 at 8:25 AM, Sanjay Rajpal  wrote:
>
>>  agree with sukran.
>>
>>
>> Sanju
>> :)
>>
>>
>>
>> On Mon, Aug 22, 2011 at 8:20 AM, sukran dhawan wrote:
>>
>>> its left to right always !
>>>
>>>
>>> On Mon, Aug 22, 2011 at 8:49 PM, Sanjay Rajpal  wrote:
>>>
  A
 B
 C
 D


 Sanju
 :)



 On Mon, Aug 22, 2011 at 8:17 AM, sivaviknesh s 
 wrote:

> you have 4 classes A,B,C,D and class Z is derived from all these
> classes
> using
> Class Z: public A,private B,Protected C, Virtual D
> What is the order of constructor call?
>
> ...plz reason out also
>
> --
> Regards,
> $iva
>
> --
> 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.
>>
>
>  --
> 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] Please share experiences if any body has faced Samsung Engineering Labs(SIEL)

2011-08-22 Thread ghsjgl k
i attended for SISO

On Mon, Aug 22, 2011 at 2:08 PM, saurabh  wrote:

> Can Please tell about the type of question if any body has faced
> SIEL .
>
> Saurabh sah
> NIT Jaipur.
>
> --
> 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] constructor ques

2011-08-22 Thread coder dumca
@sukran ur r wrong man
the construdor of virtual base class are called first  otherwise it is from
left to right
so the correct order is
D A B C Z
On Mon, Aug 22, 2011 at 8:25 AM, Sanjay Rajpal  wrote:

>  agree with sukran.
>
>
> Sanju
> :)
>
>
>
> On Mon, Aug 22, 2011 at 8:20 AM, sukran dhawan wrote:
>
>> its left to right always !
>>
>>
>> On Mon, Aug 22, 2011 at 8:49 PM, Sanjay Rajpal  wrote:
>>
>>>  A
>>> B
>>> C
>>> D
>>>
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>
>>> On Mon, Aug 22, 2011 at 8:17 AM, sivaviknesh s 
>>> wrote:
>>>
 you have 4 classes A,B,C,D and class Z is derived from all these classes

 using
 Class Z: public A,private B,Protected C, Virtual D
 What is the order of constructor call?

 ...plz reason out also

 --
 Regards,
 $iva

 --
 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.
>

-- 
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] Accessing private members of Derived class ?

2011-08-22 Thread sukran dhawan
which is the best book for c++ ? complete reference or prata or c++ by
stroustroup?

On Mon, Aug 22, 2011 at 11:40 AM, Sanjay Rajpal  wrote:

> Here concept of v-tables comes into picture. Refer to C++ Primer Plus by
> Stephen Prata.
>
>
> Sanju
> :)
>
>
>
> On Sun, Aug 21, 2011 at 11:05 PM, JAIDEV YADAV  wrote:
>
>> because Access control check is done at compile time while using virtual
>> make fun not available to the base class pointer till runtime ... so no
>> access check to derived class ... hope u understand and correct me to if
>> there is any mistake ...
>>
>>
>> On Mon, Aug 22, 2011 at 10:57 AM, Decipher wrote:
>>
>>> class Base
>>> {
>>> public :
>>>   virtual void show()
>>>   {
>>>   cout<<"\n Base ";
>>>   }
>>>
>>> };
>>> class Derived : public Base
>>> {
>>>   private :
>>> void show()
>>> {
>>>  cout<<"\n Derived ";
>>> }
>>> };
>>> int main()
>>> {
>>> Base *d = new Derived();
>>> d->show();
>>> getch();
>>> }
>>>
>>> Why Derived::show is called even though it is private ? (Ran this code on
>>> Dev - C++)
>>>
>>> --
>>> 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/-/MKvMpI_KOLUJ.
>>> 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.
>>>
>>
>>
>>
>> --
>> JaiDev Yadav
>> (National Yoga Champion)
>> Computer Engg. Dept.
>> National Institute of Technology
>> Kurukshetra,Haryana
>>
>> --
>> 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] amazon

2011-08-22 Thread Anand Prasad
yea,, true.. spot on actually..
Anand


On Mon, Aug 22, 2011 at 9:30 PM, sukran dhawan wrote:

> they are different !!! char p[] is a constant pointer and char * p is not.
> u can do something like this
>
> char * p;
> p="dgdfg";
>
> but not the same for char p[]
>
> On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
> love.for.programm...@gmail.com> wrote:
>
>> The compiler will distinguish between char n[] and char * in which part of
>> the prog??
>> 1. In actual parameters of function arguments
>> 2. In formal parameters of function arguments
>> 3. in both
>>
>> generally after 1st online technical round what is the cut off for
>> amazon??
>>
>> --
>> 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] amazon

2011-08-22 Thread sukran dhawan
they are different !!! char p[] is a constant pointer and char * p is not.
u can do something like this

char * p;
p="dgdfg";

but not the same for char p[]

On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
love.for.programm...@gmail.com> wrote:

> The compiler will distinguish between char n[] and char * in which part of
> the prog??
> 1. In actual parameters of function arguments
> 2. In formal parameters of function arguments
> 3. in both
>
> generally after 1st online technical round what is the cut off for amazon??
>
> --
> 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] Re: Search an array of unknown length

2011-08-22 Thread saurabh singh
@dave or anyone??? response please

On Sun, Aug 21, 2011 at 12:43 PM, saurabh singh  wrote:

> kkk...not sure
> assume no number is greater than 1000(I mentioned There has to be some
> additional constraints to make the problem solvable)
> Now check 1st element if not the desired element keep multiplying with 2
> the previous range till either one of these condition is satisfied
> *1.An exception is caught*
> *2.Number greater than 1000 occurs.*
> suppose this happens for *1024 *for the given example.
> then we will check out for (512+1024)/2 th element for the above condition.
> If true than again branch like binary search.This way can element which on
> left side doesn't gives any exception and maintains the constraints while on
> the right it violates the same.So we may land up with the desired index and
> can then perform binary search...
>
> PS:There are lots of assumption in this approach and the more I write the
> more I get convinced that its a plain stupid idea...
>
>
> --
> Saurabh Singh
> B.Tech (Computer Science)
> MNNIT ALLAHABAD
>
>
>


-- 
Saurabh Singh
B.Tech (Computer Science)
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] amazon

2011-08-22 Thread priya ramesh
even i thought it's both. Plz correct me if i'm wrong folks!

-- 
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] amazon

2011-08-22 Thread Anand Prasad
answer's both right? they're interchangeable either way,..?
Anand


On Mon, Aug 22, 2011 at 9:21 PM, sukran dhawan wrote:

> which college has amazon come?
>
>
> On Mon, Aug 22, 2011 at 9:18 PM, Avi Bhandari  wrote:
>
>>
>>
>> On Mon, Aug 22, 2011 at 9:16 PM, sukran dhawan wrote:
>>
>>> when it is passed to functions both forms are interchangeable.single
>>> subscripted array is converted to pointer
>>>
>>> On Mon, Aug 22, 2011 at 9:14 PM, sukran dhawan 
>>> wrote:
>>>
 a


 On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
 love.for.programm...@gmail.com> wrote:

> The compiler will distinguish between char n[] and char * in which part
> of the prog??
> 1. In actual parameters of function arguments
> 2. In formal parameters of function arguments
> 3. in both
>
> generally after 1st online technical round what is the cut off for
> amazon??
>
> --
> 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.
>

-- 
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] amazon

2011-08-22 Thread sukran dhawan
which college has amazon come?

On Mon, Aug 22, 2011 at 9:18 PM, Avi Bhandari  wrote:

>
>
> On Mon, Aug 22, 2011 at 9:16 PM, sukran dhawan wrote:
>
>> when it is passed to functions both forms are interchangeable.single
>> subscripted array is converted to pointer
>>
>> On Mon, Aug 22, 2011 at 9:14 PM, sukran dhawan wrote:
>>
>>> a
>>>
>>>
>>> On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
>>> love.for.programm...@gmail.com> wrote:
>>>
 The compiler will distinguish between char n[] and char * in which part
 of the prog??
 1. In actual parameters of function arguments
 2. In formal parameters of function arguments
 3. in both

 generally after 1st online technical round what is the cut off for
 amazon??

 --
 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] amazon

2011-08-22 Thread Avi Bhandari
On Mon, Aug 22, 2011 at 9:16 PM, sukran dhawan wrote:

> when it is passed to functions both forms are interchangeable.single
> subscripted array is converted to pointer
>
> On Mon, Aug 22, 2011 at 9:14 PM, sukran dhawan wrote:
>
>> a
>>
>>
>> On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
>> love.for.programm...@gmail.com> wrote:
>>
>>> The compiler will distinguish between char n[] and char * in which part
>>> of the prog??
>>> 1. In actual parameters of function arguments
>>> 2. In formal parameters of function arguments
>>> 3. in both
>>>
>>> generally after 1st online technical round what is the cut off for
>>> amazon??
>>>
>>> --
>>> 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] amazon

2011-08-22 Thread sukran dhawan
when it is passed to functions both forms are interchangeable.single
subscripted array is converted to pointer

On Mon, Aug 22, 2011 at 9:14 PM, sukran dhawan wrote:

> a
>
>
> On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
> love.for.programm...@gmail.com> wrote:
>
>> The compiler will distinguish between char n[] and char * in which part of
>> the prog??
>> 1. In actual parameters of function arguments
>> 2. In formal parameters of function arguments
>> 3. in both
>>
>> generally after 1st online technical round what is the cut off for
>> amazon??
>>
>> --
>> 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] amazon

2011-08-22 Thread sukran dhawan
a

On Mon, Aug 22, 2011 at 8:55 PM, priya ramesh <
love.for.programm...@gmail.com> wrote:

> The compiler will distinguish between char n[] and char * in which part of
> the prog??
> 1. In actual parameters of function arguments
> 2. In formal parameters of function arguments
> 3. in both
>
> generally after 1st online technical round what is the cut off for amazon??
>
> --
> 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.



[algogeeks] amazon

2011-08-22 Thread priya ramesh
The compiler will distinguish between char n[] and char * in which part of
the prog??
1. In actual parameters of function arguments
2. In formal parameters of function arguments
3. in both

generally after 1st online technical round what is the cut off for amazon??

-- 
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] constructor ques

2011-08-22 Thread Sanjay Rajpal
agree with sukran.


Sanju
:)



On Mon, Aug 22, 2011 at 8:20 AM, sukran dhawan wrote:

> its left to right always !
>
>
> On Mon, Aug 22, 2011 at 8:49 PM, Sanjay Rajpal  wrote:
>
>>  A
>> B
>> C
>> D
>>
>>
>> Sanju
>> :)
>>
>>
>>
>> On Mon, Aug 22, 2011 at 8:17 AM, sivaviknesh s wrote:
>>
>>> you have 4 classes A,B,C,D and class Z is derived from all these classes
>>> using
>>> Class Z: public A,private B,Protected C, Virtual D
>>> What is the order of constructor call?
>>>
>>> ...plz reason out also
>>>
>>> --
>>> Regards,
>>> $iva
>>>
>>> --
>>> 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] constructor ques

2011-08-22 Thread sukran dhawan
its left to right always !

On Mon, Aug 22, 2011 at 8:49 PM, Sanjay Rajpal  wrote:

> A
> B
> C
> D
>
>
> Sanju
> :)
>
>
>
> On Mon, Aug 22, 2011 at 8:17 AM, sivaviknesh s wrote:
>
>> you have 4 classes A,B,C,D and class Z is derived from all these classes
>> using
>> Class Z: public A,private B,Protected C, Virtual D
>> What is the order of constructor call?
>>
>> ...plz reason out also
>>
>> --
>> Regards,
>> $iva
>>
>> --
>> 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] constructor ques

2011-08-22 Thread Sanjay Rajpal
Z at last.


Sanju
:)



On Mon, Aug 22, 2011 at 8:19 AM, Sanjay Rajpal  wrote:

>  A
> B
> C
> D
>
>
> Sanju
> :)
>
>
>
> On Mon, Aug 22, 2011 at 8:17 AM, sivaviknesh s wrote:
>
>> you have 4 classes A,B,C,D and class Z is derived from all these classes
>> using
>> Class Z: public A,private B,Protected C, Virtual D
>> What is the order of constructor call?
>>
>> ...plz reason out also
>>
>> --
>> Regards,
>> $iva
>>
>> --
>> 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] Re: Amazon Ques

2011-08-22 Thread *$*
Hi,
 How about the following approach.

lets take stack is stack1.
lets take 2 pointers , p1 and p2
for every pop , keep increment p1 , so that p1 will point to latest pop'ed
out element.
increment p2 for every odd count of pop's...

increment p2 , for 1 , 3 , 5 , pop'ings etc..
so at the end , p2 will point to middle element of the stack.


Thx,
--Gopi

On Mon, Aug 22, 2011 at 8:04 PM, muthu raj  wrote:

> Sorry i dint read the question properly :)
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
> On Mon, Aug 22, 2011 at 7:24 AM, sukran dhawan wrote:
>
>> count is required since its not implemented as LL
>>
>>
>> On Mon, Aug 22, 2011 at 7:47 PM, shady  wrote:
>>
>>> i wish u had read the question... it is simple.. push to new stack and
>>> then pop back... number of elements count need to be there
>>>
>>>
>>> On Mon, Aug 22, 2011 at 7:44 PM, muthu raj  wrote:
>>>
 No need to count the number of nodes. Since its implemented as a linked
 list traverse the list with two two pointers one incremented one node next
 and other incremented two nodes next simultaneously.

 void delete_MiddleStack(node **h)
 {

  if(*h==NULL)
  return;
  node *p,*q;
 p=*h;
   q=*h;
  while(q->next!=NULL)
 {
 p=p->next;
 if(q->next==NULL)
 q=q->next;
   else q=q->next->next;
 }
 p->ele=p->next->ele;
 q=p->next;
 p->next=p->next->next;
 free(q);
 }







 *Muthuraj R
 IV th Year , ISE
 PESIT , Bangalore*




 On Mon, Aug 22, 2011 at 5:08 AM, vikas wrote:

> why to bother this much...? just count the elements when popping and
> output the middle one .
> while(!s.empty()){
> e= s.pop()
> count++
> q.enq(e);
> }
>
> count <<= 2;
>
> while(count){
> e = q.deq();
> s.push(e);
> count --;
> }
> output s.top()
>
> while(!q.empty()){
> e = q.deq();
> s.push(e);
> }
>
>
> On Aug 22, 4:27 pm, Shravan Kumar  wrote:
> > Pop each element and en-queue it twice and de-queue it once. When
> stack is
> > empty the front of the queue will be middle element.
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Aug 22, 2011 at 4:01 PM, Ankur Garg 
> wrote:
> > > Find the middle of the stack..(Time complexity should be minimum)
> >
> > > Stack is not implemented as Linked List ...u have normal stack with
> > > push,pop and top
> >
> > > How to do this ??
> >
> > > --
> > > 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.
>>>
>>
>>  --
>> 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.
>



-- 
Thx,
--Gopi

-- 
You received this message because you a

Re: [algogeeks] constructor ques

2011-08-22 Thread Sanjay Rajpal
A
B
C
D


Sanju
:)



On Mon, Aug 22, 2011 at 8:17 AM, sivaviknesh s wrote:

> you have 4 classes A,B,C,D and class Z is derived from all these classes
> using
> Class Z: public A,private B,Protected C, Virtual D
> What is the order of constructor call?
>
> ...plz reason out also
>
> --
> Regards,
> $iva
>
> --
> 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.



[algogeeks] constructor ques

2011-08-22 Thread sivaviknesh s
you have 4 classes A,B,C,D and class Z is derived from all these classes
using
Class Z: public A,private B,Protected C, Virtual D
What is the order of constructor call?

...plz reason out also

-- 
Regards,
$iva

-- 
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] Re: Process memory Layout

2011-08-22 Thread sukran dhawan
its a run time error(segmentation fault). it is placed in a read only memory

On Mon, Aug 22, 2011 at 3:05 PM, aditi garg wrote:

> @ kumar
> if we hav
>  char *p="hello world";
> p[5]= 'a';
> it generates only run time error and not compile time error
>
>
> On Mon, Aug 22, 2011 at 10:47 AM, kumar raja wrote:
>
>> What i am saying is
>>
>> if i write it like
>> p[5]= 'a';
>>
>> Then the compiler will raise an error . Because the memory where the
>> string constant "Hello world" gets stored is read only.
>>
>> But it i do it like
>>
>> char s[] = "hello world",*p;
>>
>> p=s;
>>
>> p[5]='a';
>>
>> It is valid becoz the string is now stored in stack segment of program .
>>
>> So my doubt is where the string constant gets stored exactly in the first
>> case...and why it cant be altered..
>>
>>
>> On 21 August 2011 22:06, Sanjay Rajpal  wrote:
>>
>>> You can change the pointer only, not the content.
>>>
>>> But in case of static int, u can also change the value also. if u specify
>>> const, u can't change the value then.
>>>
>>>
>>> Sanju
>>> :)
>>>
>>>
>>>
>>> On Sun, Aug 21, 2011 at 9:56 PM, Dave  wrote:
>>>
 @Kumar: You've declared a pointer, and you can change the pointer,
 just as in int i=10 declares an integer that you can change.

 Dave

 On Aug 21, 11:28 pm, kumar raja  wrote:
 > char *p= "hello world";
 >
 > When we try to modify the  above string it will raise an error. I
 heard that
 > the String constant is stored in the Data segment of the process . The
 data
 > segment consists of two parts .
 > 1)Initialized data segment
 > 2)Uninitialized data segment
 >
 > If we use some other global variable in the same program  say static
 int
 > i=10;
 >
 > But it could be modified at later.So why not the string constant cant
 be
 > modified??? Someone said that it is stored in Text/Code segment . I
 think
 > thats wrong . the Text segment is only a set of machine instructions
 to
 > execute the program ,but does not contain  any  data  values.
 >
 > So, Where the above String constant is stored and why it cant be
 altered???
 >
 > --
 > Regards
 > Kumar Raja
 > M.Tech(SIT)
 > IIT Kharagpur,
 > 10it60...@iitkgp.ac.in
  > 7797137043.
 > 09491690115.

 --
 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
>> Kumar Raja
>> M.Tech(SIT)
>> IIT Kharagpur,
>> 10it60...@iitkgp.ac.in
>> 7797137043.
>> 09491690115.
>>
>>  --
>> 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.
>>
>
>
>
> --
> Aditi Garg
> Undergraduate Student
> Electronics & Communication Divison
> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY
> Sector 3, Dwarka
> New 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.
>

-- 
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] c programe explain

2011-08-22 Thread sukran dhawan
output is Interview

On Sun, Aug 21, 2011 at 10:53 PM, Sanjay Rajpal  wrote:

> the o/p wil be Interview.
>
>
>
> Sanju
> :)
>
>
>
> On Sun, Aug 21, 2011 at 10:20 AM, SuDhir mIsHra  > wrote:
>
>>  funct(char* str)
>> {
>> printf("%s\n",str);
>> }
>> main()
>> {
>> static int ii = 1;
>> int jj = 5;
>> ii+=++jj;
>> funct(ii+++"Campus Interview");
>> }
>>
>> --
>> 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] Re: Amazon Ques

2011-08-22 Thread muthu raj
Sorry i dint read the question properly :)
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Mon, Aug 22, 2011 at 7:24 AM, sukran dhawan wrote:

> count is required since its not implemented as LL
>
>
> On Mon, Aug 22, 2011 at 7:47 PM, shady  wrote:
>
>> i wish u had read the question... it is simple.. push to new stack and
>> then pop back... number of elements count need to be there
>>
>>
>> On Mon, Aug 22, 2011 at 7:44 PM, muthu raj  wrote:
>>
>>> No need to count the number of nodes. Since its implemented as a linked
>>> list traverse the list with two two pointers one incremented one node next
>>> and other incremented two nodes next simultaneously.
>>>
>>> void delete_MiddleStack(node **h)
>>> {
>>>
>>>  if(*h==NULL)
>>>  return;
>>>  node *p,*q;
>>> p=*h;
>>>   q=*h;
>>>  while(q->next!=NULL)
>>> {
>>> p=p->next;
>>> if(q->next==NULL)
>>> q=q->next;
>>>   else q=q->next->next;
>>> }
>>> p->ele=p->next->ele;
>>> q=p->next;
>>> p->next=p->next->next;
>>> free(q);
>>> }
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> *Muthuraj R
>>> IV th Year , ISE
>>> PESIT , Bangalore*
>>>
>>>
>>>
>>>
>>> On Mon, Aug 22, 2011 at 5:08 AM, vikas wrote:
>>>
 why to bother this much...? just count the elements when popping and
 output the middle one .
 while(!s.empty()){
 e= s.pop()
 count++
 q.enq(e);
 }

 count <<= 2;

 while(count){
 e = q.deq();
 s.push(e);
 count --;
 }
 output s.top()

 while(!q.empty()){
 e = q.deq();
 s.push(e);
 }


 On Aug 22, 4:27 pm, Shravan Kumar  wrote:
 > Pop each element and en-queue it twice and de-queue it once. When
 stack is
 > empty the front of the queue will be middle element.
 >
 >
 >
 >
 >
 >
 >
 > On Mon, Aug 22, 2011 at 4:01 PM, Ankur Garg 
 wrote:
 > > Find the middle of the stack..(Time complexity should be minimum)
 >
 > > Stack is not implemented as Linked List ...u have normal stack with
 > > push,pop and top
 >
 > > How to do this ??
 >
 > > --
 > > 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.
>>
>
>  --
> 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] Re: Amazon Ques

2011-08-22 Thread sukran dhawan
count is required since its not implemented as LL

On Mon, Aug 22, 2011 at 7:47 PM, shady  wrote:

> i wish u had read the question... it is simple.. push to new stack and then
> pop back... number of elements count need to be there
>
>
> On Mon, Aug 22, 2011 at 7:44 PM, muthu raj  wrote:
>
>> No need to count the number of nodes. Since its implemented as a linked
>> list traverse the list with two two pointers one incremented one node next
>> and other incremented two nodes next simultaneously.
>>
>> void delete_MiddleStack(node **h)
>> {
>>
>>  if(*h==NULL)
>>  return;
>>  node *p,*q;
>> p=*h;
>>   q=*h;
>>  while(q->next!=NULL)
>> {
>> p=p->next;
>> if(q->next==NULL)
>> q=q->next;
>>   else q=q->next->next;
>> }
>> p->ele=p->next->ele;
>> q=p->next;
>> p->next=p->next->next;
>> free(q);
>> }
>>
>>
>>
>>
>>
>>
>>
>> *Muthuraj R
>> IV th Year , ISE
>> PESIT , Bangalore*
>>
>>
>>
>>
>> On Mon, Aug 22, 2011 at 5:08 AM, vikas wrote:
>>
>>> why to bother this much...? just count the elements when popping and
>>> output the middle one .
>>> while(!s.empty()){
>>> e= s.pop()
>>> count++
>>> q.enq(e);
>>> }
>>>
>>> count <<= 2;
>>>
>>> while(count){
>>> e = q.deq();
>>> s.push(e);
>>> count --;
>>> }
>>> output s.top()
>>>
>>> while(!q.empty()){
>>> e = q.deq();
>>> s.push(e);
>>> }
>>>
>>>
>>> On Aug 22, 4:27 pm, Shravan Kumar  wrote:
>>> > Pop each element and en-queue it twice and de-queue it once. When stack
>>> is
>>> > empty the front of the queue will be middle element.
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> >
>>> > On Mon, Aug 22, 2011 at 4:01 PM, Ankur Garg 
>>> wrote:
>>> > > Find the middle of the stack..(Time complexity should be minimum)
>>> >
>>> > > Stack is not implemented as Linked List ...u have normal stack with
>>> > > push,pop and top
>>> >
>>> > > How to do this ??
>>> >
>>> > > --
>>> > > 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.
>

-- 
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] AMAZON

2011-08-22 Thread shady
no, search the archives
 thread closed ***

On Mon, Aug 22, 2011 at 7:35 PM, venkateswari srinivasan <
srinivasanvenkatesw...@gmail.com> wrote:

> can any post the soft copy of cracking the coding interview book
>
> --
> 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] AMAZON

2011-08-22 Thread venkateswari srinivasan
can any post the soft copy of cracking the coding interview book

-- 
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] Re: Amazon Ques

2011-08-22 Thread muthu raj
No need to count the number of nodes. Since its implemented as a linked list
traverse the list with two two pointers one incremented one node next and
other incremented two nodes next simultaneously.

void delete_MiddleStack(node **h)
{

 if(*h==NULL)
 return;
 node *p,*q;
p=*h;
  q=*h;
 while(q->next!=NULL)
{
p=p->next;
if(q->next==NULL)
q=q->next;
  else q=q->next->next;
}
p->ele=p->next->ele;
q=p->next;
p->next=p->next->next;
free(q);
}







*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*



On Mon, Aug 22, 2011 at 5:08 AM, vikas  wrote:

> why to bother this much...? just count the elements when popping and
> output the middle one .
> while(!s.empty()){
> e= s.pop()
> count++
> q.enq(e);
> }
>
> count <<= 2;
>
> while(count){
> e = q.deq();
> s.push(e);
> count --;
> }
> output s.top()
>
> while(!q.empty()){
> e = q.deq();
> s.push(e);
> }
>
>
> On Aug 22, 4:27 pm, Shravan Kumar  wrote:
> > Pop each element and en-queue it twice and de-queue it once. When stack
> is
> > empty the front of the queue will be middle element.
> >
> >
> >
> >
> >
> >
> >
> > On Mon, Aug 22, 2011 at 4:01 PM, Ankur Garg 
> wrote:
> > > Find the middle of the stack..(Time complexity should be minimum)
> >
> > > Stack is not implemented as Linked List ...u have normal stack with
> > > push,pop and top
> >
> > > How to do this ??
> >
> > > --
> > > 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.



[algogeeks] Important

2011-08-22 Thread Mangal Dass
Anybody pls tell me the questions coming into Information-Mosaic campus test.
Mosaic has changed its pattern.
Pls post both the pattern as well as questions(if something u remembered) .

Thanks a lot,

-- 
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] Re: Amazon Ques

2011-08-22 Thread shady
i wish u had read the question... it is simple.. push to new stack and then
pop back... number of elements count need to be there

On Mon, Aug 22, 2011 at 7:44 PM, muthu raj  wrote:

> No need to count the number of nodes. Since its implemented as a linked
> list traverse the list with two two pointers one incremented one node next
> and other incremented two nodes next simultaneously.
>
> void delete_MiddleStack(node **h)
> {
>
>  if(*h==NULL)
>  return;
>  node *p,*q;
> p=*h;
>   q=*h;
>  while(q->next!=NULL)
> {
> p=p->next;
> if(q->next==NULL)
> q=q->next;
>   else q=q->next->next;
> }
> p->ele=p->next->ele;
> q=p->next;
> p->next=p->next->next;
> free(q);
> }
>
>
>
>
>
>
>
> *Muthuraj R
> IV th Year , ISE
> PESIT , Bangalore*
>
>
>
>
> On Mon, Aug 22, 2011 at 5:08 AM, vikas wrote:
>
>> why to bother this much...? just count the elements when popping and
>> output the middle one .
>> while(!s.empty()){
>> e= s.pop()
>> count++
>> q.enq(e);
>> }
>>
>> count <<= 2;
>>
>> while(count){
>> e = q.deq();
>> s.push(e);
>> count --;
>> }
>> output s.top()
>>
>> while(!q.empty()){
>> e = q.deq();
>> s.push(e);
>> }
>>
>>
>> On Aug 22, 4:27 pm, Shravan Kumar  wrote:
>> > Pop each element and en-queue it twice and de-queue it once. When stack
>> is
>> > empty the front of the queue will be middle element.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > On Mon, Aug 22, 2011 at 4:01 PM, Ankur Garg 
>> wrote:
>> > > Find the middle of the stack..(Time complexity should be minimum)
>> >
>> > > Stack is not implemented as Linked List ...u have normal stack with
>> > > push,pop and top
>> >
>> > > How to do this ??
>> >
>> > > --
>> > > 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] Mentor Graphics Help !!

2011-08-22 Thread Mangal Dass
Anybody pls tell me the questions coming into Information-Mosaic campus test.
Pls tell me both the pattern as well as questions whatever u r remembered.

Thanks a lot,

On 8/22/11, sourabh jakhar  wrote:
> i also want to know abt the off campus recruitment  of mentor graphics
> On Mon, Aug 22, 2011 at 6:49 PM, Decipher  wrote:
>
>> Can anyone tell me the interview procedure of Mentor Graphics along with
>> some interview questions ??
>>
>> --
>> 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/-/NiJZzcypKH0J.
>> 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.
>>
>
>
>
> --
> SOURABH JAKHAR,(CSE)(Final year)
> ROOM NO 167 ,
> TILAK,HOSTEL
> 'MNNIT ALLAHABAD
>
> The Law of Win says, "Let's not do it your way or my way; let's do it the
> best way."
>
> --
> 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.



  1   2   >