Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-27 Thread Ankur Garg
Hi

The solution in the link is of complexity (n*2^n))

Does anyone know any better solution ?

Regards
Ankur
On Tue, Jul 26, 2011 at 11:10 PM, rajeev bharshetty rajeevr...@gmail.comwrote:

 @Ankur The link does has a very good explanation. Nice solution :)


 On Tue, Jul 26, 2011 at 10:47 PM, Kunal Patil kp101...@gmail.com wrote:

 @Ankur Garg: Nice explanation at the link given by u...


 On Tue, Jul 26, 2011 at 10:35 PM, Ankur Garg ankurga...@gmail.comwrote:

 Check this

 http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html


 On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki 
 vishaltha...@gmail.comwrote:

 Here is the working code..

 #include stdio.h
 #include stdlib.h
 int a[] = {1,2,3,4,5};
 #define ARRLEN(a) (sizeof(a)/sizeof(a[0]))
 void print_comb(int len)
 {
int tlen = len;
int i, j, k;
 int al = ARRLEN(a);
for (i = 0; i  al; i++) {
for (j=i+len-1; jal;j++) {
for (k = i; k  i+len-1; k++) {
printf(%d , a[k]);
}
printf(%d\n, a[j]);
 }
}
 }

 int main(int argc, char *argv[])
 {
int len = atoi(argv[1]);
 print_comb(len);
return 0;
 }



 On Tue, Jul 26, 2011 at 5:18 PM, praneethn praneeth...@gmail.com
 wrote:
 
  check this link:
 
  *http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/*
 
  On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com
 wrote:
 
  Given an array of size n, print all the possible subset of array of
  size k.
  eg:-
  input:
  a[]={1,2,3,4}, k = 2
  output:
  1,2
  1,3
  1,4
  2,3
  2,4
  3,4
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

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


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


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




 --
 Regards
 Rajeev N B http://www.opensourcemania.co.cc

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

2011-07-26 Thread Ankur Garg
Hi

Dont u think the subsets will also be

{2,1}
{3,1}
{3,2}
{4,1}
{4,2}
{4,3}

On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:

 Given an array of size n, print all the possible subset of array of
 size k.
 eg:-
 input:
 a[]={1,2,3,4}, k = 2
 output:
 1,2
 1,3
 1,4
 2,3
 2,4
 3,4

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

2011-07-26 Thread Vishal Thanki
@ankur, i think 1,2 and 2,1 would be same as set theory.. CMMIW.
following is the code..

#include stdio.h
#include stdlib.h

void print_comb(int *a, int len)
{
int tlen = len;
int i, j, k;

for (i=0;i5;i++) {
for (j=i+1; j4;j++) {
printf(%d , a[i]);
k=j;
while(tlen-1  0) {
printf(%d , a[k]);
k++;
tlen--;
}
printf(\n);
tlen = len;
}
}
}

int main(int argc, char *argv[])
{
int len = atoi(argv[1]);
int arr[] = {1,2,3,4};
print_comb(arr, len);
return 0;
}


On Tue, Jul 26, 2011 at 1:01 PM, Ankur Garg ankurga...@gmail.com wrote:
 Hi
 Dont u think the subsets will also be
 {2,1}
 {3,1}
 {3,2}
 {4,1}
 {4,2}
 {4,3}
 On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:

 Given an array of size n, print all the possible subset of array of
 size k.
 eg:-
 input:
 a[]={1,2,3,4}, k = 2
 output:
 1,2
 1,3
 1,4
 2,3
 2,4
 3,4

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

2011-07-26 Thread Vishal Thanki
anyway, the code i posted is buggy.. doesn't work for k=3.. don't use it :)

On Tue, Jul 26, 2011 at 1:02 PM, Vishal Thanki vishaltha...@gmail.com wrote:
 @ankur, i think 1,2 and 2,1 would be same as set theory.. CMMIW.
 following is the code..

 #include stdio.h
 #include stdlib.h

 void print_comb(int *a, int len)
 {
        int tlen = len;
        int i, j, k;

        for (i=0;i5;i++) {
                for (j=i+1; j4;j++) {
                        printf(%d , a[i]);
                        k=j;
                        while(tlen-1  0) {
                                printf(%d , a[k]);
                                k++;
                                tlen--;
                        }
                        printf(\n);
                        tlen = len;
                }
        }
 }

 int main(int argc, char *argv[])
 {
        int len = atoi(argv[1]);
        int arr[] = {1,2,3,4};
        print_comb(arr, len);
        return 0;
 }


 On Tue, Jul 26, 2011 at 1:01 PM, Ankur Garg ankurga...@gmail.com wrote:
 Hi
 Dont u think the subsets will also be
 {2,1}
 {3,1}
 {3,2}
 {4,1}
 {4,2}
 {4,3}
 On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:

 Given an array of size n, print all the possible subset of array of
 size k.
 eg:-
 input:
 a[]={1,2,3,4}, k = 2
 output:
 1,2
 1,3
 1,4
 2,3
 2,4
 3,4

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

2011-07-26 Thread Shreyas VA
#include bitset
#include iostream
#include math.h
#include vector

int main() {
using namespace std;
int arr[] = {1,2,3,4};
int k = 2;
int n = sizeof(arr)/sizeof(int);
vectorint v(arr, arr+n);
int l = pow(2.0, n);
for (int i = 0; i  l; ++i) {
bitset32 b(i);
if (b.count() != k)
continue;
for (int j = 0; j  n; ++j) {
if (b[j])
cout  arr[j]   ;
}
cout  endl;
}
return 0;
}

On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:

 Given an array of size n, print all the possible subset of array of
 size k.
 eg:-
 input:
 a[]={1,2,3,4}, k = 2
 output:
 1,2
 1,3
 1,4
 2,3
 2,4
 3,4

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

2011-07-26 Thread praneethn
int main()
{
buildsubsets(0,0,);
}

void buildsubsets(int i,int j,String subset)
{

  if(j==k)
 {
   coutsubset+ ;
   return ;
   }

for(;in;++i)
buildsubsets(i+1,j+1,subset+arr[i]);

}


assume that given arr[] is a character array i.e. arr[]={'1','2','3'}. for
any value of k it works

On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:

 Given an array of size n, print all the possible subset of array of
 size k.
 eg:-
 input:
 a[]={1,2,3,4}, k = 2
 output:
 1,2
 1,3
 1,4
 2,3
 2,4
 3,4

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

2011-07-26 Thread praneethn
check this link:

*http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/*

On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:

 Given an array of size n, print all the possible subset of array of
 size k.
 eg:-
 input:
 a[]={1,2,3,4}, k = 2
 output:
 1,2
 1,3
 1,4
 2,3
 2,4
 3,4

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

2011-07-26 Thread Vishal Thanki
Here is the working code..

#include stdio.h
#include stdlib.h
int a[] = {1,2,3,4,5};
#define ARRLEN(a) (sizeof(a)/sizeof(a[0]))
void print_comb(int len)
{
int tlen = len;
int i, j, k;
int al = ARRLEN(a);
for (i = 0; i  al; i++) {
for (j=i+len-1; jal;j++) {
for (k = i; k  i+len-1; k++) {
printf(%d , a[k]);
}
printf(%d\n, a[j]);
}
}
}

int main(int argc, char *argv[])
{
int len = atoi(argv[1]);
print_comb(len);
return 0;
}



On Tue, Jul 26, 2011 at 5:18 PM, praneethn praneeth...@gmail.com wrote:

 check this link:

 *http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/*

 On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:

 Given an array of size n, print all the possible subset of array of
 size k.
 eg:-
 input:
 a[]={1,2,3,4}, k = 2
 output:
 1,2
 1,3
 1,4
 2,3
 2,4
 3,4

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

2011-07-26 Thread Ankur Garg
Check this

http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html


On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki vishaltha...@gmail.comwrote:

 Here is the working code..

 #include stdio.h
 #include stdlib.h
 int a[] = {1,2,3,4,5};
 #define ARRLEN(a) (sizeof(a)/sizeof(a[0]))
 void print_comb(int len)
 {
int tlen = len;
int i, j, k;
 int al = ARRLEN(a);
for (i = 0; i  al; i++) {
for (j=i+len-1; jal;j++) {
for (k = i; k  i+len-1; k++) {
printf(%d , a[k]);
}
printf(%d\n, a[j]);
 }
}
 }

 int main(int argc, char *argv[])
 {
int len = atoi(argv[1]);
 print_comb(len);
return 0;
 }



 On Tue, Jul 26, 2011 at 5:18 PM, praneethn praneeth...@gmail.com wrote:
 
  check this link:
 
  *http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/*
 
  On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com wrote:
 
  Given an array of size n, print all the possible subset of array of
  size k.
  eg:-
  input:
  a[]={1,2,3,4}, k = 2
  output:
  1,2
  1,3
  1,4
  2,3
  2,4
  3,4
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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] Facebook Interview question at NIT Warangal

2011-07-26 Thread Kunal Patil
@Ankur Garg: Nice explanation at the link given by u...

On Tue, Jul 26, 2011 at 10:35 PM, Ankur Garg ankurga...@gmail.com wrote:

 Check this

 http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html


 On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki vishaltha...@gmail.comwrote:

 Here is the working code..

 #include stdio.h
 #include stdlib.h
 int a[] = {1,2,3,4,5};
 #define ARRLEN(a) (sizeof(a)/sizeof(a[0]))
 void print_comb(int len)
 {
int tlen = len;
int i, j, k;
 int al = ARRLEN(a);
for (i = 0; i  al; i++) {
for (j=i+len-1; jal;j++) {
for (k = i; k  i+len-1; k++) {
printf(%d , a[k]);
}
printf(%d\n, a[j]);
 }
}
 }

 int main(int argc, char *argv[])
 {
int len = atoi(argv[1]);
 print_comb(len);
return 0;
 }



 On Tue, Jul 26, 2011 at 5:18 PM, praneethn praneeth...@gmail.com wrote:
 
  check this link:
 
  *http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/*
 
  On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com
 wrote:
 
  Given an array of size n, print all the possible subset of array of
  size k.
  eg:-
  input:
  a[]={1,2,3,4}, k = 2
  output:
  1,2
  1,3
  1,4
  2,3
  2,4
  3,4
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

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


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


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



Re: [algogeeks] Facebook Interview question at NIT Warangal

2011-07-26 Thread rajeev bharshetty
@Ankur The link does has a very good explanation. Nice solution :)

On Tue, Jul 26, 2011 at 10:47 PM, Kunal Patil kp101...@gmail.com wrote:

 @Ankur Garg: Nice explanation at the link given by u...


 On Tue, Jul 26, 2011 at 10:35 PM, Ankur Garg ankurga...@gmail.com wrote:

 Check this

 http://codesam.blogspot.com/2011/03/find-all-subsets-of-given-set.html


 On Tue, Jul 26, 2011 at 9:41 PM, Vishal Thanki vishaltha...@gmail.comwrote:

 Here is the working code..

 #include stdio.h
 #include stdlib.h
 int a[] = {1,2,3,4,5};
 #define ARRLEN(a) (sizeof(a)/sizeof(a[0]))
 void print_comb(int len)
 {
int tlen = len;
int i, j, k;
 int al = ARRLEN(a);
for (i = 0; i  al; i++) {
for (j=i+len-1; jal;j++) {
for (k = i; k  i+len-1; k++) {
printf(%d , a[k]);
}
printf(%d\n, a[j]);
 }
}
 }

 int main(int argc, char *argv[])
 {
int len = atoi(argv[1]);
 print_comb(len);
return 0;
 }



 On Tue, Jul 26, 2011 at 5:18 PM, praneethn praneeth...@gmail.com
 wrote:
 
  check this link:
 
  *http://www.stefan-pochmann.info/spots/tutorials/sets_subsets/*
 
  On Tue, Jul 26, 2011 at 11:59 AM, sumit sumitispar...@gmail.com
 wrote:
 
  Given an array of size n, print all the possible subset of array of
  size k.
  eg:-
  input:
  a[]={1,2,3,4}, k = 2
  output:
  1,2
  1,3
  1,4
  2,3
  2,4
  3,4
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 

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


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


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




-- 
Regards
Rajeev N B http://www.opensourcemania.co.cc

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