Re: [algogeeks] Re: finding n numbers having particular sum

2011-04-18 Thread kamlesh yadav
@Don thanks,  nice one, but can u give a little bit of explanation.

On Mon, Apr 18, 2011 at 10:14 PM, Don  wrote:
> const int setSize = 20;
> int set[setSize] =
> { 5,9,1,3,4,2,6,7,11,10,13,15,19,22,25,31,33,37,39,40};
> const int sum = 150;
>
> int rec[setSize];
> int recCount = 0;
> int subset=0;
>
> void search(int *set, int setSize, int sum)
> {
>        int i;
>        if (sum == 0)
>        {
>                printf("Subset %d: {%d", ++subset,rec[0]);
>                for(i = 1; i < recCount; ++i)
>                        printf(",%d", rec[i]);
>                printf("}\n");
>        }
>        else if (sum > 0)
>        {
>                for(i = 0; i < setSize; ++i)
>                {
>                        rec[recCount++] = set[i];
>                        search(set, i, sum-set[i]);
>                        --recCount;
>                }
>        }
> }
>
>
> int main(int argc, char* argv[])
> {
>        search(set, setSize, sum);
>
>        return 0;
> }
>
>
> On Apr 18, 6:16 am, kamlesh yadav  wrote:
>> given an array of elements (all elements are unique ) , given a sum
>> s   find all the subsets having sum s.
>>
>> for ex  array {5,9,1,3,4,2,6,7,11,10}
>>
>> sum is 10
>>
>> possible subsets are     {10},  {6,4}     ,{7,3}      {5,3,2}
>> {6,3,1}  etc.    there can be many more.
>> also find the total number of these subsets
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to 
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
>
>



-- 
Kamlesh Kumar Yadav
MCA  Department of Computer Science
Delhi University

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

2011-04-18 Thread kamlesh yadav
can you give  some links pls

On Mon, Apr 18, 2011 at 9:02 PM, Venki  wrote:
> It is called well known subset sum problem. Backtracking suits well
> for such optimization problems. Read material on state space methods
> of solving subset sum problem.
>
> Regards,
> Venki.
>
> On Apr 18, 4:16 pm, kamlesh yadav  wrote:
>> given an array of elements (all elements are unique ) , given a sum
>> s   find all the subsets having sum s.
>>
>> for ex  array {5,9,1,3,4,2,6,7,11,10}
>>
>> sum is 10
>>
>> possible subsets are     {10},  {6,4}     ,{7,3}      {5,3,2}
>> {6,3,1}  etc.    there can be many more.
>> also find the total number of these subsets
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to 
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/algogeeks?hl=en.
>
>



-- 
Kamlesh Kumar Yadav
MCA  Department of Computer Science
Delhi University

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

2011-04-18 Thread Aishwarya R
good work guys!

On Sat, Apr 16, 2011 at 8:57 AM, Kunal Patil  wrote:

> geeksforgeeks.org
> BTW..
> Thanks for creating this post...I have came across really nice sites that
> interest me in above replies..
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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: Sequence Puzzle 13april

2011-04-18 Thread nagajyothi gunti
Is the answer as follows:
*1 1*
*2 1*
1 2 *1 1*
1 1 1 2* 2 1*
1 1 2 1 1 1 *1 1*
1 1 2 1 1 1 2 1 *2 1*

On Thu, Apr 14, 2011 at 2:36 PM, D.N.Vishwakarma@IITR wrote:

> 3 1 2 2 1 1
> 1 3 1 1 2 2 2 1
>
> On Thu, Apr 14, 2011 at 10:24 PM, arpit.gupta wrote:
>
>> 3 1 2 2 1 1
>> 1 3 1 1 2 2 2 1
>>
>> On Apr 13, 12:32 pm, Lavesh Rawat  wrote:
>> > * Sequence Puzzle
>> >
>> > The below is a number puzzle. It should be read left to right, top to
>> > bottom.
>> > Question 1 What is the next two rows of numbers.
>> > Question 2 How was this reached.
>> > 1 1
>> > 2 1
>> > 1 2 1 1
>> > 1 1 1 2 2 1
>> > *
>> > *Update Your Answers at* : Click
>> > Here<
>> http://dailybrainteaser.blogspot.com/2011/04/sequence-puzzle-13april>
>> >
>> > Solution:
>> > Will be updated after 1 day
>> >
>> > --
>> >
>> > "Never explain yourself. Your friends don’t need it
>> and
>> > your enemies won’t believe it" .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> **With Regards
> Deoki Nandan Vishwakarma
> IITR MCA
> Mathematics Department*
> *
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Jyothi

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-04-18 Thread nagajyothi gunti
Please send me too at nagajyothi.gu...@gmail.com
Also, please let me know what all to prepare...I have an phone interview
from amazon this wednesday.

On Mon, Apr 18, 2011 at 2:40 PM, vaibhav agrawal wrote:

> Please send it to me tooo agrvaib...@gmail.com
>
>
>
> On Mon, Apr 18, 2011 at 10:30 PM, Rel Guzman Apaza wrote:
>
>> Send to me too. Please. rgap...@gmail.com
>>
>>
>> 2011/4/18 Abhishek Goswami 
>>
>>> I think we can share into email...that will not be any issue. :)
>>>
>>>
>>>
>>> On Mon, Apr 18, 2011 at 10:07 PM, Abhishek Goswami <
>>> zeal.gosw...@gmail.com> wrote:
>>>
 can u please me also .. zeal_gosw...@yahoo.com


 On Thu, Apr 14, 2011 at 11:50 AM, Himanshu Neema <
 potential.himansh...@gmail.com> wrote:

> Hi All ,
> Yesterday I received an email from Author that this is *violation of
> Intellectual Property Ownership* ,So kindly please delete pdfs &
> please remove all the sharing.
>
> Thanks Guys.
> Himanshu
>
>
> On Thu, Apr 14, 2011 at 10:52 AM, Harshal  wrote:
>
>> Thanks :)
>>
>> On Thu, Apr 14, 2011 at 9:59 AM, Rajeev Kumar <
>> rajeevprasa...@gmail.com> wrote:
>>
>>> check this link:
>>>
>>> https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=1B5ady61W_93zq0st5FQpvzj4d6wFCdM3Vl8YGSqRt0_NVFWh3SGkNU24hIb3&hl=en
>>>
>>> If you have any problem in access,please inform me
>>>
>>> On Thu, Apr 14, 2011 at 1:04 AM, Abhishek Goswami <
>>> zeal.gosw...@gmail.com> wrote:
>>>
 Hi,
 I tried to open this book in google docs and got message that file
 is not avaliable. does this file not available in google docs
 if yes , can anybody share this book again

 On Tue, Mar 22, 2011 at 10:41 PM, Himanshu Neema <
 potential.himansh...@gmail.com> wrote:

> Turns out that I cant send file larger than 4 MB , please download
> it from here , let me know if you're still unable to download:
>
>
> http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28scan%2Bocr%29%20%281%29.pdf
>
> have fun !
>
>
> On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema <
> potential.himansh...@gmail.com> wrote:
>
>> Enjoy :)
>>
>>
>> On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T <
>> mail2sarava...@gmail.com> wrote:
>>
>>> ++
>>>
>>>
>>> On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri <
>>> anu.anurag@gmail.com> wrote:
>>>
 and me too :)


 On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra <
 mishra00...@gmail.com> wrote:

> count me too
>
>
> On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav <
> kunal.shrivas...@gmail.com> wrote:
>
>> plz send it to me too
>>
>> On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR <
>> deok...@gmail.com> wrote:
>>
>>> --
>>>
>>> *With Regards
>>> Deoki Nandan Vishwakarma
>>> IITR MCA
>>> Mathematics Department
>>> *
>>>
>>> --
>>> You received this message because you are subscribed to the
>>> Google Groups "Algorithm Geeks" group.
>>> To post to this group, send email to
>>> algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> thezeitgeistmovement.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: Amazon Question

