Re: [algogeeks] ITS NOT FAKE... Plz read and forward it.( From Micosoft Bill Gates)

2011-08-01 Thread karan sachan
+1

On Tue, Aug 2, 2011 at 11:47 AM, Prem Krishna Chettri wrote:

> This is Really Junk. Guys Dont Send Spam
>
> Thx
>
> On Mon, Aug 1, 2011 at 11:00 PM, Vamsi Achyuth wrote:
>
>> - Forwarded Message 
>> *From:* Dileep Kumar Gangunta 
>> *To:* mdbedu_dil...@yahoo.co.in
>> *Sent:* Mon, 1 August, 2011 11:37:59 AM
>> *Subject:* Fw: Plz read and forward it.( From Micosoft Bill Gates)
>>
>>
>> Thanks and Have a Nice day.
>>
>> Dileep Kumar.Gangunta
>> BCP India Design Center
>> Caterpillar India Private Ltd
>> Melnallathur, Thiruvallur Dist - 602004
>> TamilNadu, India.
>> - Forwarded by Dileep Kumar Gangunta/1Z/Caterpillar on 08/01/2011
>> 11:37 AM -
>>   *Krishnan Munirathinam/1Z/Caterpillar*
>>
>> 07/29/2011 04:46 PM
>>To
>> Senthil Kumar Rajendran/1Z/Caterpillar@Caterpillar, kichakr...@yahoo.com,
>> Ramesh Babu Sakthivel/1Z/Caterpillar@Caterpillar, Jagadeesan
>> Subramanian/1Z/Caterpillar@Caterpillar, Sriram
>> Vellimalai/1Z/Caterpillar@Caterpillar, Deepak Arockiaraj
>> Narsitty/1Z/Caterpillar@Caterpillar, Dileep Kumar
>> Gangunta/1Z/Caterpillar@Caterpillar
>> cc
>>
>>  Subject
>> Fw: Plz read and forward it.( From Micosoft Bill Gates)
>>
>>
>>
>> Caterpillar: Confidential GreenRetain Until: 08/28/2011
>>
>>
>>
>> fyi
>>
>> Regards,
>> Krishnan Munirathinam
>> Team Leader - CCE
>>
>> BCP India Design Center, Caterpillar India Private Ltd,
>> Thiruvallur-602004, India.
>> Direct : + 91 44 4760 0648
>> - Forwarded by Krishnan Munirathinam/1Z/Caterpillar on 07/29/2011
>> 04:44 PM -
>>   *"Nagesh, Eattiyappan - PD" *
>>
>> 07/29/2011 04:42 PM
>>To
>>
>>  cc
>>
>>  Subject
>> FW: Fw: Fwd: Plz read and forward it.( From Micosoft Bill Gates)
>>
>>
>>
>> Caterpillar: Confidential GreenRetain Until: 08/28/2011
>>
>>
>>
>>
>>
>>
>>
>> Regards,
>>
>> *E.Nagesh*
>> PD - Prototype
>> Ext No - 186 *
>> Mobile: 9944406450*
>>
>> This e-mail message is intended only for the use of the named recipient(s)
>> and contains information which may be confidential or privileged. If you are
>> not the intended recipient, be aware that any distribution, or use of the
>> contents of this information is prohibited. If you have received this
>> electronic transmission in error, please notify the sender and delete the
>> material from the computer.
>>
>>
>>
>>
>>
>>
>> --
>> *From:* MURALI R.SURESH [mailto:suresh9...@gmail.com] *
>> Sent:* Friday, July 29, 2011 4:19 PM*
>> To:* a_ramesh94...@yahoo.in; aak1...@rediffmail.com; ABDUL HAKKEEM;
>> abhinandan987; abuse; adept_itech; advbeebhoo; adzmedia.net;
>> aiaa_n...@yahoo.com; aith_help2...@yahoomail.com; aj3...@makefortunes.com;
>> akgola_1...@yahoo.co.in; aksmo...@rediffmail.com; alageshgo...@gmail.com;
>> alakeshdas2...@rediffmail.com; allcantalk; aloksur_...@rediffmail.com;
>> alpssoft...@yahoo.com; amalas...@hotmail.com; anandmorey;
>> andyxo...@gmail.com; angaravijayasek...@yahoo.co.in;
>> anjikumar...@gmail.com; antersu...@rediffmail.com; apaki...@yahoo.co.in;
>> apa...@acop.com; ark_ark_...@indiatimes.com; aruka...@gmail.com;
>> arulsiva1...@rediffmail.com; asha.ta...@gmail.com;
>> as...@reddipoguymail.com; ashokde...@yahoo.com; avinashasabe;
>> ayyapparaju_i...@yahoo.in; ayyapparajui...@yahoo.com; balapodhu; bdgs63;
>> bharath...@gmail.com; blrselvaraj; brian.arrindell; bvjagan2009;
>> chulbulpand...@yahoo.com; cibyja...@abcofwealth.net; complaint; contact;
>> cool.irshad_a...@rediffmail.com; c...@ymail.com; crpasha;
>> customerc...@idbibank.com; dpgmur...@gmail.com; d...@kpm.sfl.co.in;
>> d...@kpmsfl.co.in; Nagesh, Eattiyappan - PD; english.lecturer.learner;
>> finein...@rediffmail.com; gnandakumar108; gokul5620; Gopinath
>> Jothiramalingam; govardhannaidu_m; hi2vijay; hivijay;
>> hkharikrishn...@gmail.com; i...@fineindia.net; i...@soliquea.com;
>> jaiindi...@gmail.com; Jakob Lueck; jassi; Joy Benson; kadiresanr;
>> kiranjanakam; kriis...@yahoo.com; krish_t...@yahoo.com;
>> krish...@gmail.com; Krishnamurthy N; kshypananth;
>> mail2.abhiku...@gmail.com; mainpal...@yahoo.co.in; mainpal...@yahoo.co.in;
>> make4u@gmail.com; manaruddin.sk; manoharanr86; manojk495;
>> mariappantnp; mehul1212; micheal benjamin; michkae...@yahoo.com;
>> mmadan1...@gmail.com; Mohammad Nasser; mpchandrareddy; msakthivel1969;
>> msanke...@gmail.com; mukeshpd.asn; murali19...@gmail.com; murali251069;
>> myservi...@relianceada.com; nandu1958; naveena.ck;
>> networkerswelfaretrust; ngramachandra; NitinRajSale; padmalochanmohanta;
>> pawans0203; pradeepsungs...@gmail.com; pranab_barman2...@rediffmail.com;
>> prvnraaj; ptgeorgekerala; pvc786; r.jaganat...@ymail.com; rabifine2009;
>> Rajesh Kamdar; rajesh.1...@rediffmail.com; rajesh.c1...@rediffmail.com;
>> rajeshcoolka...@gmail.com; rajkamal.k2008; rajv...@in.com; ramkv03;
>> ramk...@rediffmail.com; ramk...@yahoo.com; ravi071002; ravijai1959;
>> reachsal...@yahoo.com; ref...@fineindia.net; rekha.thaku...@gmail.com;
>> rmpvravi; rprakash17; sabirbasha63; saicool_sun.

[algogeeks] MS

2011-08-01 Thread Kamakshii Aggarwal
Given a rectangle with known width and height, design an algorithm to fill
the rectangle using n squares(n is integer given) and make sure in the
result the wasting area is minimized. Length of square doesn't have to be
integer.
i.e, given width=3,height=2,n=5, one solution is that rectangle can be
filled with five 1x1 squares and the wasting area is 1. Another solution
could be filled with five 0.9x0.9 squares, but the wasting area is more than
first solution.

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



Re: [algogeeks] ITS NOT FAKE... Plz read and forward it.( From Micosoft Bill Gates)

2011-08-01 Thread Prem Krishna Chettri
This is Really Junk. Guys Dont Send Spam

Thx

On Mon, Aug 1, 2011 at 11:00 PM, Vamsi Achyuth wrote:

> - Forwarded Message 
> *From:* Dileep Kumar Gangunta 
> *To:* mdbedu_dil...@yahoo.co.in
> *Sent:* Mon, 1 August, 2011 11:37:59 AM
> *Subject:* Fw: Plz read and forward it.( From Micosoft Bill Gates)
>
>
> Thanks and Have a Nice day.
>
> Dileep Kumar.Gangunta
> BCP India Design Center
> Caterpillar India Private Ltd
> Melnallathur, Thiruvallur Dist - 602004
> TamilNadu, India.
> - Forwarded by Dileep Kumar Gangunta/1Z/Caterpillar on 08/01/2011 11:37
> AM -
>   *Krishnan Munirathinam/1Z/Caterpillar*
>
> 07/29/2011 04:46 PM
>To
> Senthil Kumar Rajendran/1Z/Caterpillar@Caterpillar, kichakr...@yahoo.com,
> Ramesh Babu Sakthivel/1Z/Caterpillar@Caterpillar, Jagadeesan
> Subramanian/1Z/Caterpillar@Caterpillar, Sriram
> Vellimalai/1Z/Caterpillar@Caterpillar, Deepak Arockiaraj
> Narsitty/1Z/Caterpillar@Caterpillar, Dileep Kumar
> Gangunta/1Z/Caterpillar@Caterpillar
> cc
>
>  Subject
> Fw: Plz read and forward it.( From Micosoft Bill Gates)
>
>
>
> Caterpillar: Confidential GreenRetain Until: 08/28/2011
>
>
>
> fyi
>
> Regards,
> Krishnan Munirathinam
> Team Leader - CCE
>
> BCP India Design Center, Caterpillar India Private Ltd, Thiruvallur-602004,
> India.
> Direct : + 91 44 4760 0648
> - Forwarded by Krishnan Munirathinam/1Z/Caterpillar on 07/29/2011 04:44
> PM -
>   *"Nagesh, Eattiyappan - PD" *
>
> 07/29/2011 04:42 PM
>To
>
>  cc
>
>  Subject
> FW: Fw: Fwd: Plz read and forward it.( From Micosoft Bill Gates)
>
>
>
> Caterpillar: Confidential GreenRetain Until: 08/28/2011
>
>
>
>
>
>
>
> Regards,
>
> *E.Nagesh*
> PD - Prototype
> Ext No - 186 *
> Mobile: 9944406450*
>
> This e-mail message is intended only for the use of the named recipient(s)
> and contains information which may be confidential or privileged. If you are
> not the intended recipient, be aware that any distribution, or use of the
> contents of this information is prohibited. If you have received this
> electronic transmission in error, please notify the sender and delete the
> material from the computer.
>
>
>
>
>
>
> --
> *From:* MURALI R.SURESH [mailto:suresh9...@gmail.com] *
> Sent:* Friday, July 29, 2011 4:19 PM*
> To:* a_ramesh94...@yahoo.in; aak1...@rediffmail.com; ABDUL HAKKEEM;
> abhinandan987; abuse; adept_itech; advbeebhoo; adzmedia.net;
> aiaa_n...@yahoo.com; aith_help2...@yahoomail.com; aj3...@makefortunes.com;
> akgola_1...@yahoo.co.in; aksmo...@rediffmail.com; alageshgo...@gmail.com;
> alakeshdas2...@rediffmail.com; allcantalk; aloksur_...@rediffmail.com;
> alpssoft...@yahoo.com; amalas...@hotmail.com; anandmorey;
> andyxo...@gmail.com; angaravijayasek...@yahoo.co.in;
> anjikumar...@gmail.com; antersu...@rediffmail.com; apaki...@yahoo.co.in;
> apa...@acop.com; ark_ark_...@indiatimes.com; aruka...@gmail.com;
> arulsiva1...@rediffmail.com; asha.ta...@gmail.com;
> as...@reddipoguymail.com; ashokde...@yahoo.com; avinashasabe;
> ayyapparaju_i...@yahoo.in; ayyapparajui...@yahoo.com; balapodhu; bdgs63;
> bharath...@gmail.com; blrselvaraj; brian.arrindell; bvjagan2009;
> chulbulpand...@yahoo.com; cibyja...@abcofwealth.net; complaint; contact;
> cool.irshad_a...@rediffmail.com; c...@ymail.com; crpasha;
> customerc...@idbibank.com; dpgmur...@gmail.com; d...@kpm.sfl.co.in;
> d...@kpmsfl.co.in; Nagesh, Eattiyappan - PD; english.lecturer.learner;
> finein...@rediffmail.com; gnandakumar108; gokul5620; Gopinath
> Jothiramalingam; govardhannaidu_m; hi2vijay; hivijay;
> hkharikrishn...@gmail.com; i...@fineindia.net; i...@soliquea.com;
> jaiindi...@gmail.com; Jakob Lueck; jassi; Joy Benson; kadiresanr;
> kiranjanakam; kriis...@yahoo.com; krish_t...@yahoo.com; krish...@gmail.com;
> Krishnamurthy N; kshypananth; mail2.abhiku...@gmail.com;
> mainpal...@yahoo.co.in; mainpal...@yahoo.co.in; make4u@gmail.com;
> manaruddin.sk; manoharanr86; manojk495; mariappantnp; mehul1212; micheal
> benjamin; michkae...@yahoo.com; mmadan1...@gmail.com; Mohammad Nasser;
> mpchandrareddy; msakthivel1969; msanke...@gmail.com; mukeshpd.asn;
> murali19...@gmail.com; murali251069; myservi...@relianceada.com;
> nandu1958; naveena.ck; networkerswelfaretrust; ngramachandra;
> NitinRajSale; padmalochanmohanta; pawans0203; pradeepsungs...@gmail.com;
> pranab_barman2...@rediffmail.com; prvnraaj; ptgeorgekerala; pvc786;
> r.jaganat...@ymail.com; rabifine2009; Rajesh Kamdar;
> rajesh.1...@rediffmail.com; rajesh.c1...@rediffmail.com;
> rajeshcoolka...@gmail.com; rajkamal.k2008; rajv...@in.com; ramkv03;
> ramk...@rediffmail.com; ramk...@yahoo.com; ravi071002; ravijai1959;
> reachsal...@yahoo.com; ref...@fineindia.net; rekha.thaku...@gmail.com;
> rmpvravi; rprakash17; sabirbasha63; saicool_sun...@hotmail.com;
> sa...@efmmail.com; salujasac...@hotmail.com; sandymishra8...@gmail.com;
> sanju23.1...@rediaffmail.com; sanju23.1...@rediffmail.com; saravanan.m;
> sce.prepr...@gmail.com; selvamala4..

Re: [algogeeks] need help

2011-08-01 Thread Rajeev Kumar
go to this link and upload ur resume...they will call if they feel it is
good
http://www.india.amazon.com/Careers/



On Mon, Aug 1, 2011 at 11:58 PM, coder dumca  wrote:

> hi frnds
> can any body tell me how a student can appear for amazon or microsoft , if
> these comanies are not coming to the campus.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Sort IT

2011-08-01 Thread Ravinder Kumar
I have little thought on this :

divide the whole array by n and store their remainder also in an array
now number in original array are in range 1-n
sort the array and when two number with same break the tie using remainder
array
recreate the array using remainder array .
-- 
*With Regards :*

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

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Sort IT

2011-08-01 Thread kumar raja
@ankit:
Thats what i am saying as well .If The range is till N^2. how can we sort it
in linear time??
If you know the answer please post it.

On 1 August 2011 21:47, ankit sambyal  wrote:

> @raja : The range is 1-N^2 and not 1-N. Had it been 1-N , we could have
> easily sorted the array in O(N) time using bit map.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



Re: [algogeeks] How to write the algorithm for longest increasing subsequence problem with complexity O(n logn)

2011-08-01 Thread kumar raja
@coder:
How is that??

On 1 August 2011 11:43, coder dumca  wrote:

