[algogeeks] subset of an array

2011-10-10 Thread Rashmi Jain
algo to find subsets of an array whose sum is equal to a given number..?

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

2011-10-10 Thread Rashmi Jain
not necessary contiguous..
eg:
we are given with an array-1,4,2,26,8,3 and we need to find the subsets of
this having sum of its members as 11.
ans should be  1,2,8 and 8,3
i hope i am clear this time..

On Mon, Oct 10, 2011 at 9:38 PM, Hatta tmd...@gmail.com wrote:

 is it a contiguous set, any sparse subset or what?

 if it's a subset of a set then it can be sparse, but when you say
 array you make it quite tricky to figure out.

 with all due respect sir,
 please mind that when you make a question you're taking peoples time
 to answer it
 therefore if the answer is useless to you  you'd have wasted someone
 else's time with no reason. so please, I gently ask you to make a
 clear question next time.




 On Mon, Oct 10, 2011 at 11:47 AM, Rashmi Jain rashmi.jain...@gmail.com
 wrote:
  algo to find subsets of an array whose sum is equal to a given number..?
 
  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 



 --
 Hatta

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

2011-09-21 Thread Rashmi Jain
@ravi
can u plz explain how 10 processes are created..? shouldn't it be 9..??

On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.com wrote:

 Output Hello printed 10 times. Since form command spawns the process, so
 for every call their are two process created and since if process gets
 successfully created fork returns some positive no. which is the process id,
 so it will break the loop and finally only the 10 child processes will be
 left which will print Hello 10 times. I hope that I cleared your doubt.


 On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.com wrote:

 http://ideone.com/nkTVN


 On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar 
 saravana@gmail.comwrote:

 Hello will be printed 45 times...


 On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.com wrote:

 main()
 {
int tmp;
for(i=0;i9;i++)
{
tmp=fork();
if(tmp0)
break;
printf(Hello);
}
 }


 what's the output and how does this work

 can u give few other questions using fork...

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


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




 --
 *Anil  Arya,
 Computer Science *
 *Motilal Nehru National Institute of Technology,Allahabad .
 *


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




 --
 Regards
 Ravi Maggon
 B.E. CSE, Final Year
 Thapar University

 www.algorithmguru.com

 *Failure is the opportunity to begin again more intelligently*

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

2011-09-21 Thread Rashmi Jain
@ravi: thanks..!!

On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon maggonr...@gmail.com wrote:

 ohh sorry, I thought it was i=9. Yes only 9 times Hello will be printed.

 On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain rashmi.jain...@gmail.comwrote:

 @ravi
 can u plz explain how 10 processes are created..? shouldn't it be 9..??

 On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.comwrote:

 Output Hello printed 10 times. Since form command spawns the process, so
 for every call their are two process created and since if process gets
 successfully created fork returns some positive no. which is the process id,
 so it will break the loop and finally only the 10 child processes will be
 left which will print Hello 10 times. I hope that I cleared your doubt.


 On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.comwrote:

 http://ideone.com/nkTVN


 On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar 
 saravana@gmail.com wrote:

 Hello will be printed 45 times...


 On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.com wrote:

 main()
 {
int tmp;
for(i=0;i9;i++)
{
tmp=fork();
if(tmp0)
break;
printf(Hello);
}
 }


 what's the output and how does this work

 can u give few other questions using fork...

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


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




 --
 *Anil  Arya,
 Computer Science *
 *Motilal Nehru National Institute of Technology,Allahabad .
 *


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




 --
 Regards
 Ravi Maggon
 B.E. CSE, Final Year
 Thapar University

 www.algorithmguru.com

 *Failure is the opportunity to begin again more intelligently*

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Ravi Maggon
 B.E. CSE, Final Year
 Thapar University

 www.algorithmguru.com

 *Failure is the opportunity to begin again more intelligently*

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

2011-09-21 Thread Rashmi Jain
but in this output 10  times hello is printed..how..??

On Thu, Sep 22, 2011 at 1:52 AM, ravi maggon maggonr...@gmail.com wrote:

 This is the output I am getting