2011-04-18 Thread Ashish Goel
This essentially becomes a two pass algo

first find the parent and grand parent  and find children of all the
siblings of the parent


Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652


On Thu, Apr 14, 2011 at 9:53 AM, Dave  wrote:

> @Priya: Assuming that "cousins" means "first cousins," then cousins
> have a common grandparent but different parents. Other people on the
> same level would not be first cousins.
>
> The algorithm is to go up two levels (to the grandparent) and descend
> to the other child (to an aunt or uncle). The children of that node
> are the cousins.
>
> Dave
>
> On Apr 13, 11:13 pm, priya mehta  wrote:
> > i hope all the cousins means all the nodes on the same level, so it
> should
> > be done using level order traversal.
> >
> > On Thu, Apr 14, 2011 at 8:38 AM, sravanreddy001 <
> sravanreddy...@gmail.com>wrote:
> >
> >
> >
> > > Yes, this is correct, and to move the data in the array, its simple,
> just
> > > do a traverse and populate the array..
> >
> > > another way is to put data into queue and putting only one level of
> data at
> > > a time, this reduces the space consumption but... only by half...
> >
> > >  --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Algorithm Geeks" group.
> > > To post to this group, send email to algogeeks@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > algogeeks+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-04-18 Thread vaibhav agrawal
Please send it to me tooo agrvaib...@gmail.com


On Mon, Apr 18, 2011 at 10:30 PM, Rel Guzman Apaza wrote:

> Send to me too. Please. rgap...@gmail.com
>
>
> 2011/4/18 Abhishek Goswami 
>
>> I think we can share into email...that will not be any issue. :)
>>
>>
>>
>> On Mon, Apr 18, 2011 at 10:07 PM, Abhishek Goswami <
>> zeal.gosw...@gmail.com> wrote:
>>
>>> can u please me also .. zeal_gosw...@yahoo.com
>>>
>>>
>>> On Thu, Apr 14, 2011 at 11:50 AM, Himanshu Neema <
>>> potential.himansh...@gmail.com> wrote:
>>>
 Hi All ,
 Yesterday I received an email from Author that this is *violation of
 Intellectual Property Ownership* ,So kindly please delete pdfs & please
 remove all the sharing.

 Thanks Guys.
 Himanshu


 On Thu, Apr 14, 2011 at 10:52 AM, Harshal  wrote:

> Thanks :)
>
> On Thu, Apr 14, 2011 at 9:59 AM, Rajeev Kumar <
> rajeevprasa...@gmail.com> wrote:
>
>> check this link:
>>
>> https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=1B5ady61W_93zq0st5FQpvzj4d6wFCdM3Vl8YGSqRt0_NVFWh3SGkNU24hIb3&hl=en
>>
>> If you have any problem in access,please inform me
>>
>> On Thu, Apr 14, 2011 at 1:04 AM, Abhishek Goswami <
>> zeal.gosw...@gmail.com> wrote:
>>
>>> Hi,
>>> I tried to open this book in google docs and got message that file is
>>> not avaliable. does this file not available in google docs
>>> if yes , can anybody share this book again
>>>
>>> On Tue, Mar 22, 2011 at 10:41 PM, Himanshu Neema <
>>> potential.himansh...@gmail.com> wrote:
>>>
 Turns out that I cant send file larger than 4 MB , please download
 it from here , let me know if you're still unable to download:


 http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28scan%2Bocr%29%20%281%29.pdf

 have fun !


 On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema <
 potential.himansh...@gmail.com> wrote:

> Enjoy :)
>
>
> On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T <
> mail2sarava...@gmail.com> wrote:
>
>> ++
>>
>>
>> On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri <
>> anu.anurag@gmail.com> wrote:
>>
>>> and me too :)
>>>
>>>
>>> On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra <
>>> mishra00...@gmail.com> wrote:
>>>
 count me too


 On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav <
 kunal.shrivas...@gmail.com> wrote:

> plz send it to me too
>
> On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR <
> deok...@gmail.com> wrote:
>
>> --
>>
>> *With Regards
>> Deoki Nandan Vishwakarma
>> IITR MCA
>> Mathematics Department
>> *
>>
>> --
>> You received this message because you are subscribed to the
>> Google Groups "Algorithm Geeks" group.
>> To post to this group, send email to
>> algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> thezeitgeistmovement.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.

>>>
>>>
>>>
>>> --
>>> Regards
>>> Anurag Atri
>>>
>>> --
>>> You received this message because you are subscribed to the
>>> Google Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To un

Re: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-04-18 Thread Rel Guzman Apaza
Send to me too. Please. rgap...@gmail.com

2011/4/18 Abhishek Goswami 

> I think we can share into email...that will not be any issue. :)
>
>
>
> On Mon, Apr 18, 2011 at 10:07 PM, Abhishek Goswami  > wrote:
>
>> can u please me also .. zeal_gosw...@yahoo.com
>>
>>
>> On Thu, Apr 14, 2011 at 11:50 AM, Himanshu Neema <
>> potential.himansh...@gmail.com> wrote:
>>
>>> Hi All ,
>>> Yesterday I received an email from Author that this is *violation of
>>> Intellectual Property Ownership* ,So kindly please delete pdfs & please
>>> remove all the sharing.
>>>
>>> Thanks Guys.
>>> Himanshu
>>>
>>>
>>> On Thu, Apr 14, 2011 at 10:52 AM, Harshal  wrote:
>>>
 Thanks :)

 On Thu, Apr 14, 2011 at 9:59 AM, Rajeev Kumar >>> > wrote:

> check this link:
>
> https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=1B5ady61W_93zq0st5FQpvzj4d6wFCdM3Vl8YGSqRt0_NVFWh3SGkNU24hIb3&hl=en
>
> If you have any problem in access,please inform me
>
> On Thu, Apr 14, 2011 at 1:04 AM, Abhishek Goswami <
> zeal.gosw...@gmail.com> wrote:
>
>> Hi,
>> I tried to open this book in google docs and got message that file is
>> not avaliable. does this file not available in google docs
>> if yes , can anybody share this book again
>>
>> On Tue, Mar 22, 2011 at 10:41 PM, Himanshu Neema <
>> potential.himansh...@gmail.com> wrote:
>>
>>> Turns out that I cant send file larger than 4 MB , please download it
>>> from here , let me know if you're still unable to download:
>>>
>>>
>>> http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28scan%2Bocr%29%20%281%29.pdf
>>>
>>> have fun !
>>>
>>>
>>> On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema <
>>> potential.himansh...@gmail.com> wrote:
>>>
 Enjoy :)


 On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T <
 mail2sarava...@gmail.com> wrote:

> ++
>
>
> On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri <
> anu.anurag@gmail.com> wrote:
>
>> and me too :)
>>
>>
>> On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra <
>> mishra00...@gmail.com> wrote:
>>
>>> count me too
>>>
>>>
>>> On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav <
>>> kunal.shrivas...@gmail.com> wrote:
>>>
 plz send it to me too

 On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR <
 deok...@gmail.com> wrote:

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


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

[algogeeks] Re: finding n numbers having particular sum

2011-04-18 Thread Don
const int setSize = 20;
int set[setSize] =
{ 5,9,1,3,4,2,6,7,11,10,13,15,19,22,25,31,33,37,39,40};
const int sum = 150;

int rec[setSize];
int recCount = 0;
int subset=0;

void search(int *set, int setSize, int sum)
{
int i;
if (sum == 0)
{
printf("Subset %d: {%d", ++subset,rec[0]);
for(i = 1; i < recCount; ++i)
printf(",%d", rec[i]);
printf("}\n");
}
else if (sum > 0)
{
for(i = 0; i < setSize; ++i)
{
rec[recCount++] = set[i];
search(set, i, sum-set[i]);
--recCount;
}
}
}