> it can be done in O(n)
>
>
> On Mon, Aug 1, 2011 at 5:37 AM, kumar raja wrote:
>
>> I have seen the code in algorithmist ,but i am not getting it.
>>
>> @Piyush
>>
>> how will u solve it using 2-4 tree
>>
>> On 31 July 2011 23:39, Piyush Gaurav  wrote:
>>
>>> u need a 2,4 tree for dat
>>>
>>>
>>> On 1 August 2011 11:59, Amol Sharma  wrote:
>>>
 can be done with some modification on dp solution of O(n^2).

 i am comfortable with the O(n^2) solution. but i am also having
 difficulty in O(nlogn) solution

 check this link
 http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence


 --


 Amol Sharma
 Third Year Student
 Computer Science and Engineering
 MNNIT Allahabad




 On Mon, Aug 1, 2011 at 11:49 AM, kumar raja 
 wrote:

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

>>>
>>>
>>>
>>> --
>>> 3rd Year student
>>> Dept. of Computer Science and Engineering
>>> IIT Kharagpur.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



Re: [algogeeks] Feedback of the book!!!!!!!

2011-08-01 Thread karan sachan
yep...it contains solution to not all but most of the questions.

On Mon, Aug 1, 2011 at 1:12 PM, AMAN AGARWAL  wrote:

> Does it also contains the solutions of the questions???
> Is it worth buying. ???
>
>
>
> On Mon, Aug 1, 2011 at 12:36 PM, rajeev bharshetty 
> wrote:
>
>> Awesome Book ,for interviews : Covers wide range of interview questions .
>>
>> On Mon, Aug 1, 2011 at 12:23 PM, AMAN AGARWAL wrote:
>>
>>> Hi,
>>>
>>> I am planning to buy a book
>>>
>>> cracking the coding interview by Gayle Laakmann. Please give your
>>> feedbacks.
>>>
>>>
>>>
>>> --
>>> AMAN AGARWAL
>>> "Success is not final, Failure is not fatal: It is the courage to
>>> continue that counts!"
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Rajeev N B 
>>
>> "*Winners Don't do Different things , they do things Differently"*
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> AMAN AGARWAL
> "Success is not final, Failure is not fatal: It is the courage to continue
> that counts!"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 & Regards,
Karan Sachan | Software Engineer
Motorola Mobility Inc.| Bangalore
Mobile: +91-966-337-3478

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] ITS NOT FAKE... Plz read and forward it.( From Micosoft Bill Gates)

2011-08-01 Thread shady
banned!

On Mon, Aug 1, 2011 at 11:00 PM, Vamsi Achyuth wrote:

> - Forwarded Message 
> *From:* Dileep Kumar Gangunta 
> *To:* mdbedu_dil...@yahoo.co.in
> *Sent:* Mon, 1 August, 2011 11:37:59 AM
> *Subject:* Fw: Plz read and forward it.( From Micosoft Bill Gates)
>
>
> Thanks and Have a Nice day.
>
> Dileep Kumar.Gangunta
> BCP India Design Center
> Caterpillar India Private Ltd
> Melnallathur, Thiruvallur Dist - 602004
> TamilNadu, India.
> - Forwarded by Dileep Kumar Gangunta/1Z/Caterpillar on 08/01/2011 11:37
> AM -
>   *Krishnan Munirathinam/1Z/Caterpillar*
>
> 07/29/2011 04:46 PM
>To
> Senthil Kumar Rajendran/1Z/Caterpillar@Caterpillar, kichakr...@yahoo.com,
> Ramesh Babu Sakthivel/1Z/Caterpillar@Caterpillar, Jagadeesan
> Subramanian/1Z/Caterpillar@Caterpillar, Sriram
> Vellimalai/1Z/Caterpillar@Caterpillar, Deepak Arockiaraj
> Narsitty/1Z/Caterpillar@Caterpillar, Dileep Kumar
> Gangunta/1Z/Caterpillar@Caterpillar
> cc
>
>  Subject
> Fw: Plz read and forward it.( From Micosoft Bill Gates)
>
>
>
> Caterpillar: Confidential GreenRetain Until: 08/28/2011
>
>
>
> fyi
>
> Regards,
> Krishnan Munirathinam
> Team Leader - CCE
>
> BCP India Design Center, Caterpillar India Private Ltd, Thiruvallur-602004,
> India.
> Direct : + 91 44 4760 0648
> - Forwarded by Krishnan Munirathinam/1Z/Caterpillar on 07/29/2011 04:44
> PM -
>   *"Nagesh, Eattiyappan - PD" *
>
> 07/29/2011 04:42 PM
>To
>
>  cc
>
>  Subject
> FW: Fw: Fwd: Plz read and forward it.( From Micosoft Bill Gates)
>
>
>
> Caterpillar: Confidential GreenRetain Until: 08/28/2011
>
>
>
>
>
>
>
> Regards,
>
> *E.Nagesh*
> PD - Prototype
> Ext No - 186 *
> Mobile: 9944406450*
>
> This e-mail message is intended only for the use of the named recipient(s)
> and contains information which may be confidential or privileged. If you are
> not the intended recipient, be aware that any distribution, or use of the
> contents of this information is prohibited. If you have received this
> electronic transmission in error, please notify the sender and delete the
> material from the computer.
>
>
>
>
>
>
> --
> *From:* MURALI R.SURESH [mailto:suresh9...@gmail.com] *
> Sent:* Friday, July 29, 2011 4:19 PM*
> To:* a_ramesh94...@yahoo.in; aak1...@rediffmail.com; ABDUL HAKKEEM;
> abhinandan987; abuse; adept_itech; advbeebhoo; adzmedia.net;
> aiaa_n...@yahoo.com; aith_help2...@yahoomail.com; aj3...@makefortunes.com;
> akgola_1...@yahoo.co.in; aksmo...@rediffmail.com; alageshgo...@gmail.com;
> alakeshdas2...@rediffmail.com; allcantalk; aloksur_...@rediffmail.com;
> alpssoft...@yahoo.com; amalas...@hotmail.com; anandmorey;
> andyxo...@gmail.com; angaravijayasek...@yahoo.co.in;
> anjikumar...@gmail.com; antersu...@rediffmail.com; apaki...@yahoo.co.in;
> apa...@acop.com; ark_ark_...@indiatimes.com; aruka...@gmail.com;
> arulsiva1...@rediffmail.com; asha.ta...@gmail.com;
> as...@reddipoguymail.com; ashokde...@yahoo.com; avinashasabe;
> ayyapparaju_i...@yahoo.in; ayyapparajui...@yahoo.com; balapodhu; bdgs63;
> bharath...@gmail.com; blrselvaraj; brian.arrindell; bvjagan2009;
> chulbulpand...@yahoo.com; cibyja...@abcofwealth.net; complaint; contact;
> cool.irshad_a...@rediffmail.com; c...@ymail.com; crpasha;
> customerc...@idbibank.com; dpgmur...@gmail.com; d...@kpm.sfl.co.in;
> d...@kpmsfl.co.in; Nagesh, Eattiyappan - PD; english.lecturer.learner;
> finein...@rediffmail.com; gnandakumar108; gokul5620; Gopinath
> Jothiramalingam; govardhannaidu_m; hi2vijay; hivijay;
> hkharikrishn...@gmail.com; i...@fineindia.net; i...@soliquea.com;
> jaiindi...@gmail.com; Jakob Lueck; jassi; Joy Benson; kadiresanr;
> kiranjanakam; kriis...@yahoo.com; krish_t...@yahoo.com; krish...@gmail.com;
> Krishnamurthy N; kshypananth; mail2.abhiku...@gmail.com;
> mainpal...@yahoo.co.in; mainpal...@yahoo.co.in; make4u@gmail.com;
> manaruddin.sk; manoharanr86; manojk495; mariappantnp; mehul1212; micheal
> benjamin; michkae...@yahoo.com; mmadan1...@gmail.com; Mohammad Nasser;
> mpchandrareddy; msakthivel1969; msanke...@gmail.com; mukeshpd.asn;
> murali19...@gmail.com; murali251069; myservi...@relianceada.com;
> nandu1958; naveena.ck; networkerswelfaretrust; ngramachandra;
> NitinRajSale; padmalochanmohanta; pawans0203; pradeepsungs...@gmail.com;
> pranab_barman2...@rediffmail.com; prvnraaj; ptgeorgekerala; pvc786;
> r.jaganat...@ymail.com; rabifine2009; Rajesh Kamdar;
> rajesh.1...@rediffmail.com; rajesh.c1...@rediffmail.com;
> rajeshcoolka...@gmail.com; rajkamal.k2008; rajv...@in.com; ramkv03;
> ramk...@rediffmail.com; ramk...@yahoo.com; ravi071002; ravijai1959;
> reachsal...@yahoo.com; ref...@fineindia.net; rekha.thaku...@gmail.com;
> rmpvravi; rprakash17; sabirbasha63; saicool_sun...@hotmail.com;
> sa...@efmmail.com; salujasac...@hotmail.com; sandymishra8...@gmail.com;
> sanju23.1...@rediaffmail.com; sanju23.1...@rediffmail.com; saravanan.m;
> sce.prepr...@gmail.com; selvamala4...@rediffmail.com; selvarajblr;
> senguttuva...@gma

Re: [algogeeks] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-08-01 Thread coder dumca
@ vaibhav   when we  are sure that we  dont need a particular object we can
call gc

On Mon, Aug 1, 2011 at 1:46 AM, Deepthi Srinivasan wrote:

> Garbage collector'll never run according to our whims and fancies :P It'll
> run only when it wants (mostly when it senses that memory is going down). We
> can issue a request using system.gc but we cannot MAKE it run...
>
>
> On Sun, Jul 31, 2011 at 11:56 PM, vaibhav shukla 
> wrote:
>
>> @mr coder : y do we need to call garbage collector explicitly when it
>> works automatically ?
>>
>>
>> On Sun, Jul 31, 2011 at 11:07 PM, coder dumca wrote:
>>
>>> generally jvm runs on following occasions
>>>
>>> 1: periodicaliy
>>> 2: when program is about to run out of memory the  JVM runs  and
>>> finallize the objects.
>>> 3: when we call using System.gc  or Runtime.getruntime.gc
>>>
>>> pls correct me if i m wrong
>>>
>>> On Sat, Jul 30, 2011 at 11:10 AM, vaibhav shukla <
>>> vaibhav200...@gmail.com> wrote:
>>>
 please give a glimps of how garbage collection is done in java.
 how *System.gc()*  works ?

 --
   best wishes!!
 Vaibhav


 --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>>   best wishes!!
>> Vaibhav
>>   MCA
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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,
> Deepthi
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] need help

2011-08-01 Thread coder dumca
hi frnds
can any body tell me how a student can appear for amazon or microsoft , if
these comanies are not coming to the campus.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Max subarray of no 2 adjacent elements

2011-08-01 Thread coder dumca
i think the answer should be 15

On Mon, Aug 1, 2011 at 12:46 PM, Abhishek Gupta wrote:

> let the array be A={ 3,5,7,10} then it should give output as 13 (3+10)
>
> In short, we need to find the possible maximum sum such that no 2 elements
> in the subarray has 2 elements adjacent. there is no bound on the size of
> subarray.
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] virtual functions output

2011-08-01 Thread coder dumca
base class constructor are called before derived class construtors.

Base* pBase = new Derived();  statement creates a derived class
object hence calls derived class condstructor, which calls base call
constructor. base class constructor calls fun()  which prints  " Base
Function".


pls correct me  if i m wrong
On Mon, Aug 1, 2011 at 9:37 AM, sivaviknesh s wrote:

>
>  #include
> #include
>
> using namespace std;
>
> class Base
> {
> public:
>   Base()
>   {
> fun(); //note: fun() is virtual
>   }
>   virtual void fun()
>   {
> cout<<"\nBase Function";
>   }
> };
>
> class Derived: public Base
> {
> public:
>   Derived(){}
>   virtual void fun()
>   {
> cout<<"\nDerived Function";
>   }
> };
>
> int main()
> {
>   Base* pBase = new Derived();
>   delete pBase;
>
>   getchar();
>   return 0;
> }
>
> Output:
> *Base Function*
>
> See following excerpt from C++ 
> standardfor
>  explanation.
>
> *When a virtual function is called directly or indirectly from a
> constructor (including from the mem-initializer for a data member) or from a
> destructor, and the object to which the call applies is the object under
> construction or destruction, the function called is the one defined in the
> constructor or destructor’s own class or in one of its bases, but not a
> function overriding it in a class derived from the constructor or
> destructor’s class, or overriding it in one of the other base classes of the
> most derived object.*
>
> Because of this difference in behavior, it is recommended that object’s
> virtual function is not invoked while it is being constructed or destroyed.
> See this
> for
> more details.
> ..CAN ANYONE GIVE A SIMPLE EXPLANANTION?? given explanation is
> quite confusing
>
> --
> 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] How to write the algorithm for longest increasing subsequence problem with complexity O(n logn)

2011-08-01 Thread coder dumca
it can be done in O(n)

On Mon, Aug 1, 2011 at 5:37 AM, kumar raja  wrote:

> I have seen the code in algorithmist ,but i am not getting it.
>
> @Piyush
>
> how will u solve it using 2-4 tree
>
> On 31 July 2011 23:39, Piyush Gaurav  wrote:
>
>> u need a 2,4 tree for dat
>>
>>
>> On 1 August 2011 11:59, Amol Sharma  wrote:
>>
>>> can be done with some modification on dp solution of O(n^2).
>>>
>>> i am comfortable with the O(n^2) solution. but i am also having
>>> difficulty in O(nlogn) solution
>>>
>>> check this link
>>> http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence
>>>
>>>
>>> --
>>>
>>>
>>> Amol Sharma
>>> Third Year Student
>>> Computer Science and Engineering
>>> MNNIT Allahabad
>>>
>>>
>>>
>>>
>>> On Mon, Aug 1, 2011 at 11:49 AM, kumar raja wrote:
>>>


 --
 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.
>>>
>>
>>
>>
>> --
>> 3rd Year student
>> Dept. of Computer Science and Engineering
>> IIT Kharagpur.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] ADT

2011-08-01 Thread Dipankar Patro
Well,
To understand it better, do you know about data abstraction in C++?
Its the hiding of data and programs implementations and just let you know
what the program does.

Similarly ADT are similar to normal data types, with their own functions
associated with them. To use ADT you need not know how it is developed. You
just need to know how to use them.

For example STACK. You need to know only three functions to use a STACK,
push, pop, and peek. Rest you don't have to care how it is implemented and
how it is working.

I hope you get it. If you have any specific, feel free to counter question.

On 1 August 2011 20:41, Priyanka  wrote:

> hai can anybody tell what is abstract datatype clearly??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
___

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Feedback of the book!!!!!!!

2011-08-01 Thread AMAN AGARWAL
Does it also contains the solutions of the questions???
Is it worth buying. ???



On Mon, Aug 1, 2011 at 12:36 PM, rajeev bharshetty wrote:

> Awesome Book ,for interviews : Covers wide range of interview questions .
>
> On Mon, Aug 1, 2011 at 12:23 PM, AMAN AGARWAL wrote:
>
>> Hi,
>>
>> I am planning to buy a book
>>
>> cracking the coding interview by Gayle Laakmann. Please give your
>> feedbacks.
>>
>>
>>
>> --
>> AMAN AGARWAL
>> "Success is not final, Failure is not fatal: It is the courage to continue
>> that counts!"
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Regards
> Rajeev N B 
>
> "*Winners Don't do Different things , they do things Differently"*
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
AMAN AGARWAL
"Success is not final, Failure is not fatal: It is the courage to continue
that counts!"

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: reason?????????

2011-08-01 Thread Dipankar Patro
1. When you are using %u, it is for unsigned printing.

2. looking at the loop, it will run for only values of i
for(i<=5 && i>=-1;++i;i>0)
^^ the first statement here is not the conditional one.

3. since int is of 4 bytes on your system, the max positive value it will
print is power(2, 32) - 1. (4 bytes = 32 bits)

