[algogeeks] Re: Array problem

2011-05-21 Thread MONSIEUR
@piyush: excellent buddybtw what was the initial
spark...???.:-)

On May 21, 1:01 pm, Piyush Sinha  wrote:
> @Amit JaspalThe algo given by me works for the given case..check it
>
> On 5/20/11, Anurag Bhatia  wrote:
>
>
>
> > Just need some clarification; sorry I joined the thread late. What are we
> > trying maximize? A[j] -A[i] such that i
> > --Anurag
>
> > On Fri, May 20, 2011 at 12:34 AM, Kunal Patil  wrote:
>
> >> @ Piyush: Excellent Solution...It appears both Correct and O(n)...Good
> >> work !![?]
>
> >> Just a minor correction in your algo.[?]
>
> >> while(B[i] >>  j++;
> >> must also check for J's bound as:
> >> while ( j < ( sizeof(A)/sizeof(A[0]) ) && B[i] >>  j++;
> >> Or it will crash when J goes out of bound and we try to reference C[j].
>
> >> Nywayz..thnx for the solution and algo !!
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, 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.
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926*
>
>  363.gif
> < 1KViewDownload
>
>  360.gif
> < 1KViewDownload

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

2011-05-21 Thread punnu
Given 2 nos.  we need to divide them without performing divison.
Please give a better solution than subtracting the nos. again and
again.

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

2011-05-21 Thread Geo News
*Japanese Universities
All classes are offered in English. 30-100% tuition reduction offered.
http://bit.ly/khS0GB
Study Online For Diploma
Study at Your Own Time & Own Pace Globally Recognized Diploma Courses
http://bit.ly/khS0GB
*
-- 
If you would like to get daily pictures
We've started a Google Group to allow our visitors to get daily funny and
Crazy Pictures , You can join this group for free , go to...
*http://groups.google.com/group/WomenForum/subscribe*

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

2011-05-21 Thread Dave
@Anders: First cache should be 2,000 bananas at 200 km. Then you can
get 534 bananas to the destination as I explained in
http://groups.google.com/group/algogeeks/msg/6ff5e9ca52f4b5d6.

Dave

On May 21, 10:58 am, Anders Ma  wrote:
> 1) go to 1000/3 with 1000 babanas, reserves 1000/3 at 1000/3 position
> 2) same as 1)
>
> now there are 2000/3 bananas at 1000/3 position.
>
> 3) go to 1000/3 position with 1000 babanas, then there are (2000/3 +
> 1000 - 1000/3) = 4000/3 babanas
> 4) go to (1000/3 + (4000/3 -1000)/3) = 4000/9 position with 1000 bananas
> 4) go ahead and finally have (1000 -  (1000 - 4000/9)) = 4000/9 = 444.44

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

2011-05-21 Thread Anders Ma
1) go to 1000/3 with 1000 babanas, reserves 1000/3 at 1000/3 position
2) same as 1)

now there are 2000/3 bananas at 1000/3 position.

3) go to 1000/3 position with 1000 babanas, then there are (2000/3 +
1000 - 1000/3) = 4000/3 babanas
4) go to (1000/3 + (4000/3 -1000)/3) = 4000/9 position with 1000 bananas
4) go ahead and finally have (1000 -  (1000 - 4000/9)) = 4000/9 = 444.44

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

2011-05-21 Thread Kunal Patil
Not strictly an algorithmic question, rather a test-of-design-skills type of
question.
You are asked to design a 3-in-1 remote control for TV, a DVD player, and a
cable box.
How will you go with design ?

In my approach it should have following buttons.

1) *Device Key* :
Will represent device being controlled
For example:
If device key is in TV mode you will be able to control
channel selection, volume, and TV functions.
Similar for DVD player and Cable box.

2) *Power Button*:
Device key will represent device to be powered ON/OFF.
Master Power button
-We can power on all devices sequentially using special pressing
sequence
-or Just a single press along with Device key, in proper mode, will
do it.

3) Channel *selection buttons (0 to 9), volume + - buttons, menu button*:
These will be same for all devices.

4) *Exclusive buttons*:
These are special buttons that apply to particular device only.
  (might be recording button, rewind button, repeat button, etc.)

Any other things you can expect in this design ?
or anything related to the topic that you want to share ?

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