int main(int argc, char* argv[])
{
search(set, setSize, sum);

return 0;
}


On Apr 18, 6:16 am, kamlesh yadav  wrote:
> given an array of elements (all elements are unique ) , given a sum
> s   find all the subsets having sum s.
>
> for ex  array {5,9,1,3,4,2,6,7,11,10}
>
> sum is 10
>
> possible subsets are     {10},  {6,4}     ,{7,3}      {5,3,2}
> {6,3,1}  etc.    there can be many more.
> also find the total number of these subsets

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-04-18 Thread Abhishek Goswami
I think we can share into email...that will not be any issue. :)


On Mon, Apr 18, 2011 at 10:07 PM, Abhishek Goswami
wrote:

> can u please me also .. zeal_gosw...@yahoo.com
>
>
> On Thu, Apr 14, 2011 at 11:50 AM, Himanshu Neema <
> potential.himansh...@gmail.com> wrote:
>
>> Hi All ,
>> Yesterday I received an email from Author that this is *violation of
>> Intellectual Property Ownership* ,So kindly please delete pdfs & please
>> remove all the sharing.
>>
>> Thanks Guys.
>> Himanshu
>>
>>
>> On Thu, Apr 14, 2011 at 10:52 AM, Harshal  wrote:
>>
>>> Thanks :)
>>>
>>> On Thu, Apr 14, 2011 at 9:59 AM, Rajeev Kumar 
>>> wrote:
>>>
 check this link:

 https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=1B5ady61W_93zq0st5FQpvzj4d6wFCdM3Vl8YGSqRt0_NVFWh3SGkNU24hIb3&hl=en

 If you have any problem in access,please inform me

 On Thu, Apr 14, 2011 at 1:04 AM, Abhishek Goswami <
 zeal.gosw...@gmail.com> wrote:

> Hi,
> I tried to open this book in google docs and got message that file is
> not avaliable. does this file not available in google docs
> if yes , can anybody share this book again
>
> On Tue, Mar 22, 2011 at 10:41 PM, Himanshu Neema <
> potential.himansh...@gmail.com> wrote:
>
>> Turns out that I cant send file larger than 4 MB , please download it
>> from here , let me know if you're still unable to download:
>>
>>
>> http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28scan%2Bocr%29%20%281%29.pdf
>>
>> have fun !
>>
>>
>> On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema <
>> potential.himansh...@gmail.com> wrote:
>>
>>> Enjoy :)
>>>
>>>
>>> On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T <
>>> mail2sarava...@gmail.com> wrote:
>>>
 ++


 On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri <
 anu.anurag@gmail.com> wrote:

> and me too :)
>
>
> On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra <
> mishra00...@gmail.com> wrote:
>
>> count me too
>>
>>
>> On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav <
>> kunal.shrivas...@gmail.com> wrote:
>>
>>> plz send it to me too
>>>
>>> On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR <
>>> deok...@gmail.com> wrote:
>>>
 --

 *With Regards
 Deoki Nandan Vishwakarma
 IITR MCA
 Mathematics Department
 *

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


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

Re: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-04-18 Thread Abhishek Goswami
can u please me also .. zeal_gosw...@yahoo.com

On Thu, Apr 14, 2011 at 11:50 AM, Himanshu Neema <
potential.himansh...@gmail.com> wrote:

> Hi All ,
> Yesterday I received an email from Author that this is *violation of
> Intellectual Property Ownership* ,So kindly please delete pdfs & please
> remove all the sharing.
>
> Thanks Guys.
> Himanshu
>
>
> On Thu, Apr 14, 2011 at 10:52 AM, Harshal  wrote:
>
>> Thanks :)
>>
>> On Thu, Apr 14, 2011 at 9:59 AM, Rajeev Kumar 
>> wrote:
>>
>>> check this link:
>>>
>>> https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=1B5ady61W_93zq0st5FQpvzj4d6wFCdM3Vl8YGSqRt0_NVFWh3SGkNU24hIb3&hl=en
>>>
>>> If you have any problem in access,please inform me
>>>
>>> On Thu, Apr 14, 2011 at 1:04 AM, Abhishek Goswami <
>>> zeal.gosw...@gmail.com> wrote:
>>>
 Hi,
 I tried to open this book in google docs and got message that file is
 not avaliable. does this file not available in google docs
 if yes , can anybody share this book again

 On Tue, Mar 22, 2011 at 10:41 PM, Himanshu Neema <
 potential.himansh...@gmail.com> wrote:

> Turns out that I cant send file larger than 4 MB , please download it
> from here , let me know if you're still unable to download:
>
>
> http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28scan%2Bocr%29%20%281%29.pdf
>
> have fun !
>
>
> On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema <
> potential.himansh...@gmail.com> wrote:
>
>> Enjoy :)
>>
>>
>> On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T <
>> mail2sarava...@gmail.com> wrote:
>>
>>> ++
>>>
>>>
>>> On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri <
>>> anu.anurag@gmail.com> wrote:
>>>
 and me too :)


 On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra <
 mishra00...@gmail.com> wrote:

> count me too
>
>
> On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav <
> kunal.shrivas...@gmail.com> wrote:
>
>> plz send it to me too
>>
>> On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR <
>> deok...@gmail.com> wrote:
>>
>>> --
>>>
>>> *With Regards
>>> Deoki Nandan Vishwakarma
>>> IITR MCA
>>> Mathematics Department
>>> *
>>>
>>> --
>>> You received this message because you are subscribed to the
>>> Google Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> thezeitgeistmovement.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.
>



 --
 Regards
 Anurag Atri

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

[algogeeks] Register your business in Canada

2011-04-18 Thread Geo News
*Open a Company in Canada
You can Register your business in Canada You don’t need to go there. Ask us!

http://bit.ly/biZzwiz

http://bit.ly/biZzwiz

--
*

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

2011-04-18 Thread Venki
It is called well known subset sum problem. Backtracking suits well
for such optimization problems. Read material on state space methods
of solving subset sum problem.

Regards,
Venki.

On Apr 18, 4:16 pm, kamlesh yadav  wrote:
> given an array of elements (all elements are unique ) , given a sum
> s   find all the subsets having sum s.
>
> for ex  array {5,9,1,3,4,2,6,7,11,10}
>
> sum is 10
>
> possible subsets are     {10},  {6,4}     ,{7,3}      {5,3,2}
> {6,3,1}  etc.    there can be many more.
> also find the total number of these subsets

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

2011-04-18 Thread Anurag atri
the numbers are sorted alphabetically .
'e'ight
'f'ive
'f'our
.
.
.
.
.
'z'ero

On Mon, Apr 18, 2011 at 2:11 PM, Vandana Bachani wrote:

> A funny one... until I figure out...
> It contains all numbers from 0 to 10 :P
>
>
> On Mon, Apr 18, 2011 at 1:58 PM, Lavesh Rawat wrote:
>
>> * sequence number puzzle
>>
>> What is special about the following sequence of numbers?
>> 8 5 4 9 1 7 6 10 3 2 0
>> *
>> *Update Your Answers at* : Click 
>> Here
>>
>> Solution:
>> Will be updated after 1 day
>>
>>
>> --
>>
>> "Never explain yourself. Your friends don’t need it
>> and your enemies won’t believe it" .
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from 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
Anurag Atri
II year
Computer Engineering
Delhi College Of Engineering

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

2011-04-18 Thread kamlesh yadav
given an array of elements (all elements are unique ) , given a sum
s   find all the subsets having sum s.

for ex  array {5,9,1,3,4,2,6,7,11,10}

sum is 10

possible subsets are {10},  {6,4} ,{7,3}  {5,3,2}
{6,3,1}  etc.there can be many more.
also find the total number of these subsets

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