if suppose you used unsigned int, then that would have been an infinite
loop. since the condition is i>=-1. each time you incremented the value of i
, it would have been between (0, 2^64-1) only.


On 2 August 2011 03:16, Dharmendra Modi wrote:

> The first part initialization of for loop (i<=5 && i>=-1) is just an
> initialization and nothing else. It is of no use in this case.
>
> The second part condition holds the condition which is in this case +
> +i specifying to run loop till i is non zero. You are using prefix
> operator hence it will first increment i and then test.
> If you have used i++ the loop wont even have executed single time.
>
> The condition ++i becomes zero when there is round of short and you
> get zero at that time the loop terminates.
>
> The format specifier for unsigned int is used hence positive values
> are printed.
> If the format specifier for %d is used then the results would be more
> informative.
>
> Hope that helps.
>
> On Aug 1, 11:51 pm, jagrati verma  wrote:
> > #include
> > main()
> > {
> > short int i=0;
> > for(i<=5 && i>=-1;++i;i>0)
> > printf("%u\n",i);
> > printf("\n");
> > return 0;}
> >
> >o/p is 1.
> > 4294967295 hw???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
___

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: ADT

2011-08-01 Thread Dipankar Patro
No. It is a basic data type which is used to make an ADT.

I don't know whether you have gone through this link, but I think it has
explained it properly
http://www.dba-oracle.com/t_object_encapsulation_abstract.htm

On 1 August 2011 23:01, Priyanka  wrote:

>
>
> On Aug 1, 9:19 pm, pandharinath gorde 
> wrote:
> > ADT means which will come with two things...
> > i.which type of value it contains
> > like suppose sone adt any which will have only integer like this
> > iiwhat are opeartion possible on it.
> > eg stack push and pop
> >
> > On Mon, Aug 1, 2011 at 8:41 PM, Priyanka  wrote:
> > > hai can anybody tell what is abstract datatype clearly??
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Algorithm Geeks" group.
> > > To post to this group, send email to algogeeks@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > algogeeks+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.
> >
> > --
> > Pandharinath Gorde
> > +91-9620557641
>
>
> k...is integer an adt?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
___

Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] ITS NOT FAKE... Plz read and forward it.( From Micosoft Bill Gates)

2011-08-01 Thread Vamsi Achyuth
- Forwarded Message 
*From:* Dileep Kumar Gangunta 
*To:* mdbedu_dil...@yahoo.co.in
*Sent:* Mon, 1 August, 2011 11:37:59 AM
*Subject:* Fw: Plz read and forward it.( From Micosoft Bill Gates)


Thanks and Have a Nice day.

Dileep Kumar.Gangunta
BCP India Design Center
Caterpillar India Private Ltd
Melnallathur, Thiruvallur Dist - 602004
TamilNadu, India.
- Forwarded by Dileep Kumar Gangunta/1Z/Caterpillar on 08/01/2011 11:37
AM -
  *Krishnan Munirathinam/1Z/Caterpillar*

07/29/2011 04:46 PM
   To
Senthil Kumar Rajendran/1Z/Caterpillar@Caterpillar, kichakr...@yahoo.com,
Ramesh Babu Sakthivel/1Z/Caterpillar@Caterpillar, Jagadeesan
Subramanian/1Z/Caterpillar@Caterpillar, Sriram
Vellimalai/1Z/Caterpillar@Caterpillar, Deepak Arockiaraj
Narsitty/1Z/Caterpillar@Caterpillar, Dileep Kumar
Gangunta/1Z/Caterpillar@Caterpillar
cc

 Subject
Fw: Plz read and forward it.( From Micosoft Bill Gates)



Caterpillar: Confidential GreenRetain Until: 08/28/2011



fyi

Regards,
Krishnan Munirathinam
Team Leader - CCE

BCP India Design Center, Caterpillar India Private Ltd, Thiruvallur-602004,
India.
Direct : + 91 44 4760 0648
- Forwarded by Krishnan Munirathinam/1Z/Caterpillar on 07/29/2011 04:44
PM -
  *"Nagesh, Eattiyappan - PD" *

07/29/2011 04:42 PM
   To

 cc

 Subject
FW: Fw: Fwd: Plz read and forward it.( From Micosoft Bill Gates)



Caterpillar: Confidential GreenRetain Until: 08/28/2011







Regards,

*E.Nagesh*
PD - Prototype
Ext No - 186 *
Mobile: 9944406450*

This e-mail message is intended only for the use of the named recipient(s)
and contains information which may be confidential or privileged. If you are
not the intended recipient, be aware that any distribution, or use of the
contents of this information is prohibited. If you have received this
electronic transmission in error, please notify the sender and delete the
material from the computer.






--
*From:* MURALI R.SURESH [mailto:suresh9...@gmail.com] *
Sent:* Friday, July 29, 2011 4:19 PM*
To:* a_ramesh94...@yahoo.in; aak1...@rediffmail.com; ABDUL HAKKEEM;
abhinandan987; abuse; adept_itech; advbeebhoo; adzmedia.net;
aiaa_n...@yahoo.com; aith_help2...@yahoomail.com; aj3...@makefortunes.com;
akgola_1...@yahoo.co.in; aksmo...@rediffmail.com; alageshgo...@gmail.com;
alakeshdas2...@rediffmail.com; allcantalk; aloksur_...@rediffmail.com;
alpssoft...@yahoo.com; amalas...@hotmail.com; anandmorey;
andyxo...@gmail.com; angaravijayasek...@yahoo.co.in; anjikumar...@gmail.com;
antersu...@rediffmail.com; apaki...@yahoo.co.in; apa...@acop.com;
ark_ark_...@indiatimes.com; aruka...@gmail.com; arulsiva1...@rediffmail.com;
asha.ta...@gmail.com; as...@reddipoguymail.com; ashokde...@yahoo.com;
avinashasabe; ayyapparaju_i...@yahoo.in; ayyapparajui...@yahoo.com;
balapodhu; bdgs63; bharath...@gmail.com; blrselvaraj; brian.arrindell;
bvjagan2009; chulbulpand...@yahoo.com; cibyja...@abcofwealth.net; complaint;
contact; cool.irshad_a...@rediffmail.com; c...@ymail.com; crpasha;
customerc...@idbibank.com; dpgmur...@gmail.com; d...@kpm.sfl.co.in;
d...@kpmsfl.co.in; Nagesh, Eattiyappan - PD; english.lecturer.learner;
finein...@rediffmail.com; gnandakumar108; gokul5620; Gopinath
Jothiramalingam; govardhannaidu_m; hi2vijay; hivijay;
hkharikrishn...@gmail.com; i...@fineindia.net; i...@soliquea.com;
jaiindi...@gmail.com; Jakob Lueck; jassi; Joy Benson; kadiresanr;
kiranjanakam; kriis...@yahoo.com; krish_t...@yahoo.com; krish...@gmail.com;
Krishnamurthy N; kshypananth; mail2.abhiku...@gmail.com;
mainpal...@yahoo.co.in; mainpal...@yahoo.co.in; make4u@gmail.com;
manaruddin.sk; manoharanr86; manojk495; mariappantnp; mehul1212; micheal
benjamin; michkae...@yahoo.com; mmadan1...@gmail.com; Mohammad Nasser;
mpchandrareddy; msakthivel1969; msanke...@gmail.com; mukeshpd.asn;
murali19...@gmail.com; murali251069; myservi...@relianceada.com; nandu1958;
naveena.ck; networkerswelfaretrust; ngramachandra; NitinRajSale;
padmalochanmohanta; pawans0203; pradeepsungs...@gmail.com;
pranab_barman2...@rediffmail.com; prvnraaj; ptgeorgekerala; pvc786;
r.jaganat...@ymail.com; rabifine2009; Rajesh Kamdar;
rajesh.1...@rediffmail.com; rajesh.c1...@rediffmail.com;
rajeshcoolka...@gmail.com; rajkamal.k2008; rajv...@in.com; ramkv03;
ramk...@rediffmail.com; ramk...@yahoo.com; ravi071002; ravijai1959;
reachsal...@yahoo.com; ref...@fineindia.net; rekha.thaku...@gmail.com;
rmpvravi; rprakash17; sabirbasha63; saicool_sun...@hotmail.com;
sa...@efmmail.com; salujasac...@hotmail.com; sandymishra8...@gmail.com;
sanju23.1...@rediaffmail.com; sanju23.1...@rediffmail.com; saravanan.m;
sce.prepr...@gmail.com; selvamala4...@rediffmail.com; selvarajblr;
senguttuva...@gmail.com; Shaik Abdul Khader Basha; shastri2...@yahoo.co.in;
shastrikartik1; shibil sn;
=?ISO-8859-1?Q?shrikkantshinde=40yahoo=2Ecom_mlr7771=40yahoo=2Ein_krishnamoorthyt50?=.=?ISO-8859-1?Q?=40yahoo=2Ecom_nirmala=5Fkarthi=40rediffmail=2Ecom_fineaazam786=40gmail=2E?=.=?ISO-8859-1?Q?com_shankar19

Re: [algogeeks] Max subarray of no 2 adjacent elements

2011-08-01 Thread coder dumca
this is the correct working code

#define size   8
void main()
{

int a[]={16,2,4,10,1,12,5,6};
int sum=0,i,index;

for(i=0;ia[i+1])
{
 sum=sum+a[i];
  index=i;
   i=i+2;
}
   else
   {
  sum=sum+a[i+1];
  index=i;
   i=i+3;
   }

}

if(i-index>1)
sum=sum+a[i];

printf("maximum sum is   %d",sum);
}




On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta wrote:

> @Kartik
>
> we cant choose adjacent elements. for ex A={5,2,1,7,9,11} then we will have
> 5+7+11
> can any one give any algo for this
> thank you
>
>
> On Mon, Aug 1, 2011 at 1:25 PM, kartik sachan wrote:
>
>> oh..got it i didn't read that statement:(
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] Sort IT

2011-08-01 Thread ankit sambyal
@raja : The range is 1-N^2 and not 1-N. Had it been 1-N , we could have
easily sorted the array in O(N) time using bit map.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-08-01 Thread kumar raja
@Rahul:
Can u tell me what is the main focus of Google ,what are the subjects to
study and mention some good resources to learn them..

On 1 August 2011 20:30, Rahul Singhal  wrote:

> @all:
> I have no idea about oracle, as i dont have ne interest in
> database.Regarding google, i m happy to help u.If u have more querirse can
> mail me.
>
>
> On Mon, Aug 1, 2011 at 9:41 PM, Supraja Jayakumar <
> suprajasank...@gmail.com> wrote:
>
>> Thanks Rahul. Very kind of you.
>> I wish you crack Google.
>>
>> All the best !
>>
>> Best
>> Supraja J
>>
>>
>> On Thu, Jul 28, 2011 at 6:24 AM, Rahul Menon wrote:
>>
>>> Hello friends,
>>>
>>> Recently I appeared for placement interviews for Amazon in my
>>> campus.Unfortunately though I couldn't make it, still want to share
>>> something for others here preparing for amazon interviews!
>>>
>>> First of all though it is very hard to crack, here are a few things
>>> which can make your preparation easier and effective!
>>>
>>> In the interview, I have found that most of the questions asked are
>>> repeated questions which are available online rather than any new
>>> questions they have made. A few examples are loop in a linked list,
>>> print all permuations of a string, binary search in a rotated array
>>> etc.. These all questions are very commonly found in websites like
>>> careercup.com and also in this google group. Instead of just going
>>> through hundreds of question be sure that you can perform the best of
>>> 100% if you are given from these frequently asked questions.
>>>
>>> Just to add, if you are very good in coding it's fine , else make sure
>>> that you can also code these above questions very well rather than
>>> just explaining the algos!. They will definitely ask you to code
>>> these!
>>>
>>> In " Cracking the coding interview" all the questions are very very
>>> important. To my astonishment most of the questions in the sections
>>> like Linked LIsts, Arrays, Trees and Graph, Recursion from the
>>> aforesaid book were asked in our interview!  So never miss reading and
>>> coding these questions before going to your interview.
>>>
>>> Though it's very weird to say, I would say that if you are very very
>>> good with these around 40 most frequently repeated questions, which
>>> can be collected through googling, your performance is almost 80%
>>> guaranteed in the interview. It's sure that you will have to face only
>>> a very few question outside from this. And if you are somewhat more
>>> good enough , you can easily make through to the AMAZON!
>>>
>>> All the best for all :)
>>> Repeating once again, rather than just reading through hundreds of
>>> questions it would be best if you practice coding and studying the few
>>> 30 interview questions! Else you will have to regret like me :|
>>>
>>>
>>> #We will be having Google on our campus soon! I'm totally strange to
>>> their selection process,tests and intreview, so if anyone have any
>>> idea please do share here! Thanks!
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> U
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Rahul singhal
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



Re: [algogeeks] Sort IT

2011-08-01 Thread kumar raja
How is it possible.If the range is 1 to N then we could use counting
sort.But how can we do it in linear time .Any kind of sorting algorithm
exists for this case??

On 1 August 2011 21:03, payel saha  wrote:

>
>
> You have an integer array of length N, containing values in the range
> 1,2,3…N^2. Sort the array in O(N) time
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



[algogeeks] Sort IT

2011-08-01 Thread payel saha
You have an integer array of length N, containing values in the range
1,2,3…N^2. Sort the array in O(N) time

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-08-01 Thread Rahul Singhal
@all:
I have no idea about oracle, as i dont have ne interest in
database.Regarding google, i m happy to help u.If u have more querirse can
mail me.

On Mon, Aug 1, 2011 at 9:41 PM, Supraja Jayakumar
wrote:

> Thanks Rahul. Very kind of you.
> I wish you crack Google.
>
> All the best !
>
> Best
> Supraja J
>
>
> On Thu, Jul 28, 2011 at 6:24 AM, Rahul Menon wrote:
>
>> Hello friends,
>>
>> Recently I appeared for placement interviews for Amazon in my
>> campus.Unfortunately though I couldn't make it, still want to share
>> something for others here preparing for amazon interviews!
>>
>> First of all though it is very hard to crack, here are a few things
>> which can make your preparation easier and effective!
>>
>> In the interview, I have found that most of the questions asked are
>> repeated questions which are available online rather than any new
>> questions they have made. A few examples are loop in a linked list,
>> print all permuations of a string, binary search in a rotated array
>> etc.. These all questions are very commonly found in websites like
>> careercup.com and also in this google group. Instead of just going
>> through hundreds of question be sure that you can perform the best of
>> 100% if you are given from these frequently asked questions.
>>
>> Just to add, if you are very good in coding it's fine , else make sure
>> that you can also code these above questions very well rather than
>> just explaining the algos!. They will definitely ask you to code
>> these!
>>
>> In " Cracking the coding interview" all the questions are very very
>> important. To my astonishment most of the questions in the sections
>> like Linked LIsts, Arrays, Trees and Graph, Recursion from the
>> aforesaid book were asked in our interview!  So never miss reading and
>> coding these questions before going to your interview.
>>
>> Though it's very weird to say, I would say that if you are very very
>> good with these around 40 most frequently repeated questions, which
>> can be collected through googling, your performance is almost 80%
>> guaranteed in the interview. It's sure that you will have to face only
>> a very few question outside from this. And if you are somewhat more
>> good enough , you can easily make through to the AMAZON!
>>
>> All the best for all :)
>> Repeating once again, rather than just reading through hundreds of
>> questions it would be best if you practice coding and studying the few
>> 30 interview questions! Else you will have to regret like me :|
>>
>>
>> #We will be having Google on our campus soon! I'm totally strange to
>> their selection process,tests and intreview, so if anyone have any
>> idea please do share here! Thanks!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> U
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Rahul singhal

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: adobe written round que

2011-08-01 Thread shubham
Hi,

we can show that