-

result: Success time: 0smemory: 1720 kB returned value: 0
 input: no
 output:

HelloHelloHelloHelloHelloHelloHelloHelloHelloHello




 On Thu, Sep 22, 2011 at 1:40 AM, teja bala pawanjalsa.t...@gmail.comwrote:

 @ ravi but compile it on http://ideone.com/nkTVN  it showing 45 hello plz
 do look at it...


 On Thu, Sep 22, 2011 at 12:59 AM, Rashmi Jain 
 rashmi.jain...@gmail.comwrote:

 @ravi: thanks..!!


 On Thu, Sep 22, 2011 at 12:54 AM, ravi maggon maggonr...@gmail.comwrote:

 ohh sorry, I thought it was i=9. Yes only 9 times Hello will be
 printed.

 On Thu, Sep 22, 2011 at 12:52 AM, Rashmi Jain rashmi.jain...@gmail.com
  wrote:

 @ravi
 can u plz explain how 10 processes are created..? shouldn't it be 9..??

 On Thu, Sep 22, 2011 at 12:23 AM, ravi maggon maggonr...@gmail.comwrote:

 Output Hello printed 10 times. Since form command spawns the process,
 so for every call their are two process created and since if process gets
 successfully created fork returns some positive no. which is the process 
 id,
 so it will break the loop and finally only the 10 child processes will be
 left which will print Hello 10 times. I hope that I cleared your doubt.


 On Thu, Sep 22, 2011 at 12:03 AM, Anil Arya anilarya...@gmail.comwrote:

 http://ideone.com/nkTVN


 On Wed, Sep 21, 2011 at 11:43 PM, Saravana kumar 
 saravana@gmail.com wrote:

 Hello will be printed 45 times...


 On Wed, Sep 21, 2011 at 7:57 PM, sush57 sushaant...@gmail.comwrote:

 main()
 {
int tmp;
for(i=0;i9;i++)
{
tmp=fork();
if(tmp0)
break;
printf(Hello);
}
 }


 what's the output and how does this work

 can u give few other questions using fork...

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


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




 --
 *Anil  Arya,
 Computer Science *
 *Motilal Nehru National Institute of Technology,Allahabad .
 *


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




 --
 Regards
 Ravi Maggon
 B.E. CSE, Final Year
 Thapar University

 www.algorithmguru.com

 *Failure is the opportunity to begin again more intelligently*

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 Ravi Maggon
 B.E. CSE, Final Year
 Thapar University

 www.algorithmguru.com

 *Failure is the opportunity to begin again more intelligently*

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

[algogeeks] cormen question

2011-09-10 Thread Rashmi Jain
given a set of S of n integers and another integer x,determine whether or
not there exists two elements in S whose sum is exactly x..running time
should be (n lgn)

-- 
*
RASHMI JAIN
3rd Year,B.E.(IT)
Delhi technological 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] os

2011-09-07 Thread Rashmi Jain
its 19...as 19 prcses are created

On Wed, Sep 7, 2011 at 11:21 PM, Mohit Goel mohitgoel291...@gmail.comwrote:

 20 is not in option ..so whats the answer??

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




-- 
*
RASHMI JAIN
3rd Year,B.E.(IT)
Delhi technological 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] answer these interesting questions

2011-09-07 Thread Rashmi Jain
1. a)
2. c)
3. b)
cnt get the 4th one