2011-05-21 Thread Dave
@All: The difference between the camel-and-banana problem and this one
is that the elephant eats the banana _after_ he has gone the km. As in
the camel explanation, he establishes a cache of bananas at 200 km.
This takes 5 one-way trips of 200 km, so he eats 1,000 bananas, and
has 2,000 bananas at that point. He then establishes a second cache of
bananas at 533-1/2 km, as follows: Starting with 1,000 bananas, he
goes 333-1/2 km (eating 333 bananas, since he eats a banana only at
the end of a km), drops 333 bananas, and returns 333-1/2 km (eating
334 bananas). Taking the last 1,000 bananas to the second cache, he
eats 333 bananas. So he has 333 + 667 = 1,000 bananas, with 466-1/2 km
left to go. He eats 466 of the 1,000 bananas on the way. Thus, he ends
up with 534 bananas.

Dave

On May 21, 7:14 am, bittu  wrote:
> @all  you can find the better explanation here , hope it will help
>
> http://ashutosh7s.blogspot.com/2011/02/camel-and-banana.html
>
> feel free to comment if anything wrong
>
> Thanks
> Shashank Mani>> "Best Way to Escape From Problem is to Solve It"
> CSE,BIT Mesra

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



[algogeeks] Re: convert a number from one base to another.

2011-05-21 Thread Dave
@Saurabh: Implement a long division algorithm using the original base.
Divide the number by the second base. Convert the remainder to a
single digit in the new base. This is the low-order digit. Apply this
divide and convert algorithm to the successive quotients to get the
successive digits.

Dave

On May 21, 5:18 am, saurabh agrawal  wrote:
> Hi, can someone give an algorithm to directly convert a number in a given
> base to a number in another base,  without converting it into some another
> intermediate base.
>
> I have done that using some numerical analysis techniues, but dont remember
> now.
>
> Thanks in advance.

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

2011-05-21 Thread bittu
Which data structure is the most efficient to store and access movie
shots.
Say, when a movie song is shot, it may include 5 scenes from
Switzerland,8 from malaysia, 6 from india etc. and these various
scenes shot will be sequenced in the movie song in a random order.

Example:
When the movie song is to be played after compilation and editing, it
will be in such an order:

1. 3rd scene of Malaysia
2. 1st scene of Switzerland
3. 6th scene of India
4. 7th scene of malaysia
5. 6th scene of Vienna
6. 1st scene of India
etc.

Such sequence will be huge in case of full movie.

So, which data structure will be the most efficient to store such type
of data and at the same time easily accessible?

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

2011-05-21 Thread Lavesh Rawat
 *Hi*
*
*
*Puzzle Digest Of The Week 16May - 20May*
*
*
*
http://dailybrainteaser.blogspot.com/2011/05/logic-riddle-20-may.html?lavesh=lavesh
*
*
*
*
http://dailybrainteaser.blogspot.com/2011/05/is-this-maths-riddle-19-may.html
?**lavesh=lavesh*
*
*
*
http://dailybrainteaser.blogspot.com/2011/05/greater-than-god-riddle-18-may.html
?**lavesh=lavesh*
*
*
*
http://dailybrainteaser.blogspot.com/2011/05/like-dislike-mathamatical-quiz-17-may.html
?**lavesh=lavesh*
*
*
*http://dailybrainteaser.blogspot.com/2011/05/w-riddle-16-may.html?**
lavesh=lavesh*

*Please subscribe and follow this blog to show your liking to the blog.*
*
*

-- 

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



[algogeeks] Re: PUZZLE

2011-05-21 Thread bittu
@all  you can find the better explanation here , hope it will help

http://ashutosh7s.blogspot.com/2011/02/camel-and-banana.html

feel free to comment if anything wrong


Thanks
Shashank Mani>> "Best Way to Escape From Problem is to Solve It"
CSE,BIT Mesra

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



[algogeeks] Link to my Interview Experiences Blog

2011-05-21 Thread Shivaji Varma
http://mycsinterviewsexperiences.blogspot.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] convert a number from one base to another.

2011-05-21 Thread saurabh agrawal
Hi, can someone give an algorithm to directly convert a number in a given
base to a number in another base,  without converting it into some another
intermediate base.