(x/3)  = (x/2) - (x/4) + (x/8) - (x/16) +  infinity

Proof:
let s1 = (x/2)+(x/8)+(x/32)+...infinity = (x/2)/(1-(1/4))   [Geometric 
Progression , common Ratio(r) = 1/4]
& s2 = (x/4)+(x/16)+(x/64)+...infinity = (x/4)/(1-(1/4))   [Geometric 
Progression , common Ratio(r) = 1/4]

now s1-s2 upon simplifying becomes (x/3)

Implementation:

x1=x>>1;
x2=x>>2;
s1=x1;
s2=x2;
while(x1 || x2){
  s1+=x1>>2;
  s2+=x2>>2;
  x1>>=2;
  x2>>=2;
}
return s1-s2;

If the number is not divisible by 3 the answer returned is the least integer 
function of (x/3)
correct me if i am wrong...

-- 
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/-/YZjVTMk5JvEJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: program to find max and min element in an array using recursion...

2011-08-01 Thread Amethy hobby
#include "stdafx.h"
#include 
using namespace std;
typedef pair node;// first is max. second is min
typedef int m_iterator;
node maxmin(int *a,m_iterator start,m_iterator end)
{
if(start==end-1){ //only hava one elements
return make_pair(a[start],a[start]);
}
else{
m_iterator mid=(end+start-1)/2;
node val;
node val1=maxmin(a,start,mid+1);
node val2=maxmin(a,mid+1,end);
val.first=val1.first>val2.first?val1.first:val2.first;
val.second=val1.second wrote:
> can u pls convert this algorithm into an executable code in c++ which
> can find the max and min element of an array in recursive method using
> divide and conquer strategy...
>
> int a[N]; // array
>
> int maxmin (A[])
> {
>Split A into two parts: A1, A2;
>(max1,min1) = maxmin(A1);
>(max2,min2) = maxmin(A2);
>if (max1 > max2) max = max1;
>else max = max2;
>if (min1 < min2) min = min1;
>else min = min2;
>return(max,min);
>
>
>
>
>
>
>
> }
> }

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] program to find max and min element in an array using recursion...

2011-08-01 Thread Indrajeet Khater
can u pls convert this algorithm into an executable code in c++ which
can find the max and min element of an array in recursive method using
divide and conquer strategy...

int a[N]; // array

int maxmin (A[])
{
   Split A into two parts: A1, A2;
   (max1,min1) = maxmin(A1);
   (max2,min2) = maxmin(A2);
   if (max1 > max2) max = max1;
   else max = max2;
   if (min1 < min2) min = min1;
   else min = min2;
   return(max,min);
}

}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Missing elements

2011-08-01 Thread sanjiv yadav
it is really good algorithm

On 8/2/11, Deepak giggs  wrote:
> @varun : clear :) thanks...
>
> On Mon, Aug 1, 2011 at 11:44 PM, kartik sachan
> wrote:
>
>> similar type algo is there in geeksforgeeks.org in array section from
>> there u can understand it better 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.
>>
>
>
>
> --
> Thanks & Regards,
> Deepak.L
> http://www.kurukshetra.org.in
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: reason?????????

2011-08-01 Thread Dharmendra Modi
The first part initialization of for loop (i<=5 && i>=-1) is just an
initialization and nothing else. It is of no use in this case.

The second part condition holds the condition which is in this case +
+i specifying to run loop till i is non zero. You are using prefix
operator hence it will first increment i and then test.
If you have used i++ the loop wont even have executed single time.

The condition ++i becomes zero when there is round of short and you
get zero at that time the loop terminates.

The format specifier for unsigned int is used hence positive values
are printed.
If the format specifier for %d is used then the results would be more
informative.

Hope that helps.

On Aug 1, 11:51 pm, jagrati verma  wrote:
> #include
> main()
> {
> short int i=0;
> for(i<=5 && i>=-1;++i;i>0)
> printf("%u\n",i);
> printf("\n");
> return 0;}
>
>                                                            o/p is 1.
> 4294967295 hw???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 Written test Q-1

2011-08-01 Thread sanjiv yadav
node sort(node root)
{
node first;
int count=0;count1=0;count2=0;
for(first=root;first !=null;first=first->next)
{
if(first->data==1) count++;
if(first->data==2) count1++;
if(first->data==3) count2++;
}
first=root;
for(first;first !=null;first=first->next)
{
if(count>0)
{
first->data=1;
count--;
}
else if(count1>0)
{
first->data=2;
count1--;
}
else if(count2 >0)
{
first->data=3;
count2--;
}
return root;
}

On 8/2/11, lokesh  wrote:
> any other solution other than counting no. of 1s, 2s and 3s?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 Written test Q-1

2011-08-01 Thread lokesh
any other solution other than counting no. of 1s, 2s and 3s?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Google Interview Question

2011-08-01 Thread Gene
This is a well-known problem called "Perfect Shuffle" which has been
discussed here before.  You should be able to find it with a search.

Gene

On Aug 1, 4:15 am, Abhishek Gupta  wrote:
> A is an array of size 2n such that first n elements are integers in any
> order and last n elements are characters.
> i.e. A={i1 i2 i3 in c1 c2 c3... cn}
> then we have to rearrange the elements such that final array is
> A ={ i1 c1 i2 c2 .. in cn}
>
> Example :
> input : A ={ 5,1,4,d,r,a};
> output : A= {5,d,1,r,4,a};
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 Written test Q-1

2011-08-01 Thread Lokesh
A doubly linked list has only 1,2 and 3 as values in nodes ..sort the
linked list

Ex.
Q: 1->2->3->1->1->1->2->3->2
O/P: 1->1->1->1->2->2->2->3->3

Dont change the original LL.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Missing elements

2011-08-01 Thread Deepak giggs
@varun : clear :) thanks...

On Mon, Aug 1, 2011 at 11:44 PM, kartik sachan wrote:

> similar type algo is there in geeksforgeeks.org in array section from
> there u can understand it better 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.
>



-- 
Thanks & Regards,
Deepak.L
http://www.kurukshetra.org.in

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] reason?????????

2011-08-01 Thread Anika Jain
u save its output in a file and note nos. from 32676 to a large value <
4294967295 are missing in this..
On Tue, Aug 2, 2011 at 12:59 AM, jagrati verma
wrote:

> it is nt an infinite loop it ends at 4294967295
>
> On Tue, Aug 2, 2011 at 12:53 AM, vijay goswami wrote:
>
>> its an infinite loop
>>
>> On Tue, Aug 2, 2011 at 12:21 AM, jagrati verma <
>> jagrativermamn...@gmail.com> wrote:
>>
>>> #include
>>> main()
>>> {
>>> short int i=0;
>>> for(i<=5 && i>=-1;++i;i>0)
>>> printf("%u\n",i);
>>> printf("\n");
>>> return 0;
>>> }
>>>group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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] reason?????????

2011-08-01 Thread jagrati verma
it is nt an infinite loop it ends at 4294967295

On Tue, Aug 2, 2011 at 12:53 AM, vijay goswami wrote:

> its an infinite loop
>
> On Tue, Aug 2, 2011 at 12:21 AM, jagrati verma <
> jagrativermamn...@gmail.com> wrote:
>
>> #include
>> main()
>> {
>> short int i=0;
>> for(i<=5 && i>=-1;++i;i>0)
>> printf("%u\n",i);
>> printf("\n");
>> return 0;
>> }
>>group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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] reason?????????

2011-08-01 Thread vijay goswami
its an infinite loop

On Tue, Aug 2, 2011 at 12:21 AM, jagrati verma
wrote:

> #include
> main()
> {
> short int i=0;
> for(i<=5 && i>=-1;++i;i>0)
> printf("%u\n",i);
> printf("\n");
> return 0;
> }
>o/p is 1.
> 4294967295 hw???
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] reason?????????

2011-08-01 Thread jagrati verma
#include
main()
{
short int i=0;
for(i<=5 && i>=-1;++i;i>0)
printf("%u\n",i);
printf("\n");
return 0;
}
   o/p is 1.
4294967295 hw???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Odd one out

2011-08-01 Thread *$*
sorry abhishek , I have given wrong complexity for Q2.

On Mon, Aug 1, 2011 at 12:36 PM, Abhishek Gupta wrote:

> @gopi
> inserting n elements, and then again checking each element?
> nlogn??
>
>
> On Sun, Jul 31, 2011 at 9:04 PM, Anika Jain wrote:
>
>> @gopi: in 2nd of urs we after tree creation we will need to search each
>> element in array that will take o(nlogn) time.. is there any appraoch tht
>> reduces this?
>>
>>
>> On Sun, Jul 31, 2011 at 6:39 PM, *$*  wrote:
>>
>>>
>>>
>>> Q1->Construct a binary tree , in such a way that if element occured for
>>> the first time , insert into tree , if occurs at second time , remove from
>>> the list.
>>> As all elements except the one need to find are even , at the end of the
>>> list , all the tree will contain only one element.
>>>
>>> Q2-> Construct a binary tree. similar to the above.
>>> Now again start from first element and check which element is missing in
>>> the tree. That is the required one.
>>>
>>>
>>> Thx,
>>> --Gopi
>>>
>>>
>>> On Sun, Jul 31, 2011 at 2:07 PM, Abhishek Gupta 
>>> wrote:
>>>
 Q1-> A large size array is given. All except one element are repeated
 even no. of times and one element is repeated odd no. of times. Find that
 element. Don't use X-OR

 Ans -> Is there any efficient way of finding it without using sorting or
 removing duplicates or using hash tables??



 Q2-> Same qn is like all except one are repeated off no. of times and
 one element repeated even no. of times. find that element. (no 
 specification
 for X-OR use given)

 Ans-> Again, I tried it using hash table.


 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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 are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Google Interview Question

2011-08-01 Thread Samba Ganapavarapu
@Diniz  I guess they asked to do in inplace ( with no extra array )


On Mon, Aug 1, 2011 at 2:41 PM, Douglas Diniz  wrote:

> This is a simple merge, so what is the trick? Did you forget something?
>
> On Mon, Aug 1, 2011 at 3:19 PM, Gary Drocella  wrote:
> > Here is O(n) alg...
> > Does Waste Memory Though :) just don't have an array over 4G, and you
> > should be good.
> >
> > proc Merge_Partition(A)
> >
> > B = {};
> > index = 0;
> > count0 = 0;
> > count1 = (n/2);
> >
> > while index to A.length
> >   B[index++] = A[count0++];
> >   B[index++] = A[count1++];
> > end while
> >
> > return B
> >
> > end proc
> >
> > On Aug 1, 1:30 pm, Manmeet Singh  wrote:
> >> Your code does not works proper;y for all cases
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >> On Mon, Aug 1, 2011 at 10:42 PM, Rohit jalan 
> wrote:
> >> > Here is the recursive algo:
> >>
> >> > Rearrange(A,p,q)
> >> > 1. if p is not equal to q do the following
> >> > 2. r ← (p+q)/2
> >> > 3. Exchange A[(p+r)/2..r] ←→ A[(p+q)/2 +1 ..(r+q)/2].
> >> > 4. Rearrange(A,p,r)
> >> > 5. Rearrange(A,r+1,q)
> >> > 6. return
> >>
> >> > On Mon, Aug 1, 2011 at 1:45 PM, Abhishek Gupta <
> gupta.abh...@gmail.com>wrote:
> >>
> >> >> A is an array of size 2n such that first n elements are integers in
> any
> >> >> order and last n elements are characters.
> >> >> i.e. A={i1 i2 i3 in c1 c2 c3... cn}
> >> >> then we have to rearrange the elements such that final array is
> >> >> A ={ i1 c1 i2 c2 .. in cn}
> >>
> >> >> Example :
> >> >> input : A ={ 5,1,4,d,r,a};
> >> >> output : A= {5,d,1,r,4,a};
> >>
> >> >> --
> >> >> Abhishek Gupta
> >> >> MCA
> >> >> NIT Calicut
> >> >> Kerela
> >>
> >> >>  --
> >> >> You received this message because you are subscribed to the Google
> Groups
> >> >> "Algorithm Geeks" group.
> >> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> >> To unsubscribe from 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 :
> >> > ROHIT JALAN
> >> > B.E. Graduate,
> >> > Computer Science Department,
> >> > RVCE, Bangalore
> >>
> >> >  --
> >> > You received this message because you are subscribed to the Google
> Groups
> >> > "Algorithm Geeks" group.
> >> > To post to this group, send email to algogeeks@googlegroups.com.
> >> > To unsubscribe from 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.
> >
> >
>
>
>
> --
> ---
> Douglas Gameiro Diniz
> Engenheiro de Computação - 2003 - UNICAMP
>
> Mobile: (19) 92158777
> Gtalk: dgdiniz
> Msn: thedougdi...@hotmail.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.



Re: [algogeeks] Re: Google Interview Question

2011-08-01 Thread Douglas Diniz
This is a simple merge, so what is the trick? Did you forget something?

On Mon, Aug 1, 2011 at 3:19 PM, Gary Drocella  wrote:
> Here is O(n) alg...
> Does Waste Memory Though :) just don't have an array over 4G, and you
> should be good.
>
> proc Merge_Partition(A)
>
> B = {};
> index = 0;
> count0 = 0;
> count1 = (n/2);
>
> while index to A.length
>   B[index++] = A[count0++];
>   B[index++] = A[count1++];
> end while
>
> return B
>
> end proc
>
> On Aug 1, 1:30 pm, Manmeet Singh  wrote:
>> Your code does not works proper;y for all cases
>>
>>
>>
>>
>>
>>
>>
>> On Mon, Aug 1, 2011 at 10:42 PM, Rohit jalan  wrote:
>> > Here is the recursive algo:
>>
>> > Rearrange(A,p,q)
>> > 1. if p is not equal to q do the following
>> > 2. r ← (p+q)/2
>> > 3. Exchange A[(p+r)/2..r] ←→ A[(p+q)/2 +1 ..(r+q)/2].
>> > 4. Rearrange(A,p,r)
>> > 5. Rearrange(A,r+1,q)
>> > 6. return
>>
>> > On Mon, Aug 1, 2011 at 1:45 PM, Abhishek Gupta 
>> > wrote:
>>
>> >> A is an array of size 2n such that first n elements are integers in any
>> >> order and last n elements are characters.
>> >> i.e. A={i1 i2 i3 in c1 c2 c3... cn}
>> >> then we have to rearrange the elements such that final array is
>> >> A ={ i1 c1 i2 c2 .. in cn}
>>
>> >> Example :
>> >> input : A ={ 5,1,4,d,r,a};
>> >> output : A= {5,d,1,r,4,a};
>>
>> >> --
>> >> Abhishek Gupta
>> >> MCA
>> >> NIT Calicut
>> >> Kerela
>>
>> >>  --
>> >> You received this message because you are subscribed to the Google Groups
>> >> "Algorithm Geeks" group.
>> >> To post to this group, send email to algogeeks@googlegroups.com.
>> >> To unsubscribe from 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 :
>> > ROHIT JALAN
>> > B.E. Graduate,
>> > Computer Science Department,
>> > RVCE, Bangalore
>>
>> >  --
>> > You received this message because you are subscribed to the Google Groups
>> > "Algorithm Geeks" group.
>> > To post to this group, send email to algogeeks@googlegroups.com.
>> > To unsubscribe from 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.
>
>



-- 
---
Douglas Gameiro Diniz
Engenheiro de Computação - 2003 - UNICAMP

Mobile: (19) 92158777
Gtalk: dgdiniz
Msn: thedougdi...@hotmail.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: Google Interview Question

2011-08-01 Thread Gary Drocella
Here is O(n) alg...
Does Waste Memory Though :) just don't have an array over 4G, and you
should be good.

proc Merge_Partition(A)

B = {};
index = 0;
count0 = 0;
count1 = (n/2);

while index to A.length
   B[index++] = A[count0++];
   B[index++] = A[count1++];