On Wed, Sep 7, 2011 at 11:08 PM, Mani Bharathi manibharat...@gmail.comwrote:

 “Kya-Kya” is an island inhabitants of which always answer any question with
 two
 answers , one of which is true and the other is false .

 1.You are walking on a road and came to a park . You ask the inhabitants
 Ram , Laxman and Lila , “which road will
 take me to the village ?”Ram says “I never speak to strangers . I am new to
 these parts .”Laxman says,”I am married
 to Lila . Take the left road .”Lila says “I am married to Ram . He is not
 new in these place .”Which of the following is
 true ?(a)Left road takes you to the village(b)Right road takes you to the
 village(c)Lila is married to Laxman.(d)none.

 2.You find that your boat is stolen . You question three inhabitants of the
 island and reply as follows . John saya “I
 didn’t do it . Mathew did not do it .”Mathew says “I did not do it .
 Krishna did not do it .”Krishna says “I did not do
 it . I do not know who did it .” Who stole your boat ?
 (a)John(b)Mathew(c)Krishna(d)All three (e)none.

 3.You want to speak to the chief of the village . You question three
 inhabitants Amar , Bobby and Charles . Only
 Bobby is wearing a red shirt . Amar says “I am not Bobby’s son .The chief
 wears a red shirt.”Bobby says “I am
 Amar’s father . Charles is the chief.”Charles says “The chief is one among
 us . I am the chief .”Who is the chief?
 (a)Amar(b)Bobby(c)Charles(d)None.

 4.There is only one pilot in the island.You interview three men:Koik,lony
 and Mirna.You also notice that Koik is
 wearing a cap.Mirna says “Lony’s father is the pilot.Lony is not the
 priest’s son.”Koik says “I am the pilot.On this
 island only priests can wear cap.”Lony says “I am the priest’s son.Koik is
 not the priest .”Which of the following is
 true?(a)Lony is not Koik’s son(b)Koik is the pilot(c)Mirna is the
 pilot(d)Lony is the priest.

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




-- 
*
RASHMI JAIN
3rd Year,B.E.(IT)
Delhi technological 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] answer these interesting questions

2011-09-07 Thread Rashmi Jain
4. a)

On Wed, Sep 7, 2011 at 11:56 PM, Rashmi Jain rashmi.jain...@gmail.comwrote:

 1. a)
 2. c)
 3. b)
 cnt get the 4th one


 On Wed, Sep 7, 2011 at 11:08 PM, Mani Bharathi manibharat...@gmail.comwrote:

 “Kya-Kya” is an island inhabitants of which always answer any question
 with two
 answers , one of which is true and the other is false .

 1.You are walking on a road and came to a park . You ask the inhabitants
 Ram , Laxman and Lila , “which road will
 take me to the village ?”Ram says “I never speak to strangers . I am new
 to these parts .”Laxman says,”I am married
 to Lila . Take the left road .”Lila says “I am married to Ram . He is not
 new in these place .”Which of the following is
 true ?(a)Left road takes you to the village(b)Right road takes you to the
 village(c)Lila is married to Laxman.(d)none.

 2.You find that your boat is stolen . You question three inhabitants of
 the island and reply as follows . John saya “I
 didn’t do it . Mathew did not do it .”Mathew says “I did not do it .
 Krishna did not do it .”Krishna says “I did not do
 it . I do not know who did it .” Who stole your boat ?
 (a)John(b)Mathew(c)Krishna(d)All three (e)none.

 3.You want to speak to the chief of the village . You question three
 inhabitants Amar , Bobby and Charles . Only
 Bobby is wearing a red shirt . Amar says “I am not Bobby’s son .The chief
 wears a red shirt.”Bobby says “I am
 Amar’s father . Charles is the chief.”Charles says “The chief is one among
 us . I am the chief .”Who is the chief?
 (a)Amar(b)Bobby(c)Charles(d)None.

 4.There is only one pilot in the island.You interview three men:Koik,lony
 and Mirna.You also notice that Koik is
 wearing a cap.Mirna says “Lony’s father is the pilot.Lony is not the
 priest’s son.”Koik says “I am the pilot.On this
 island only priests can wear cap.”Lony says “I am the priest’s son.Koik is
 not the priest .”Which of the following is
 true?(a)Lony is not Koik’s son(b)Koik is the pilot(c)Mirna is the
 pilot(d)Lony is the priest.

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




 --
 *
 RASHMI JAIN
 3rd Year,B.E.(IT)
 Delhi technological University

 *




-- 
*
RASHMI JAIN
3rd Year,B.E.(IT)
Delhi technological 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.