2011-04-18 Thread Vandana Bachani
A funny one... until I figure out...
It contains all numbers from 0 to 10 :P

On Mon, Apr 18, 2011 at 1:58 PM, Lavesh Rawat wrote:

> * sequence number puzzle
>
> What is special about the following sequence of numbers?
> 8 5 4 9 1 7 6 10 3 2 0
> *
> *Update Your Answers at* : Click 
> Here
>
> Solution:
> Will be updated after 1 day
>
>
> --
>
> "Never explain yourself. Your friends don’t need it and
> your enemies won’t believe it" .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

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

2011-04-18 Thread Lavesh Rawat
* sequence number puzzle

What is special about the following sequence of numbers?
8 5 4 9 1 7 6 10 3 2 0
*
*Update Your Answers at* : Click
Here

Solution:
Will be updated after 1 day


-- 

"Never explain yourself. Your friends don’t need it and
your enemies won’t believe it" .

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



Re: [algogeeks] If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-04-18 Thread Arvinth Deenadayalan
Hi all,
This wil create copy rights violation. Please try to respect the authors note..

On 4/18/11, KK  wrote:
> Hey plzz mail me too..
>
> On Apr 14, 9:29 am, Rajeev Kumar  wrote:
>> check this
>> link:https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=1B5...
>>
>> If you have any problem in access,please inform me
>>
>> On Thu, Apr 14, 2011 at 1:04 AM, Abhishek Goswami
>> wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> > Hi,
>> > I tried to open this book in google docs and got message that file is
>> > not
>> > avaliable. does this file not available in google docs
>> > if yes , can anybody share this book again
>>
>> > On Tue, Mar 22, 2011 at 10:41 PM, Himanshu Neema <
>> > potential.himansh...@gmail.com> wrote:
>>
>> >> Turns out that I cant send file larger than 4 MB , please download it
>> >> from
>> >> here , let me know if you're still unable to download:
>>
>> >>http://dl.dropbox.com/u/2681370/Algorithms%2Bfor%2BInterviews%2B%28sc...
>>
>> >> have fun !
>>
>> >> On Tue, Mar 22, 2011 at 10:21 PM, Himanshu Neema <
>> >> potential.himansh...@gmail.com> wrote:
>>
>> >>> Enjoy :)
>>
>> >>> On Tue, Mar 22, 2011 at 10:09 PM, Saravanan T
>> >>> wrote:
>>
>>  ++
>>
>>  On Tue, Mar 22, 2011 at 9:51 PM, Anurag atri
>>  wrote:
>>
>> > and me too :)
>>
>> > On Tue, Mar 22, 2011 at 9:28 PM, Nikhil Mishra
>> > wrote:
>>
>> >> count me too
>>
>> >> On Tue, Mar 22, 2011 at 11:16 AM, kunal srivastav <
>> >> kunal.shrivas...@gmail.com> wrote:
>>
>> >>> plz send it to me too
>>
>> >>> On Tue, Mar 22, 2011 at 11:14 AM, D.N.Vishwakarma@IITR <
>> >>> deok...@gmail.com> wrote:
>>
>>  --
>>
>>  *With Regards
>>  Deoki Nandan Vishwakarma
>>  IITR MCA
>>  Mathematics Department
>>  *
>>
>>  --
>>  You received this message because you are subscribed to the
>>  Google
>>  Groups "Algorithm Geeks" group.
>>  To post to this group, send email to algogeeks@googlegroups.com.
>>  To unsubscribe from this group, send email to
>>  algogeeks+unsubscr...@googlegroups.com.
>>  For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>> >>> --
>> >>> thezeitgeistmovement.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.
>>
>> > --
>> > Regards
>> > Anurag Atri
>>
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Algorithm Geeks" group.
>> > To post to this group, send email to algogeeks@googlegroups.com.
>> > To unsubscribe from 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.
>>
>> --
>> 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