end while

return B

end proc

On Aug 1, 1:30 pm, Manmeet Singh  wrote:
> Your code does not works proper;y for all cases
>
>
>
>
>
>
>
> On Mon, Aug 1, 2011 at 10:42 PM, Rohit jalan  wrote:
> > Here is the recursive algo:
>
> > Rearrange(A,p,q)
> > 1. if p is not equal to q do the following
> > 2. r ← (p+q)/2
> > 3. Exchange A[(p+r)/2..r] ←→ A[(p+q)/2 +1 ..(r+q)/2].
> > 4. Rearrange(A,p,r)
> > 5. Rearrange(A,r+1,q)
> > 6. return
>
> > On Mon, Aug 1, 2011 at 1:45 PM, Abhishek Gupta 
> > wrote:
>
> >> A is an array of size 2n such that first n elements are integers in any
> >> order and last n elements are characters.
> >> i.e. A={i1 i2 i3 in c1 c2 c3... cn}
> >> then we have to rearrange the elements such that final array is
> >> A ={ i1 c1 i2 c2 .. in cn}
>
> >> Example :
> >> input : A ={ 5,1,4,d,r,a};
> >> output : A= {5,d,1,r,4,a};
>
> >> --
> >> Abhishek Gupta
> >> MCA
> >> NIT Calicut
> >> Kerela
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from 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 :
> > ROHIT JALAN
> > B.E. Graduate,
> > Computer Science Department,
> > RVCE, Bangalore
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from 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] Structure

2011-08-01 Thread Rohit jalan
Here, you are declaring a variable for structure.

*top is a variable of struct node.

struct node
{
int d;
struct node *next;
}*top=NULL;

The above is equivalent to:
*struct node
{
int d;
struct node *next;
}

struct node *top=NULL;


*
On Mon, Aug 1, 2011 at 11:27 PM, Priyanka  wrote:

> struct node
> {
> int d;
> struct node *next;
> }*top=NULL;
>
> wat s it mean?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 :
ROHIT JALAN
B.E. Graduate,
Computer Science Department,
RVCE, Bangalore

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Missing elements

2011-08-01 Thread kartik sachan
similar type algo is there in geeksforgeeks.org in array section from there
u can understand it better 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.



Re: [algogeeks] Structure

2011-08-01 Thread kumar raja
Go through C text book by denis ritchie
the structure u have given is called self referential structure..used for
implementing Linked lists

On 1 August 2011 11:02, arvind kumar  wrote:

> These are all basics of structures.Better go thro' basics in some book.
>
>
> On Mon, Aug 1, 2011 at 11:27 PM, Priyanka  wrote:
>
>> struct node
>> {
>> int d;
>> struct node *next;
>> }*top=NULL;
>>
>> wat s it mean?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.



Re: [algogeeks] Structure

2011-08-01 Thread arvind kumar
These are all basics of structures.Better go thro' basics in some book.

On Mon, Aug 1, 2011 at 11:27 PM, Priyanka  wrote:

> struct node
> {
> int d;
> struct node *next;
> }*top=NULL;
>
> wat s it mean?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] Structure

2011-08-01 Thread Priyanka
struct node
{
int d;
struct node *next;
}*top=NULL;

wat s it mean?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Sub-array Sum

2011-08-01 Thread Soumya Prasad Ukil
Given a array A[] and a number x, find the subarray who's sum is equal to x.
A[] contains both positive and negative numbers.

 --
regards,
soumya prasad ukil

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: random generation

2011-08-01 Thread Don
Years ago I wrote a Yahtzee program which used feedback from user
mouse movements to add entropy to the random generator. Using Borland
Builder (Visual Studio could do the same thing) I created an event
"OnMouseMove" which is called any time the mouse moves from one pixel
to another. It provides the X and Y coordinates for the mouse
location. I had a pool of 600 dice with 100 of each value (1-6), and
when a mouse move event occurred, it used the X and Y locations to
pick two dice in the pool and swap them. The user had to move the
mouse around to select which dice to keep, to click on the "Roll"
button, etc, so there was lots of input to the OnMouseMove event. It
also used a timer which caused an event every 1/1000th of a second,
which used a multiply-with-carry generator to select one dice in the
pool to swap with another dice. That made sure that all the dice moved
around frequently. Then when the user rolled the dice, it picked
random locations in the pool and used the value at that location. The
result was a truly random, non-deterministic dice roll which would be
affected by the slightest difference in the way you moved the mouse in
the window, which is something I doubt that most commercially produced
Yahtzee programs can claim.

Similar things could be done for card games to shuffle the deck. You
could have the deck for the next game shuffling while the current game
is being played.

Don

On Jul 31, 4:39 am, Puneet Gautam  wrote:
> Can we write a code to generate random numbers without using rand function..?
>
> Pls help me on 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.



[algogeeks] Re: ADT

2011-08-01 Thread Priyanka


On Aug 1, 9:19 pm, pandharinath gorde 
wrote:
> ADT means which will come with two things...
> i.which type of value it contains
> like suppose sone adt any which will have only integer like this
> iiwhat are opeartion possible on it.
> eg stack push and pop
>
> On Mon, Aug 1, 2011 at 8:41 PM, Priyanka  wrote:
> > hai can anybody tell what is abstract datatype clearly??
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/algogeeks?hl=en.
>
> --
> Pandharinath Gorde
> +91-9620557641


k...is integer an adt?

















-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-08-01 Thread Manmeet Singh
Your code does not works proper;y for all cases

On Mon, Aug 1, 2011 at 10:42 PM, Rohit jalan  wrote:

> Here is the recursive algo:
>
> Rearrange(A,p,q)
> 1. if p is not equal to q do the following
> 2. r ← (p+q)/2
> 3. Exchange A[(p+r)/2..r] ←→ A[(p+q)/2 +1 ..(r+q)/2].
> 4. Rearrange(A,p,r)
> 5. Rearrange(A,r+1,q)
> 6. return
>
>
>
> On Mon, Aug 1, 2011 at 1:45 PM, Abhishek Gupta wrote:
>
>> A is an array of size 2n such that first n elements are integers in any
>> order and last n elements are characters.
>> i.e. A={i1 i2 i3 in c1 c2 c3... cn}
>> then we have to rearrange the elements such that final array is
>> A ={ i1 c1 i2 c2 .. in cn}
>>
>>
>> Example :
>> input : A ={ 5,1,4,d,r,a};
>> output : A= {5,d,1,r,4,a};
>>
>> --
>> Abhishek Gupta
>> MCA
>> NIT Calicut
>> Kerela
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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 :
> ROHIT JALAN
> B.E. Graduate,
> Computer Science Department,
> RVCE, Bangalore
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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] Google Interview Question

2011-08-01 Thread Rohit jalan
Here is the recursive algo:

Rearrange(A,p,q)
1. if p is not equal to q do the following
2. r ← (p+q)/2
3. Exchange A[(p+r)/2..r] ←→ A[(p+q)/2 +1 ..(r+q)/2].
4. Rearrange(A,p,r)
5. Rearrange(A,r+1,q)
6. return



On Mon, Aug 1, 2011 at 1:45 PM, Abhishek Gupta wrote:

> A is an array of size 2n such that first n elements are integers in any
> order and last n elements are characters.
> i.e. A={i1 i2 i3 in c1 c2 c3... cn}
> then we have to rearrange the elements such that final array is
> A ={ i1 c1 i2 c2 .. in cn}
>
>
> Example :
> input : A ={ 5,1,4,d,r,a};
> output : A= {5,d,1,r,4,a};
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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 :
ROHIT JALAN
B.E. Graduate,
Computer Science Department,
RVCE, Bangalore

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] arvind kumar wants to chat

2011-08-01 Thread arvind kumar
---

arvind kumar wants to stay in better touch using some of Google's coolest new
products.

If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-c4e2aca149-4c2746e8f4-AMfUW9xeDt3Og2npOZpwqruo92s
You'll need to click this link to be able to chat with arvind kumar.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with arvind kumar, visit:
http://mail.google.com/mail/a-c4e2aca149-4c2746e8f4-AMfUW9xeDt3Og2npOZpwqruo92s

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging
service:

http://www.google.com/talk/

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk
  client

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

Thanks,
The Google Team

To learn more about Gmail and Google Talk, visit:
http://mail.google.com/mail/help/about.html
http://www.google.com/talk/about.html

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Google Interview Question

2011-08-01 Thread kumar raja
It is a bit tricky without using external memory .It is like insertion sort.
correct me if i am wrong.

for(i=n;i<2*n;i++)
{
   x=a[i];
for(j=i-1;;j--)
 {
if(j==0 || a[j-1]=='c')  // 'c' indicates some  character you can
check its ascii value
break;
a[j+1]=a[j];
  }

 a[j+1]=x;
}




On 1 August 2011 10:02, kumar raja  wrote:

> It is a bit tricky without using external memory
> correct me if i am wrong.
>
> for(i=n;i<2*n;i++)
> {
>
>
>
> On 1 August 2011 02:42, shady  wrote:
>
>> when was this question asked in Google ? approximate date ? position ?
>>
>>
>> On Mon, Aug 1, 2011 at 1:45 PM, Abhishek Gupta wrote:
>>
>>> A is an array of size 2n such that first n elements are integers in any
>>> order and last n elements are characters.
>>> i.e. A={i1 i2 i3 in c1 c2 c3... cn}
>>> then we have to rearrange the elements such that final array is
>>> A ={ i1 c1 i2 c2 .. in cn}
>>>
>>>
>>> Example :
>>> input : A ={ 5,1,4,d,r,a};
>>> output : A= {5,d,1,r,4,a};
>>>
>>> --
>>> Abhishek Gupta
>>> MCA
>>> NIT Calicut
>>> Kerela
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>
>


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



Re: [algogeeks] Google Interview Question

2011-08-01 Thread kumar raja
It is a bit tricky without using external memory
correct me if i am wrong.

for(i=n;i<2*n;i++)
{


On 1 August 2011 02:42, shady  wrote:

> when was this question asked in Google ? approximate date ? position ?
>
>
> On Mon, Aug 1, 2011 at 1:45 PM, Abhishek Gupta wrote:
>
>> A is an array of size 2n such that first n elements are integers in any
>> order and last n elements are characters.
>> i.e. A={i1 i2 i3 in c1 c2 c3... cn}
>> then we have to rearrange the elements such that final array is
>> A ={ i1 c1 i2 c2 .. in cn}
>>
>>
>> Example :
>> input : A ={ 5,1,4,d,r,a};
>> output : A= {5,d,1,r,4,a};
>>
>> --
>> Abhishek Gupta
>> MCA
>> NIT Calicut
>> Kerela
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.



Re: [algogeeks] Re: random generation

2011-08-01 Thread Douglas Diniz
You could use a piece of data with a very high entropy, like a very
volatile kernel structure, a time structure, etc. as a seed for your
code.

On Mon, Aug 1, 2011 at 1:25 PM, Puneet Gautam  wrote:
> @Don: How about this below...?
>
> #include
> int main(int argc,char *argv[])
> {
>    int a;
>    a=(argv[0]);
>    printf("%d",a%10);
>    getchar();
>    }
>
> To get  a random value b/w 0 to 100,
> we can use a%100
> and soon for 0-1000.
>
>
> What say guys..?
>
>
> On 8/1/11, Don  wrote:
>> That's actually a big question, because computers are deterministic,
>> so it is hard to see how they could act randomly.
>>
>> There are all sorts of pseudo-random generators which will produce a
>> stream of output which appear more or less random. The larger and more
>> sophisticated ones produce much better results than the poorly
>> designed ones. Decades ago there was a "random" generator called randu
>> which was notoriously bad, but before people figured out how flawed it
>> was, hundreds of simulation studies had been performed with it, and
>> most ended up being rejected as invalid based on the poor statistical
>> qualities of randu.
>>
>> Today there are several high-quality generators, such as the Mersenne
>> Twister. George Marsaglia has designed several excellent generators,
>> as well as the Diehard battery of tests to measure the statistical
>> quality of any generator.
>>
>> However, you seem to be wanting a single number which will be
>> different each time you run a program.
>>
>> You could do something as simple as
>>
>> int random_value = 2 + (time() % 9);
>>
>> Or you could pick any well-known random generator, seed it, and use it
>> to produce what you need.
>>
>> To get you started, this function will produce a pseudo-random stream
>> of output in the range 0..65535 using Marsaglia's "multiply with
>> carry" algorithm.
>>
>>
>> unsigned int mwc()
>> {
>>   static unsigned int x = time(0);
>>   x = 63663 * (x&65535) + (x>>16);
>>   return x&65535;
>> }
>>
>> Don
>>
>> On Jul 31, 4:39 am, Puneet Gautam  wrote:
>>> Can we write a code to generate random numbers without using rand
>>> function..?
>>>
>>> Pls help me on 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.
>
>



-- 
---
Douglas Gameiro Diniz
Engenheiro de Computação - 2003 - UNICAMP

Mobile: (19) 92158777
Gtalk: dgdiniz
Msn: thedougdi...@hotmail.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.



Re: [algogeeks] Re: SPOJ LITE

2011-08-01 Thread Amol Sharma
can u explain or some useful link ??
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Mon, Aug 1, 2011 at 10:16 PM, Rohan Kalra wrote:

> Use lazy propagation.
>
> --
> 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/-/3YMdS5bKx_sJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: c-aps

2011-08-01 Thread Radhika Renganathan
also please suggest special pointer based output c-aps..

On Mon, Aug 1, 2011 at 9:57 PM, Radhika Renganathan
wrote:

> HI, I'm seeking for a source for learning c-aps and i don get any valuable
> ones. Can anyone plz suggest me or share the valuable sources u know. Thank
> u in anticipation
>
> --
>  radhika .. :)
>



-- 
 radhika .. :)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Max subarray of no 2 adjacent elements

2011-08-01 Thread ankit sambyal
just use the following recurrence relation :

let arr[] be the array of integers and take an array a[]
a[i]=max(a[i-2], a]i-1], a[i-2]+arr[i]);
a[0]=arr[0];
a[1]=max(arr[0],arr[1]);

a[N-1] contains the final answer


@abhishek : the output for {3,5,7,10} should be 5+10=15 and not 13 as
pointed by u !!  Correct me if I am wrong

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: SPOJ LITE

2011-08-01 Thread Rohan Kalra
Use lazy propagation.

-- 
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/-/3YMdS5bKx_sJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] virtual functions output

2011-08-01 Thread sivaviknesh s
#include
#include

using namespace std;

class Base
{
public:
  Base()
  {
fun(); //note: fun() is virtual
  }
  virtual void fun()
  {
cout<<"\nBase Function";
  }
};

class Derived: public Base
{
public:
  Derived(){}
  virtual void fun()
  {
cout<<"\nDerived Function";
  }
};

int main()
{
  Base* pBase = new Derived();
  delete pBase;

  getchar();
  return 0;
}

Output:
*Base Function*

See following excerpt from C++
standardfor
explanation.

*When a virtual function is called directly or indirectly from a constructor
(including from the mem-initializer for a data member) or from a destructor,
and the object to which the call applies is the object under construction or
destruction, the function called is the one defined in the constructor or
destructor’s own class or in one of its bases, but not a function overriding
it in a class derived from the constructor or destructor’s class, or
overriding it in one of the other base classes of the most derived object.*

Because of this difference in behavior, it is recommended that object’s
virtual function is not invoked while it is being constructed or destroyed.
See this
for
more details.
..CAN ANYONE GIVE A SIMPLE EXPLANANTION?? given explanation is
quite confusing

-- 
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: adobe written round que

2011-08-01 Thread Puneet Gautam
@ankit: not the last digit..!!
it will be (last digit -3) or (last digit -3-3) whichever is positive..

:)