I have done that using some numerical analysis techniues, but dont remember
now.

Thanks in advance.

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

2011-05-21 Thread immanuel kingston
Solution:

int majorityElement(int a[], int n) {
if (a == null || a.length == 0 || n<=0) return -1;
int mElement = a[0];
int count=1;
for (int i=1; i < n; i++) {
if (a[i] == mElement) {
count++;
} else {
count--;
}
if (count <= 0) {
count = 1;
mElement = a[i];
}
}
count =0;
for (int i=0; i= n/2) ? mElement : -1;
}



On Thu, May 12, 2011 at 10:38 PM, pacific :-)  wrote:

> a sort and another traversal would also do the same job in o( nlogn + n )
> ??
>
>
> On Fri, Apr 15, 2011 at 12:49 AM, vishwakarma  > wrote:
>
>> complexity : O(n) + O(nlogn)
>>
>> Sweety wrote:
>> > Question :Let A[1..n] be an array of integers. Design an efficient
>> > divide and conquer algorithm to determine if A contains a majority
>> > element, i.e an element appears more than n/2 times in A. What is the
>> > time complexity of your algorithm?
>> >
>> > Answer:
>> > a[1..n] is an array
>> > int majorityElement(int a[], int first, int last)
>> > {
>> >  If (first = = last)
>> > {
>> >return a[first]; // Array has one element and its count =
>> 1
>> > and it is major element
>> >  }
>> > mid= (first+last)/2;
>> >
>> >(majorL,countL)= majorityElement(a,first,mid);
>> >(majorR,countR)= majorityElement(a,mid
>> > +1,last);
>> > n = total elements in an array;
>> >   If(majorL==majorR)
>> > return(countL+countR);
>> >  else
>> >  {
>> >If(countL>countR)
>> > return(majorL,countL);
>> >   elseif(countL< countR)
>> > return(majorR,countR);
>> >   else
>> >return(majorL,majorR);
>> >   }
>> >  if(countL>n/2)
>> > temp1=majorL;
>> >   if(countR>n/2)
>> >  temp2=majorR;
>> >
>> >If(temp1 = = temp2)
>> >   return temp1;
>> >   elseif(countL>countR)
>> >  return temp1;
>> >  else (countR>countL)
>> > return temp2;
>> > else
>> >   return -1;
>> > }
>> >
>> > int main()
>> > {
>> >   int a[8] = {2,3,2,2,4,2,2,2};
>> >   int first =1;
>> >   int last=8;   //change the value of last when the array
>> > increases or decreases in size
>> >   int x = majorityElement(a,first,last);
>> >   if(x= = -1)
>> > printf(“No Majority Element”)
>> >   else
>> >   Majority element = x;
>> >  }
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from 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,
> chinna.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, 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] Print Subsets

2011-05-21 Thread immanuel kingston
@Piyush, yep You are right. it looks correct.

On Sat, May 21, 2011 at 1:25 PM, Piyush Sinha wrote:

> @immanuel...i don't think it will..even if u think it does, provide
> any sample test case
>
> On 5/21/11, immanuel kingston  wrote:
> > I think your soln will print repetitions also.
> >
> >
> > On Mon, May 16, 2011 at 2:34 PM, Piyush Sinha
> > wrote:
> >
> >>
> >>
> >> *int ref[] = {2,3,6,7,8};*
> >> *void printcombination(int n,int index,int i)
> >> {
> >>  static int a[100];
> >>  int j;
> >>  if (n == 0)
> >>  {
> >>  for(j=0;j >>   printf("%d  ",a[j]);
> >>  printf("\n");
> >>  }
> >>  else if(n>0)
> >>  {
> >>  for(j=i;j<5;j++)
> >>  {
> >>  a[index]=ref[j];
> >>  printcombination(n-ref[j],index+1,j);
> >>  }
> >>  }
> >> }  *
> >> *main()
> >> {
> >> int n;
> >> printf("enter value of n :");
> >> scanf("%d",&n);
> >> printcombination(n,0,0);
> >> }
> >> *
> >> On Fri, May 13, 2011 at 2:40 AM, amit  wrote:
> >>
> >>> Given a set of numbers eg:{2,3,6,7,8} . any one who is playing the
> >>> game can score points only from this set using the numbers in that
> >>> set. given a number, print all the possible ways of scoring that many
> >>> points. Repetition of combinations are not allowed.
> >>>
> >>> eg:
> >>> 1. 6 points can be scored as
> >>> 6
> >>> 3+3
> >>> 2+2+2
> >>>
> >>> 2. 7 can be scored as
> >>> 7
> >>> 2+2+3
> >>> but 2+3+2 and 3+2+2 is not allowed as they are repetitions of 2+2+3
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "Algorithm Geeks" group.
> >>> To post to this group, send email to algogeeks@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> algogeeks+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/algogeeks?hl=en.
> >>>
> >>>
> >>
> >>
> >> --
> >> PIYUSH SINHA
> >> IIIT, Allahabad
> >>
> >>  --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Algorithm Geeks" group.
> >> To post to this group, send email to algogeeks@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> algogeeks+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/algogeeks?hl=en.
> >>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
> >
> >
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926 *
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, 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: FUN TEASER 11 may

2011-05-21 Thread Piyush Sinha
saraswati river has gone extinct

On 5/21/11, Bhavesh agrawal  wrote:
> if i am in saraswati river then it will be ok as water level is hard to
> swim
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

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

2011-05-21 Thread Bhavesh agrawal
if i am in saraswati river then it will be ok as water level is hard to
swim

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

2011-05-21 Thread Bhavesh agrawal
everyone ,plz post some solution or explanation..

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

2011-05-21 Thread Piyush Sinha
@Amit JaspalThe algo given by me works for the given case..check it

On 5/20/11, Anurag Bhatia  wrote:
> Just need some clarification; sorry I joined the thread late. What are we
> trying maximize? A[j] -A[i] such that i
> --Anurag
>
> On Fri, May 20, 2011 at 12:34 AM, Kunal Patil  wrote:
>>
>> @ Piyush: Excellent Solution...It appears both Correct and O(n)...Good
>> work !![?]
>>
>> Just a minor correction in your algo.[?]
>>
>> while(B[i]>  j++;
>> must also check for J's bound as:
>> while ( j < ( sizeof(A)/sizeof(A[0]) ) && B[i]>  j++;
>> Or it will crash when J goes out of bound and we try to reference C[j].
>>
>> Nywayz..thnx for the solution and algo !!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, 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.
>


-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

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

<<363.gif>><<360.gif>>

Re: [algogeeks] Print Subsets

2011-05-21 Thread Piyush Sinha
@immanuel...i don't think it will..even if u think it does, provide
any sample test case

On 5/21/11, immanuel kingston  wrote:
> I think your soln will print repetitions also.
>
>
> On Mon, May 16, 2011 at 2:34 PM, Piyush Sinha
> wrote:
>
>>
>>
>> *int ref[] = {2,3,6,7,8};*
>> *void printcombination(int n,int index,int i)
>> {
>>  static int a[100];
>>  int j;
>>  if (n == 0)
>>  {
>>  for(j=0;j>   printf("%d  ",a[j]);
>>  printf("\n");
>>  }
>>  else if(n>0)
>>  {
>>  for(j=i;j<5;j++)
>>  {
>>  a[index]=ref[j];
>>  printcombination(n-ref[j],index+1,j);
>>  }
>>  }
>> }  *
>> *main()
>> {
>> int n;
>> printf("enter value of n :");
>> scanf("%d",&n);
>> printcombination(n,0,0);
>> }
>> *
>> On Fri, May 13, 2011 at 2:40 AM, amit  wrote:
>>
>>> Given a set of numbers eg:{2,3,6,7,8} . any one who is playing the
>>> game can score points only from this set using the numbers in that
>>> set. given a number, print all the possible ways of scoring that many
>>> points. Repetition of combinations are not allowed.
>>>
>>> eg:
>>> 1. 6 points can be scored as
>>> 6
>>> 3+3
>>> 2+2+2
>>>
>>> 2. 7 can be scored as
>>> 7
>>> 2+2+3
>>> but 2+3+2 and 3+2+2 is not allowed as they are repetitions of 2+2+3
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>>
>>
>>
>> --
>> PIYUSH SINHA
>> IIIT, Allahabad
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>


-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=10655377926 *

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