On 7/31/11, Ankit Minglani  wrote:
> yeah if it was a divisibility test then the question would have been too
> trivial ..
> the last digit after doing itoa will be the remainder .
>
> On Sat, Jul 30, 2011 at 11:52 AM, nivedita arora <
> vivaciousnived...@gmail.com> wrote:
>
>> i think solution of ankit is right !
>> sorry even i forgot tht que ws not divisibility test ..but to get
>> quotient :-|
>>
>> On Jul 30, 10:03 pm, Ankur Khurana  wrote:
>> > @roopam : i got the question all wrong. . .
>> >
>> > On Sat, Jul 30, 2011 at 10:01 PM, Roopam Poddar > >wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > The objective is to divide the number by 3 and not just check for it's
>> > > divisibility.
>> > > Adding the digits using itoa() and then repeated subtraction will
>> > > check
>> for
>> > > it's divisibility by 3 and not give us the quotient.
>> > > To get that you will have to carry out repeated subtraction on the
>> number
>> > > anyway.
>> > > So whats the point?
>> >
>> > > --
>> > > 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/-/BWTzYtcBhIgJ.
>> >
>> > > To post to this group, send email to algogeeks@googlegroups.com.
>> > > To unsubscribe from this group, send email to
>> > > algogeeks+unsubscr...@googlegroups.com.
>> > > For more options, visit this group at
>> > >http://groups.google.com/group/algogeeks?hl=en.
>> >
>> > --
>> > Ankur Khurana
>> > Computer Science
>> > Netaji Subhas Institute Of Technology
>> > Delhi.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> The more you sweat in the field, the less you bleed in war."
>
> Ankit Minglani
> NITK Surathkal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: MS c output ques

2011-08-01 Thread ramya reddy
@ prateek

got ittanks
Regards
Ramya
*
*
*Try to learn something about everything and everything about something*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-aps

2011-08-01 Thread Radhika Renganathan
HI, I'm seeking for a source for learning c-aps and i don get any valuable
ones. Can anyone plz suggest me or share the valuable sources u know. Thank
u in anticipation

-- 
 radhika .. :)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: random generation

2011-08-01 Thread Puneet Gautam
@Don: How about this below...?

#include
int main(int argc,char *argv[])
{
int a;
a=(argv[0]);
printf("%d",a%10);
getchar();
}

To get  a random value b/w 0 to 100,
we can use a%100
and soon for 0-1000.


What say guys..?


On 8/1/11, Don  wrote:
> That's actually a big question, because computers are deterministic,
> so it is hard to see how they could act randomly.
>
> There are all sorts of pseudo-random generators which will produce a
> stream of output which appear more or less random. The larger and more
> sophisticated ones produce much better results than the poorly
> designed ones. Decades ago there was a "random" generator called randu
> which was notoriously bad, but before people figured out how flawed it
> was, hundreds of simulation studies had been performed with it, and
> most ended up being rejected as invalid based on the poor statistical
> qualities of randu.
>
> Today there are several high-quality generators, such as the Mersenne
> Twister. George Marsaglia has designed several excellent generators,
> as well as the Diehard battery of tests to measure the statistical
> quality of any generator.
>
> However, you seem to be wanting a single number which will be
> different each time you run a program.
>
> You could do something as simple as
>
> int random_value = 2 + (time() % 9);
>
> Or you could pick any well-known random generator, seed it, and use it
> to produce what you need.
>
> To get you started, this function will produce a pseudo-random stream
> of output in the range 0..65535 using Marsaglia's "multiply with
> carry" algorithm.
>
>
> unsigned int mwc()
> {
>   static unsigned int x = time(0);
>   x = 63663 * (x&65535) + (x>>16);
>   return x&65535;
> }
>
> Don
>
> On Jul 31, 4:39 am, Puneet Gautam  wrote:
>> Can we write a code to generate random numbers without using rand
>> function..?
>>
>> Pls help me on 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.



Re: [algogeeks] Re: MS c output ques

2011-08-01 Thread prateek gupta
it prints the first n characters of the string that matches any character of
"india". The printing stops as soon as the first character different from
the characters of "india" is encountered.

On Mon, Aug 1, 2011 at 9:36 PM, ramya reddy  wrote:

>
> Hey all,
>
> I have a doubt .
> what if there is no xor operator..
> what if it is simply %[india]..how it behaves?
> --
> Regards
> Ramya
> *
> *
> *Try to learn something about everything and everything about something*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Prateek Gupta
7th sem, Information Technology,
Netaji Subhas Institute Of Technology
Delhi.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] ADT

2011-08-01 Thread pandharinath gorde
ADT means which will come with two things...
i.which type of value it contains
like suppose sone adt any which will have only integer like this
iiwhat are opeartion possible on it.
eg stack push and pop

On Mon, Aug 1, 2011 at 8:41 PM, Priyanka  wrote:

> hai can anybody tell what is abstract datatype clearly??
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Pandharinath Gorde
+91-9620557641

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-08-01 Thread Supraja Jayakumar
Thanks Rahul. Very kind of you.
I wish you crack Google.

All the best !

Best
Supraja J

On Thu, Jul 28, 2011 at 6:24 AM, Rahul Menon wrote:

> Hello friends,
>
> Recently I appeared for placement interviews for Amazon in my
> campus.Unfortunately though I couldn't make it, still want to share
> something for others here preparing for amazon interviews!
>
> First of all though it is very hard to crack, here are a few things
> which can make your preparation easier and effective!
>
> In the interview, I have found that most of the questions asked are
> repeated questions which are available online rather than any new
> questions they have made. A few examples are loop in a linked list,
> print all permuations of a string, binary search in a rotated array
> etc.. These all questions are very commonly found in websites like
> careercup.com and also in this google group. Instead of just going
> through hundreds of question be sure that you can perform the best of
> 100% if you are given from these frequently asked questions.
>
> Just to add, if you are very good in coding it's fine , else make sure
> that you can also code these above questions very well rather than
> just explaining the algos!. They will definitely ask you to code
> these!
>
> In " Cracking the coding interview" all the questions are very very
> important. To my astonishment most of the questions in the sections
> like Linked LIsts, Arrays, Trees and Graph, Recursion from the
> aforesaid book were asked in our interview!  So never miss reading and
> coding these questions before going to your interview.
>
> Though it's very weird to say, I would say that if you are very very
> good with these around 40 most frequently repeated questions, which
> can be collected through googling, your performance is almost 80%
> guaranteed in the interview. It's sure that you will have to face only
> a very few question outside from this. And if you are somewhat more
> good enough , you can easily make through to the AMAZON!
>
> All the best for all :)
> Repeating once again, rather than just reading through hundreds of
> questions it would be best if you practice coding and studying the few
> 30 interview questions! Else you will have to regret like me :|
>
>
> #We will be having Google on our campus soon! I'm totally strange to
> their selection process,tests and intreview, so if anyone have any
> idea please do share here! Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
U

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] SPOJ LITE

2011-08-01 Thread Amol Sharma
hi everyone...i came across a quite simple problem on spoj...

https://www.spoj.pl/problems/LITE/

obvious solution will be O(n)...but it is getting TLE...
so we have to improve the complexity to O(logn)..can some suggest the
segment tree implementation of this problem

i am new to segment treeso please explain how can we make use of segment
tree to solve this particular problem in O(logn) !!
--


Amol Sharma
Third 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: MS c output ques

2011-08-01 Thread ramya reddy
Hey all,

I have a doubt .
what if there is no xor operator..
what if it is simply %[india]..how it behaves?
-- 
Regards
Ramya
*
*
*Try to learn something about everything and everything about something*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Missing elements

2011-08-01 Thread Gaurav Menghani


On Aug 1, 6:25 pm, Deepak  wrote:
> Given an array of elements 'n'. some k elements such that the repalced elements are  missing elements, without wasting any extra memory.

I think you did not phrase the question correctly. I am assuming you
meant an array of n-numbers from [1,n]. Here, khttp://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] [offtopic] Something to share for those preparing for Amazon Campus Interviews!

2011-08-01 Thread praneethn
thanks...:)


On Thu, Jul 28, 2011 at 5:54 PM, Rahul Menon wrote:

> Hello friends,
>
> Recently I appeared for placement interviews for Amazon in my
> campus.Unfortunately though I couldn't make it, still want to share
> something for others here preparing for amazon interviews!
>
> First of all though it is very hard to crack, here are a few things
> which can make your preparation easier and effective!
>
> In the interview, I have found that most of the questions asked are
> repeated questions which are available online rather than any new
> questions they have made. A few examples are loop in a linked list,
> print all permuations of a string, binary search in a rotated array
> etc.. These all questions are very commonly found in websites like
> careercup.com and also in this google group. Instead of just going
> through hundreds of question be sure that you can perform the best of
> 100% if you are given from these frequently asked questions.
>
> Just to add, if you are very good in coding it's fine , else make sure
> that you can also code these above questions very well rather than
> just explaining the algos!. They will definitely ask you to code
> these!
>
> In " Cracking the coding interview" all the questions are very very
> important. To my astonishment most of the questions in the sections
> like Linked LIsts, Arrays, Trees and Graph, Recursion from the
> aforesaid book were asked in our interview!  So never miss reading and
> coding these questions before going to your interview.
>
> Though it's very weird to say, I would say that if you are very very
> good with these around 40 most frequently repeated questions, which
> can be collected through googling, your performance is almost 80%
> guaranteed in the interview. It's sure that you will have to face only
> a very few question outside from this. And if you are somewhat more
> good enough , you can easily make through to the AMAZON!
>
> All the best for all :)
> Repeating once again, rather than just reading through hundreds of
> questions it would be best if you practice coding and studying the few
> 30 interview questions! Else you will have to regret like me :|
>
>
> #We will be having Google on our campus soon! I'm totally strange to
> their selection process,tests and intreview, so if anyone have any
> idea please do share here! Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: c output

2011-08-01 Thread ghsjgl k
The output for third only correct 1,2 and 4 are wrong i think


printf() is evaluated from right to left and the post inceremet
operator increses after assigning the value hence third is
correct.


also tested them using Dev C++ compiler its working as i said above

On Aug 1, 5:20 pm, thanu moorthy  wrote:
> Please help me...
>
> How can the following output be obtained :
>
>  1.main()
>
> {
>
>  int i=1;
>
> printf("%d\t%d\t%d\t",i,i++,i);
>
> }
>
> output: 2 1 2
>
>  2.main()
>
> {
>
>  int i=1;
>
> printf("%d\t%d\t%d\t",i,++i,i);
>
> }
>
> output: 2 2 2
>
>  3.main()
>
> {
>
>  int i=1;
>
> printf("%d\t%d\t%d\t",i,i++,i++);
>
> }
>
> output: 3 2 1
>
>  4.main()
>
> {
>
>  int i=1;
>
> printf("%d\t%d\t%d\t",i,++i,++i);
>
> }
>
> output: 3 3 3
>
> Regards
> by THANU

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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 output

2011-08-01 Thread Amol Sharma
@agyat +1

these outputs are not standardit's implementation dependent.
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Mon, Aug 1, 2011 at 8:55 PM, Agyat  wrote:

> no one can explain such things correctly because they are compiler
> dependent.The result is not deterministic,it may vary from one
> platform to another
>
> On Aug 1, 8:22 pm, Prashant Gupta  wrote:
> > Nikhil only explained third rightly. :-/
> > I think 1,2,4's output are given wrong by thanu.
> >
> > On Mon, Aug 1, 2011 at 8:39 PM, muruga vel  >wrote:
> >
> >
> >
> > > So which one to consider
> >
> > > On Mon, Aug 1, 2011 at 7:17 PM, Raman  wrote:
> >
> > >> Niks u r wrng..this is undefined. Different results in different
> compilers
> >
> > >> --
> > >> 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/-/es-F94sx2KIJ.
> >
> > >> To post to this group, send email to algogeeks@googlegroups.com.
> > >> To unsubscribe from 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.
> >
> > --
> > Prashant Gupta
> > B.Tech Final Year
> > Computer Science and Engineering
> > NIT Trichy
> > Phone : +91 9894462744
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: c output

2011-08-01 Thread Agyat
no one can explain such things correctly because they are compiler
dependent.The result is not deterministic,it may vary from one
platform to another

On Aug 1, 8:22 pm, Prashant Gupta  wrote:
> Nikhil only explained third rightly. :-/
> I think 1,2,4's output are given wrong by thanu.
>
> On Mon, Aug 1, 2011 at 8:39 PM, muruga vel wrote:
>
>
>
> > So which one to consider
>
> > On Mon, Aug 1, 2011 at 7:17 PM, Raman  wrote:
>
> >> Niks u r wrng..this is undefined. Different results in different compilers
>
> >> --
> >> 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/-/es-F94sx2KIJ.
>
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from 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.
>
> --
> Prashant Gupta
> B.Tech Final Year
> Computer Science and Engineering
> NIT Trichy
> Phone : +91 9894462744

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Missing elements

2011-08-01 Thread Deepak giggs
@varun : explain ur algo step by step with ur example plz...

On Mon, Aug 1, 2011 at 8:00 PM, Amol Sharma  wrote:

> @varun i didn't got what are you doingplz explain your algo !!
> --
>
>
> Amol Sharma
> Third Year Student
> Computer Science and Engineering
> MNNIT Allahabad
>
>
>
>
> On Mon, Aug 1, 2011 at 7:47 PM, suresh srinivasan wrote:
>
>> It's good algorithm.
>> --
>> Regards,
>> Suresh.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.
>



-- 
Thanks & Regards,
Deepak.L
http://www.kurukshetra.org.in

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-01 Thread Prashant Gupta
Nikhil only explained third rightly. :-/
I think 1,2,4's output are given wrong by thanu.

On Mon, Aug 1, 2011 at 8:39 PM, muruga vel wrote:

> So which one to consider
>
>
>
> On Mon, Aug 1, 2011 at 7:17 PM, Raman  wrote:
>
>> Niks u r wrng..this is undefined. Different results in different compilers
>>
>>
>> --
>> 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/-/es-F94sx2KIJ.
>>
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



-- 
Prashant Gupta
B.Tech Final Year
Computer Science and Engineering
NIT Trichy
Phone : +91 9894462744

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] ADT

2011-08-01 Thread Priyanka
hai can anybody tell what is abstract datatype clearly??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-01 Thread muruga vel
So which one to consider


On Mon, Aug 1, 2011 at 7:17 PM, Raman  wrote:

> Niks u r wrng..this is undefined. Different results in different compilers
>
> --
> 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/-/es-F94sx2KIJ.
>
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: random generation

2011-08-01 Thread Don
That's actually a big question, because computers are deterministic,
so it is hard to see how they could act randomly.

There are all sorts of pseudo-random generators which will produce a
stream of output which appear more or less random. The larger and more
sophisticated ones produce much better results than the poorly
designed ones. Decades ago there was a "random" generator called randu
which was notoriously bad, but before people figured out how flawed it
was, hundreds of simulation studies had been performed with it, and
most ended up being rejected as invalid based on the poor statistical
qualities of randu.

Today there are several high-quality generators, such as the Mersenne
Twister. George Marsaglia has designed several excellent generators,
as well as the Diehard battery of tests to measure the statistical
quality of any generator.

However, you seem to be wanting a single number which will be
different each time you run a program.

You could do something as simple as

int random_value = 2 + (time() % 9);

Or you could pick any well-known random generator, seed it, and use it
to produce what you need.

To get you started, this function will produce a pseudo-random stream
of output in the range 0..65535 using Marsaglia's "multiply with
carry" algorithm.


unsigned int mwc()
{
  static unsigned int x = time(0);
  x = 63663 * (x&65535) + (x>>16);
  return x&65535;
}

Don

On Jul 31, 4:39 am, Puneet Gautam  wrote:
> Can we write a code to generate random numbers without using rand function..?
>
> Pls help me on 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.



[algogeeks]

2011-08-01 Thread priyanka pandian
clear definition about abstract data type???

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Missing elements

2011-08-01 Thread Amol Sharma
@varun i didn't got what are you doingplz explain your algo !!
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad




On Mon, Aug 1, 2011 at 7:47 PM, suresh srinivasan wrote:

> It's good algorithm.
> --
> Regards,
> Suresh.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.



Re: [algogeeks] Missing elements

2011-08-01 Thread suresh srinivasan
It's good algorithm.
-- 
Regards,
Suresh.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] c output

2011-08-01 Thread Raman
Niks u r wrng..this is undefined. Different results in different compilers

-- 
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/-/es-F94sx2KIJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Missing elements

2011-08-01 Thread varun pahwa
suppose the array is given as :
1 2 6 6 2 4
make the array as -1 -2 6 -6 2 -4.

working code ::

#include

int main ()
{
int a[] = {1 ,2 ,6 ,6,2,4,8,8};
int i,j;
for(i = 0; i < 8; i++)
{
j = a[i];
if(a[i] < 0 )
j = -j;
j--;
if(a[j] > 0)
a[j] = -a[j];
}
for(i = 0; i < 8; i++)
if(a[i] > 0)
printf("%d ",i+1);
return 0;
}

correct me if i am wrong;

On Mon, Aug 1, 2011 at 6:55 PM, Deepak  wrote:

> Given an array of elements 'n'. some k elements such that the repalced elements are  missing elements, without wasting any extra memory.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
Varun Pahwa
B.Tech (IT)
7th Sem.
Indian Institute of Information Technology Allahabad.
Ph : 09793899112
Official Email :: rit2008...@iiita.ac.in
Another Email :: varunpahwa.ii...@gmail.com

People who fail to plan are those who plan to fail.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Max subarray of no 2 adjacent elements

2011-08-01 Thread Abhishek Gupta
@samba
its not finding sum of 2 elements. its finding sum of subarray of any size
such that no 2 elements are adjacent

On Mon, Aug 1, 2011 at 6:38 PM, Samba Ganapavarapu wrote:

> @ Abhishek oh yea sorry.. I read it again, understood what I missed!
> I thought we need to find max possible sum of 2 elements excluding adjacent
> ones..  sorry guys.
>
> On Mon, Aug 1, 2011 at 8:54 AM, Abhishek Gupta wrote:
>
>>
>> @samba
>> i think you didnt get the question.
>>
>> On Mon, Aug 1, 2011 at 5:56 PM, Samba Ganapavarapu > > wrote:
>>
>>> Step 1
>>> Find the max element position in the array. ( save position maxElement
>>> variable ).
>>> This takes O (n)
>>>
>>> Step 2
>>> Find the max element position again ( this time exclude maxElement,
>>> (maxElement+1) and (maxElement-1) in the comparision ) save this position to
>>> secondElementRequired variable
>>> This takes O ( n )
>>>
>>> return array[ maxElement ] + array [secondElementRequired ]
>>>
>>> Thank you,
>>> Samba
>>>
>>>
>>> On Mon, Aug 1, 2011 at 5:31 AM, Abhishek Gupta 
>>> wrote:
>>>
 Ya got it.
 thanks a lot.
 I was looking for dynamic solution only but unable to solve one.


 On Mon, Aug 1, 2011 at 2:04 PM, Prakash D  wrote:

> I just thought of an O(n) dp solution
>
> let a[]=5,2,1,7,9,11
>
> traverse from i=0 to n-1
>
> we define arr[i]= a[i]+max(arr[i-2],arr[i-3));
>
>
> first arr[0]= 5 + max( a[-2], a[-3]) = 5
>
> arr[1]= 2
>
> arr[2]=1 + 5
>
> arr[3]= 7 + max(5,2) = 7+ 5 = 12
>
> then arr[4]= 9 + max(2,6) = 15
>
> then arr[5]= 11 + max(6,12) = 11+12 = 23
>
>
> now soln= max( arr[n-1], arr[n-2]) = 23
>
>
> hope i'm correct ..
>
>
> regards,
>
> D.Prakash,
> IT, IIIrd year, CEG.
>
>
>
>
>
>
> On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta  > wrote:
>
>> @Prakash
>> can you post your solution please
>>
>>
>> On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta <
>> gupta.abh...@gmail.com> wrote:
>>
>>> @Kartik
>>>
>>> we cant choose adjacent elements. for ex A={5,2,1,7,9,11} then we
>>> will have 5+7+11
>>> can any one give any algo for this
>>> thank you
>>>
>>>
>>> On Mon, Aug 1, 2011 at 1:25 PM, kartik sachan <
>>> kartik.sac...@gmail.com> wrote:
>>>
 oh..got it i didn't read that statement:(

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

>>>
>>>
>>>
>>> --
>>> Abhishek Gupta
>>> MCA
>>> NIT Calicut
>>> Kerela
>>>
>>>
>>
>>
>> --
>> Abhishek Gupta
>> MCA
>> NIT Calicut
>> Kerela
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>> Abhishek Gupta
>> MCA
>> NIT Calicut
>> Kerela
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@g

Re: [algogeeks] c output

2011-08-01 Thread Nikhil Gupta
>
> 3.main()
>>>
>>> {
>>>
>>>  int i=1;
>>>
>>> printf("%d\t%d\t%d\t",i,i++,i++);
>>>
>>> }
>>>
>>> output: 3 2 1
>>>
>>> Scan from right. Rightmost i++ is encountered. Value of i is incremented
>>> but this is post increment, so the effect of increment will not show on this
>>> i (But other i's are now incremented). Again another i++ is encountered.
>>> Value of i is incremented but this is post increment, so the effect of
>>> increment will not show on this i again. So the leftmost i is now printed 3,
>>> mid one as 2, right one as 1.
>>>
>>>
>>>  4.main()
>>>
>>> {
>>>
>>>  int i=1;
>>>
>>> printf("%d\t%d\t%d\t",i,++i,++i);
>>>
>>> }
>>>
>>> output: 3 3 3
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Regards
>>> by THANU
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Nikhil Gupta
>> Senior Co-ordinator, Publicity
>> CSI, NSIT Students' Branch
>> NSIT, New Delhi, India
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Missing elements

2011-08-01 Thread Deepak
Given an array of elements 'n'. some khttp://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: doubly linked list program error

2011-08-01 Thread Rajesh Kumar
Thanx a lot 

On Mon, Aug 1, 2011 at 6:32 PM, Amethy hobby  wrote:

> if(start==NULL)
>{
>tmp->prev=NULL;
>// run  here , the start==null, so the start->prev is error
>start->prev=tmp;//here
>
>start=tmp;
> }
>
> On 8月1日, 下午8时41分, Rajesh Kumar  wrote:
> > programs gives segmentation fault when we creat linked list
> > plz help me
> >
> > #include
> > #include
> > #include
> > struct node
> > {
> > struct node *prev;
> > int info;
> > struct node *next;
> >
> > }*start;
> >
> > main()
> > {
> > int choice,n,m,po,i;
> > start=NULL;
> > while(1)
> > {
> > printf("1.Create List\n");
> > printf("2.Add at begining\n");
> > printf("3.Add after\n");
> > printf("4.Delete\n");
> > printf("5.Display\n");
> > printf("6.Count\n");
> > printf("7.Reverse\n");
> > printf("8.exit\n");
> > printf("Enter your choice : ");
> > scanf("%d",&choice);
> > switch(choice)
> > {
> >  case 1:
> > printf("How many nodes you want : ");
> > scanf("%d",&n);
> > for(i=0;i > {
> > printf("Enter the element : ");
> > scanf("%d",&m);
> > create_list(m);
> > }
> > break;
> >  case 2:
> > printf("Enter the element : ");
> > scanf("%d",&m);
> > addatbeg(m);
> > break;
> >  case 3:
> > printf("Enter the element : ");
> > scanf("%d",&m);
> > printf("Enter the position after which this element is
> inserted
> > : ");
> > scanf("%d",&po);
> > addafter(m,po);
> > break;
> >  case 4:
> > printf("Enter the element for deletion : ");
> > scanf("%d",&m);
> > del(m);
> > break;
> >  case 5:
> > display();
> > break;
> >  case 6:
> > count();
> > break;
> >  case 7:
> > rev();
> > break;
> >  case 8:
> > exit(1);
> >  default:
> > printf("Wrong choice\n");
> > }/*End of switch*/
> >}/*End of while*/
> >
> > }/*End of main()*/
> >
> > create_list(int num)
> > {
> > struct node *q,*tmp;
> > tmp= malloc(sizeof(struct node));
> > tmp->info=num;
> > tmp->next=NULL;
> > if(start==NULL)
> > {
> > tmp->prev=NULL;
> > start->prev=tmp;
> > start=tmp;
> > }
> > else
> > {
> > q=start;
> > while(q->next!=NULL)
> > q=q->next;
> > q->next=tmp;
> > tmp->prev=q;
> > }
> >
> > }/*End of create_list()*/
> >
> > addatbeg(int num)
> > {
> > struct node *tmp;
> > tmp=malloc(sizeof(struct node));
> > tmp->prev=NULL;
> > tmp->info=num;
> > tmp->next=start;
> > start->prev=tmp;
> > start=tmp;
> >
> > }/*End of addatbeg()*/
> >
> > addafter(int num,int c)
> > {
> > struct node *tmp,*q;
> > int i;
> > q=start;
> > for(i=0;i > {
> > q=q->next;
> > if(q==NULL)
> > {
> > printf("There are less than %d elements\n",c);
> > return;
> > }
> > }
> > tmp=malloc(sizeof(struct node));
> > tmp->info=num;
> > q->next->prev=tmp;
> > tmp->next=q->next;
> > tmp->prev=q;
> > q->next=tmp;
> >
> > }/*End of addafter() */
> >
> > del(int num)
> > {
> > struct node *tmp,*q;
> > tmp=malloc(sizeof(struct node));
> > if(start->info==num)
> > {
> > tmp=start;
> > start=start->next;  /*first element deleted*/
> > start->prev = NULL;
> > free(tmp);
> > return;
> > }
> > q=start;
> > while(q->next->next!=NULL)
> > {
> > if(q->next->info==num) /*Element deleted in between*/
> > {
> > tmp=q->next;
> > q->next=tmp->next;
> > tmp->next->prev=q;
> > free(tmp);
> > return;
> > }
> > q=q->next;
> > }
> > if(q->next->info==num)/*last element deleted*/
> > {   tmp=q->next;
> > free(tmp);
> > q->next=NULL;
> > return;
> > }
> > printf("Element %d not found\n",num);
> >
> > }/*End of del()*/
> >
> > display()
> > {
> > struct node *q;
> > if(start==NULL)
> > {
> > printf("List is empty\n");
> > return;
> > }
> > q=start;
> > printf("List is :\n");
> > while(q!=NULL)
> > {
> > printf("%d ", q->info);
> > q=q->next;
> > }
> > printf("\n");
> >
> > }/*End of display() */
> >
> > count()
> > {   struct node *q=start;
> > int cnt=0;
> > while(q!=NULL)
> > {
> > q=q->next;
> > cnt++;
> > }
> > printf("Number of elements are %d\n",cnt);
> >
> > }/*End o

Re: [algogeeks] c output

2011-08-01 Thread muruga vel
I cant understand the third one

On Mon, Aug 1, 2011 at 6:09 PM, Nikhil Gupta wrote:

> printf scans the arguments from right to left for any arithmetic operations
> to be performed. If found, they are evaluated according to their precedence.
>
> In 1. main()
>
>> {
>>
>>  int i=1;
>>
>> printf("%d\t%d\t%d\t",i,i++,i);
>>
>> }
>>
>> output: 2 1 2
>>
>> Scanned from right. i++ is encountered. It is evaluated, but keep in mind
>> that this is post increment. So this i will still be displayed without the
>> effect of the increment operator.
>>
> Other i's are incremented though.
>
>>  2.main()
>>
>> {
>>
>>  int i=1;
>>
>> printf("%d\t%d\t%d\t",i,++i,i);
>>
>> }
>>
>> output: 2 2 2
>>
>> Again, the same logic applies here as well. Here we have pre-increment. So
>> this i will have the incremented value.
>>
>>
>>  3.main()
>>
>> {
>>
>>  int i=1;
>>
>> printf("%d\t%d\t%d\t",i,i++,i++);
>>
>> }
>>
>> output: 3 2 1
>>
>> I'm sure you can figure this one and the next one out.
>>
>>
>>  4.main()
>>
>> {
>>
>>  int i=1;
>>
>> printf("%d\t%d\t%d\t",i,++i,++i);
>>
>> }
>>
>> output: 3 3 3
>>
>>
>>
>>
>>
>>
>>
>>
>> Regards
>> by THANU
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Nikhil Gupta
> Senior Co-ordinator, Publicity
> CSI, NSIT Students' Branch
> NSIT, New Delhi, India
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Max subarray of no 2 adjacent elements

2011-08-01 Thread Samba Ganapavarapu
@ Abhishek oh yea sorry.. I read it again, understood what I missed!
I thought we need to find max possible sum of 2 elements excluding adjacent
ones..  sorry guys.

On Mon, Aug 1, 2011 at 8:54 AM, Abhishek Gupta wrote:

>
> @samba
> i think you didnt get the question.
>
> On Mon, Aug 1, 2011 at 5:56 PM, Samba Ganapavarapu 
> wrote:
>
>> Step 1
>> Find the max element position in the array. ( save position maxElement
>> variable ).
>> This takes O (n)
>>
>> Step 2
>> Find the max element position again ( this time exclude maxElement,
>> (maxElement+1) and (maxElement-1) in the comparision ) save this position to
>> secondElementRequired variable
>> This takes O ( n )
>>
>> return array[ maxElement ] + array [secondElementRequired ]
>>
>> Thank you,
>> Samba
>>
>>
>> On Mon, Aug 1, 2011 at 5:31 AM, Abhishek Gupta wrote:
>>
>>> Ya got it.
>>> thanks a lot.
>>> I was looking for dynamic solution only but unable to solve one.
>>>
>>>
>>> On Mon, Aug 1, 2011 at 2:04 PM, Prakash D  wrote:
>>>
 I just thought of an O(n) dp solution

 let a[]=5,2,1,7,9,11

 traverse from i=0 to n-1

 we define arr[i]= a[i]+max(arr[i-2],arr[i-3));


 first arr[0]= 5 + max( a[-2], a[-3]) = 5

 arr[1]= 2

 arr[2]=1 + 5

 arr[3]= 7 + max(5,2) = 7+ 5 = 12

 then arr[4]= 9 + max(2,6) = 15

 then arr[5]= 11 + max(6,12) = 11+12 = 23


 now soln= max( arr[n-1], arr[n-2]) = 23


 hope i'm correct ..


 regards,

 D.Prakash,
 IT, IIIrd year, CEG.






 On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta 
 wrote:

> @Prakash
> can you post your solution please
>
>
> On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta  > wrote:
>
>> @Kartik
>>
>> we cant choose adjacent elements. for ex A={5,2,1,7,9,11} then we will
>> have 5+7+11
>> can any one give any algo for this
>> thank you
>>
>>
>> On Mon, Aug 1, 2011 at 1:25 PM, kartik sachan <
>> kartik.sac...@gmail.com> wrote:
>>
>>> oh..got it i didn't read that statement:(
>>>
>>>  --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Abhishek Gupta
>> MCA
>> NIT Calicut
>> Kerela
>>
>>
>
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.

>>>
>>>
>>>
>>> --
>>> Abhishek Gupta
>>> MCA
>>> NIT Calicut
>>> Kerela
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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,

[algogeeks] Re: doubly linked list program error

2011-08-01 Thread Amethy hobby
if(start==NULL)
{
tmp->prev=NULL;
   // run  here , the start==null, so the start->prev is error
start->prev=tmp;//here

start=tmp;
}

On 8月1日, 下午8时41分, Rajesh Kumar  wrote:
> programs gives segmentation fault when we creat linked list
> plz help me
>
> #include
> #include
> #include
> struct node
> {
>     struct node *prev;
>     int info;
>     struct node *next;
>
> }*start;
>
> main()
> {
>     int choice,n,m,po,i;
>     start=NULL;
>     while(1)
>     {
>         printf("1.Create List\n");
>         printf("2.Add at begining\n");
>         printf("3.Add after\n");
>         printf("4.Delete\n");
>         printf("5.Display\n");
>         printf("6.Count\n");
>         printf("7.Reverse\n");
>         printf("8.exit\n");
>         printf("Enter your choice : ");
>         scanf("%d",&choice);
>         switch(choice)
>         {
>          case 1:
>             printf("How many nodes you want : ");
>             scanf("%d",&n);
>             for(i=0;i             {
>                 printf("Enter the element : ");
>                 scanf("%d",&m);
>                 create_list(m);
>             }
>             break;
>          case 2:
>             printf("Enter the element : ");
>             scanf("%d",&m);
>             addatbeg(m);
>             break;
>          case 3:
>             printf("Enter the element : ");
>             scanf("%d",&m);
>             printf("Enter the position after which this element is inserted
> : ");
>             scanf("%d",&po);
>             addafter(m,po);
>             break;
>          case 4:
>             printf("Enter the element for deletion : ");
>             scanf("%d",&m);
>             del(m);
>             break;
>          case 5:
>             display();
>             break;
>          case 6:
>             count();
>             break;
>          case 7:
>             rev();
>             break;
>          case 8:
>             exit(1);
>          default:
>             printf("Wrong choice\n");
>     }/*End of switch*/
>    }/*End of while*/
>
> }/*End of main()*/
>
> create_list(int num)
> {
>     struct node *q,*tmp;
>     tmp= malloc(sizeof(struct node));
>     tmp->info=num;
>     tmp->next=NULL;
>     if(start==NULL)
>     {
>         tmp->prev=NULL;
>         start->prev=tmp;
>         start=tmp;
>     }
>     else
>     {
>         q=start;
>         while(q->next!=NULL)
>             q=q->next;
>         q->next=tmp;
>         tmp->prev=q;
>     }
>
> }/*End of create_list()*/
>
> addatbeg(int num)
> {
>     struct node *tmp;
>     tmp=malloc(sizeof(struct node));
>     tmp->prev=NULL;
>     tmp->info=num;
>     tmp->next=start;
>     start->prev=tmp;
>     start=tmp;
>
> }/*End of addatbeg()*/
>
> addafter(int num,int c)
> {
>     struct node *tmp,*q;
>     int i;
>     q=start;
>     for(i=0;i     {
>         q=q->next;
>         if(q==NULL)
>         {
>             printf("There are less than %d elements\n",c);
>             return;
>         }
>     }
>     tmp=malloc(sizeof(struct node));
>     tmp->info=num;
>     q->next->prev=tmp;
>     tmp->next=q->next;
>     tmp->prev=q;
>     q->next=tmp;
>
> }/*End of addafter() */
>
> del(int num)
> {
>     struct node *tmp,*q;
>     tmp=malloc(sizeof(struct node));
>     if(start->info==num)
>     {
>         tmp=start;
>         start=start->next;  /*first element deleted*/
>         start->prev = NULL;
>         free(tmp);
>         return;
>     }
>     q=start;
>     while(q->next->next!=NULL)
>     {
>         if(q->next->info==num)     /*Element deleted in between*/
>         {
>             tmp=q->next;
>             q->next=tmp->next;
>             tmp->next->prev=q;
>             free(tmp);
>             return;
>         }
>         q=q->next;
>     }
>     if(q->next->info==num)    /*last element deleted*/
>     {   tmp=q->next;
>         free(tmp);
>         q->next=NULL;
>         return;
>     }
>     printf("Element %d not found\n",num);
>
> }/*End of del()*/
>
> display()
> {
>     struct node *q;
>     if(start==NULL)
>     {
>         printf("List is empty\n");
>         return;
>     }
>     q=start;
>     printf("List is :\n");
>     while(q!=NULL)
>     {
>         printf("%d ", q->info);
>         q=q->next;
>     }
>     printf("\n");
>
> }/*End of display() */
>
> count()
> {   struct node *q=start;
>     int cnt=0;
>     while(q!=NULL)
>     {
>         q=q->next;
>         cnt++;
>     }
>     printf("Number of elements are %d\n",cnt);
>
> }/*End of count()*/
>
> rev()
> {
>     struct node *p1,*p2;
>     p1=start;
>     p2=p1->next;
>     p1->next=NULL;
>     p1->prev=p2;
>     while(p2!=NULL)
>     {
>         p2->prev=p2->next;
>         p2->next=p1;
>         p1=p2;
>         p2=p2->prev; /*next of p2 changed to prev */
>     }
>     start=p1;
>
> }/*End of rev()*/
>
> --
> Regards
> Rajesh Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, se

Re: [algogeeks] Front/end operations

2011-08-01 Thread priyanka raju
wat about a double ended queue?




cheers
priyanka

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Max subarray of no 2 adjacent elements

2011-08-01 Thread Abhishek Gupta
@samba
i think you didnt get the question.
On Mon, Aug 1, 2011 at 5:56 PM, Samba Ganapavarapu wrote:

> Step 1
> Find the max element position in the array. ( save position maxElement
> variable ).
> This takes O (n)
>
> Step 2
> Find the max element position again ( this time exclude maxElement,
> (maxElement+1) and (maxElement-1) in the comparision ) save this position to
> secondElementRequired variable
> This takes O ( n )
>
> return array[ maxElement ] + array [secondElementRequired ]
>
> Thank you,
> Samba
>
>
> On Mon, Aug 1, 2011 at 5:31 AM, Abhishek Gupta wrote:
>
>> Ya got it.
>> thanks a lot.
>> I was looking for dynamic solution only but unable to solve one.
>>
>>
>> On Mon, Aug 1, 2011 at 2:04 PM, Prakash D  wrote:
>>
>>> I just thought of an O(n) dp solution
>>>
>>> let a[]=5,2,1,7,9,11
>>>
>>> traverse from i=0 to n-1
>>>
>>> we define arr[i]= a[i]+max(arr[i-2],arr[i-3));
>>>
>>>
>>> first arr[0]= 5 + max( a[-2], a[-3]) = 5
>>>
>>> arr[1]= 2
>>>
>>> arr[2]=1 + 5
>>>
>>> arr[3]= 7 + max(5,2) = 7+ 5 = 12
>>>
>>> then arr[4]= 9 + max(2,6) = 15
>>>
>>> then arr[5]= 11 + max(6,12) = 11+12 = 23
>>>
>>>
>>> now soln= max( arr[n-1], arr[n-2]) = 23
>>>
>>>
>>> hope i'm correct ..
>>>
>>>
>>> regards,
>>>
>>> D.Prakash,
>>> IT, IIIrd year, CEG.
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta 
>>> wrote:
>>>
 @Prakash
 can you post your solution please


 On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta 
 wrote:

> @Kartik
>
> we cant choose adjacent elements. for ex A={5,2,1,7,9,11} then we will
> have 5+7+11
> can any one give any algo for this
> thank you
>
>
> On Mon, Aug 1, 2011 at 1:25 PM, kartik sachan  > wrote:
>
>> oh..got it i didn't read that statement:(
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>


 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela

  --
 You received this message because you are subscribed to the Google
 Groups "Algorithm Geeks" group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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.
>>>
>>
>>
>>
>> --
>> Abhishek Gupta
>> MCA
>> NIT Calicut
>> Kerela
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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.
>



-- 
Abhishek Gupta
MCA
NIT Calicut
Kerela

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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-01 Thread thanu moorthy
thanks
>>
>> Regards
>> by THANU
>>
>> -
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] doubly linked list program error

2011-08-01 Thread Rajesh Kumar
programs gives segmentation fault when we creat linked list
plz help me

#include
#include
#include
struct node
{
struct node *prev;
int info;
struct node *next;
}*start;

main()
{
int choice,n,m,po,i;
start=NULL;
while(1)
{
printf("1.Create List\n");
printf("2.Add at begining\n");
printf("3.Add after\n");
printf("4.Delete\n");
printf("5.Display\n");
printf("6.Count\n");
printf("7.Reverse\n");
printf("8.exit\n");
printf("Enter your choice : ");
scanf("%d",&choice);
switch(choice)
{
 case 1:
printf("How many nodes you want : ");
scanf("%d",&n);
for(i=0;iinfo=num;
tmp->next=NULL;
if(start==NULL)
{
tmp->prev=NULL;
start->prev=tmp;
start=tmp;
}
else
{
q=start;
while(q->next!=NULL)
q=q->next;
q->next=tmp;
tmp->prev=q;
}
}/*End of create_list()*/

addatbeg(int num)
{
struct node *tmp;
tmp=malloc(sizeof(struct node));
tmp->prev=NULL;
tmp->info=num;
tmp->next=start;
start->prev=tmp;
start=tmp;
}/*End of addatbeg()*/

addafter(int num,int c)
{
struct node *tmp,*q;
int i;
q=start;
for(i=0;inext;
if(q==NULL)
{
printf("There are less than %d elements\n",c);
return;
}
}
tmp=malloc(sizeof(struct node));
tmp->info=num;
q->next->prev=tmp;
tmp->next=q->next;
tmp->prev=q;
q->next=tmp;
}/*End of addafter() */

del(int num)
{
struct node *tmp,*q;
tmp=malloc(sizeof(struct node));
if(start->info==num)
{
tmp=start;
start=start->next;  /*first element deleted*/
start->prev = NULL;
free(tmp);
return;
}
q=start;
while(q->next->next!=NULL)
{
if(q->next->info==num) /*Element deleted in between*/
{
tmp=q->next;
q->next=tmp->next;
tmp->next->prev=q;
free(tmp);
return;
}
q=q->next;
}
if(q->next->info==num)/*last element deleted*/
{   tmp=q->next;
free(tmp);
q->next=NULL;
return;
}
printf("Element %d not found\n",num);
}/*End of del()*/

display()
{
struct node *q;
if(start==NULL)
{
printf("List is empty\n");
return;
}
q=start;
printf("List is :\n");
while(q!=NULL)
{
printf("%d ", q->info);
q=q->next;
}
printf("\n");
}/*End of display() */

count()
{   struct node *q=start;
int cnt=0;
while(q!=NULL)
{
q=q->next;
cnt++;
}
printf("Number of elements are %d\n",cnt);
}/*End of count()*/

rev()
{
struct node *p1,*p2;
p1=start;
p2=p1->next;
p1->next=NULL;
p1->prev=p2;
while(p2!=NULL)
{
p2->prev=p2->next;
p2->next=p1;
p1=p2;
p2=p2->prev; /*next of p2 changed to prev */
}
start=p1;
}/*End of rev()*/


-- 
Regards
Rajesh Kumar

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-08-01 Thread Nikhil Gupta
printf scans the arguments from right to left for any arithmetic operations
to be performed. If found, they are evaluated according to their precedence.

In 1. main()

> {
>
>  int i=1;
>
> printf("%d\t%d\t%d\t",i,i++,i);
>
> }
>
> output: 2 1 2
>
> Scanned from right. i++ is encountered. It is evaluated, but keep in mind
> that this is post increment. So this i will still be displayed without the
> effect of the increment operator.
>
Other i's are incremented though.

>  2.main()
>
> {
>
>  int i=1;
>
> printf("%d\t%d\t%d\t",i,++i,i);
>
> }
>
> output: 2 2 2
>
> Again, the same logic applies here as well. Here we have pre-increment. So
> this i will have the incremented value.
>
>
>  3.main()
>
> {
>
>  int i=1;
>
> printf("%d\t%d\t%d\t",i,i++,i++);
>
> }
>
> output: 3 2 1
>
> I'm sure you can figure this one and the next one out.
>
>
>  4.main()
>
> {
>
>  int i=1;
>
> printf("%d\t%d\t%d\t",i,++i,++i);
>
> }
>
> output: 3 3 3
>
>
>
>
>
>
>
>
> Regards
> by THANU
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Nikhil Gupta
Senior Co-ordinator, Publicity
CSI, NSIT Students' Branch
NSIT, New Delhi, India

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] How to write the algorithm for longest increasing subsequence problem with complexity O(n logn)

2011-08-01 Thread kumar raja
I have seen the code in algorithmist ,but i am not getting it.

@Piyush

how will u solve it using 2-4 tree

On 31 July 2011 23:39, Piyush Gaurav  wrote:

> u need a 2,4 tree for dat
>
>
> On 1 August 2011 11:59, Amol Sharma  wrote:
>
>> can be done with some modification on dp solution of O(n^2).
>>
>> i am comfortable with the O(n^2) solution. but i am also having
>> difficulty in O(nlogn) solution
>>
>> check this link
>> http://www.algorithmist.com/index.php/Longest_Increasing_Subsequence
>>
>>
>> --
>>
>>
>> Amol Sharma
>> Third Year Student
>> Computer Science and Engineering
>> MNNIT Allahabad
>>
>>
>>
>>
>> On Mon, Aug 1, 2011 at 11:49 AM, kumar raja wrote:
>>
>>>
>>>
>>> --
>>> 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.
>>
>
>
>
> --
> 3rd Year student
> Dept. of Computer Science and Engineering
> IIT Kharagpur.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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.



Re: [algogeeks] Max subarray of no 2 adjacent elements

2011-08-01 Thread Samba Ganapavarapu
Step 1
Find the max element position in the array. ( save position maxElement
variable ).
This takes O (n)

Step 2
Find the max element position again ( this time exclude maxElement,
(maxElement+1) and (maxElement-1) in the comparision ) save this position to
secondElementRequired variable
This takes O ( n )

return array[ maxElement ] + array [secondElementRequired ]

Thank you,
Samba

On Mon, Aug 1, 2011 at 5:31 AM, Abhishek Gupta wrote:

> Ya got it.
> thanks a lot.
> I was looking for dynamic solution only but unable to solve one.
>
>
> On Mon, Aug 1, 2011 at 2:04 PM, Prakash D  wrote:
>
>> I just thought of an O(n) dp solution
>>
>> let a[]=5,2,1,7,9,11
>>
>> traverse from i=0 to n-1
>>
>> we define arr[i]= a[i]+max(arr[i-2],arr[i-3));
>>
>>
>> first arr[0]= 5 + max( a[-2], a[-3]) = 5
>>
>> arr[1]= 2
>>
>> arr[2]=1 + 5
>>
>> arr[3]= 7 + max(5,2) = 7+ 5 = 12
>>
>> then arr[4]= 9 + max(2,6) = 15
>>
>> then arr[5]= 11 + max(6,12) = 11+12 = 23
>>
>>
>> now soln= max( arr[n-1], arr[n-2]) = 23
>>
>>
>> hope i'm correct ..
>>
>>
>> regards,
>>
>> D.Prakash,
>> IT, IIIrd year, CEG.
>>
>>
>>
>>
>>
>>
>> On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta wrote:
>>
>>> @Prakash
>>> can you post your solution please
>>>
>>>
>>> On Mon, Aug 1, 2011 at 1:39 PM, Abhishek Gupta 
>>> wrote:
>>>
 @Kartik

 we cant choose adjacent elements. for ex A={5,2,1,7,9,11} then we will
 have 5+7+11
 can any one give any algo for this
 thank you


 On Mon, Aug 1, 2011 at 1:25 PM, kartik sachan 
 wrote:

> oh..got it i didn't read that statement:(
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



 --
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela


>>>
>>>
>>> --
>>> Abhishek Gupta
>>> MCA
>>> NIT Calicut
>>> Kerela
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from 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.
>>
>
>
>
> --
> Abhishek Gupta
> MCA
> NIT Calicut
> Kerela
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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   >