Print all subsequences of given size

Here given code implementation process.

// C program 
// Print all subsequences of given size

#include <stdio.h>


//Print all subsequences in a given size k
void print_subsequences(int collection[],
    int output[],
    int n,
    int k,
    int next,
    int location)
{
    
    if(location == k)
    {
        // When get new subsequence of k size
        printf(" [");

        for (int i = 0; i < k; ++i)
        {
            printf(" %d ",collection[output[i]]);
        }

        printf("]\n");

        return;
    }
    else
    {
        for (int i = next; i < n ; ++i)
        {
            // Get location of subset collection 
            output[location] = i;

            print_subsequences(collection,output,n,k,i+1,location+1);
        }
    }
}


// Handles the request to print subsequence element
void subsequences(int collection[],int n, int length)
{
   
    if(n <= 0 || length <= 0 && length >= n)
    {
        //if not a valid inputs
        return;
    }

    //Used to display result
    int output[length];

    printf("\n Subsequences of size %d \n",length);

    print_subsequences(collection,output,n,length,0,0);
}

int main()
{
   
    //Define the element of integers
    int arr[] = { 4, 7, 8, 1, 3, 5, 6, 2};

    int length   = 4;

    //Get the size 
    int size = sizeof(arr)/sizeof(arr[0]);

    //Test Case 1
    subsequences(arr,size,length);

    length   = 6;

    //Test Case 2
    subsequences(arr,size,length);

    return 0;
}

Output

 Subsequences of size 4
 [ 4  7  8  1 ]
 [ 4  7  8  3 ]
 [ 4  7  8  5 ]
 [ 4  7  8  6 ]
 [ 4  7  8  2 ]
 [ 4  7  1  3 ]
 [ 4  7  1  5 ]
 [ 4  7  1  6 ]
 [ 4  7  1  2 ]
 [ 4  7  3  5 ]
 [ 4  7  3  6 ]
 [ 4  7  3  2 ]
 [ 4  7  5  6 ]
 [ 4  7  5  2 ]
 [ 4  7  6  2 ]
 [ 4  8  1  3 ]
 [ 4  8  1  5 ]
 [ 4  8  1  6 ]
 [ 4  8  1  2 ]
 [ 4  8  3  5 ]
 [ 4  8  3  6 ]
 [ 4  8  3  2 ]
 [ 4  8  5  6 ]
 [ 4  8  5  2 ]
 [ 4  8  6  2 ]
 [ 4  1  3  5 ]
 [ 4  1  3  6 ]
 [ 4  1  3  2 ]
 [ 4  1  5  6 ]
 [ 4  1  5  2 ]
 [ 4  1  6  2 ]
 [ 4  3  5  6 ]
 [ 4  3  5  2 ]
 [ 4  3  6  2 ]
 [ 4  5  6  2 ]
 [ 7  8  1  3 ]
 [ 7  8  1  5 ]
 [ 7  8  1  6 ]
 [ 7  8  1  2 ]
 [ 7  8  3  5 ]
 [ 7  8  3  6 ]
 [ 7  8  3  2 ]
 [ 7  8  5  6 ]
 [ 7  8  5  2 ]
 [ 7  8  6  2 ]
 [ 7  1  3  5 ]
 [ 7  1  3  6 ]
 [ 7  1  3  2 ]
 [ 7  1  5  6 ]
 [ 7  1  5  2 ]
 [ 7  1  6  2 ]
 [ 7  3  5  6 ]
 [ 7  3  5  2 ]
 [ 7  3  6  2 ]
 [ 7  5  6  2 ]
 [ 8  1  3  5 ]
 [ 8  1  3  6 ]
 [ 8  1  3  2 ]
 [ 8  1  5  6 ]
 [ 8  1  5  2 ]
 [ 8  1  6  2 ]
 [ 8  3  5  6 ]
 [ 8  3  5  2 ]
 [ 8  3  6  2 ]
 [ 8  5  6  2 ]
 [ 1  3  5  6 ]
 [ 1  3  5  2 ]
 [ 1  3  6  2 ]
 [ 1  5  6  2 ]
 [ 3  5  6  2 ]

 Subsequences of size 6
 [ 4  7  8  1  3  5 ]
 [ 4  7  8  1  3  6 ]
 [ 4  7  8  1  3  2 ]
 [ 4  7  8  1  5  6 ]
 [ 4  7  8  1  5  2 ]
 [ 4  7  8  1  6  2 ]
 [ 4  7  8  3  5  6 ]
 [ 4  7  8  3  5  2 ]
 [ 4  7  8  3  6  2 ]
 [ 4  7  8  5  6  2 ]
 [ 4  7  1  3  5  6 ]
 [ 4  7  1  3  5  2 ]
 [ 4  7  1  3  6  2 ]
 [ 4  7  1  5  6  2 ]
 [ 4  7  3  5  6  2 ]
 [ 4  8  1  3  5  6 ]
 [ 4  8  1  3  5  2 ]
 [ 4  8  1  3  6  2 ]
 [ 4  8  1  5  6  2 ]
 [ 4  8  3  5  6  2 ]
 [ 4  1  3  5  6  2 ]
 [ 7  8  1  3  5  6 ]
 [ 7  8  1  3  5  2 ]
 [ 7  8  1  3  6  2 ]
 [ 7  8  1  5  6  2 ]
 [ 7  8  3  5  6  2 ]
 [ 7  1  3  5  6  2 ]
 [ 8  1  3  5  6  2 ]
/* 
  Java program 
  Print all subsequences of given size
*/
class Subsequence
{
	//Print all subsequences in a given size k
	public void print_subsequences(int[] collection, int[] output, int n, int k, int next, int location)
	{
		if (location == k)
		{
			// When get new subsequence of k size
			System.out.print(" [");
			for (int i = 0; i < k; ++i)
			{
				System.out.print(" " + collection[output[i]] + " ");
			}
			System.out.print("]\n");
			return;
		}
		else
		{
			for (int i = next; i < n; ++i)
			{
				// Get location of subset collection 
				output[location] = i;
				print_subsequences(collection, output, n, k, i + 1, location + 1);
			}
		}
	}
	// Handles the request to print subsequence element
	public void subsequences(int[] collection, int n, int size)
	{
		if (n <= 0 || size <= 0 && size >= n)
		{
			//if not a valid inputs
			return;
		}
		//Used to display result
		int[] output = new int[size];
		System.out.print("\n Subsequences of size " + size + " \n");
		print_subsequences(collection, output, n, size, 0, 0);
	}
	public static void main(String[] args)
	{
		Subsequence obj = new Subsequence();
		//Define the element of integers
		int[] arr = {
			4 , 7 , 8 , 1 , 3 , 5 , 6 , 2
		};
		int size = 4;
		//Get the size 
		int n = arr.length;
		//Test Case 1
		obj.subsequences(arr, n, size);
		size = 6;
		//Test Case 2
		obj.subsequences(arr, n, size);
	}
}

Output

 Subsequences of size 4
 [ 4  7  8  1 ]
 [ 4  7  8  3 ]
 [ 4  7  8  5 ]
 [ 4  7  8  6 ]
 [ 4  7  8  2 ]
 [ 4  7  1  3 ]
 [ 4  7  1  5 ]
 [ 4  7  1  6 ]
 [ 4  7  1  2 ]
 [ 4  7  3  5 ]
 [ 4  7  3  6 ]
 [ 4  7  3  2 ]
 [ 4  7  5  6 ]
 [ 4  7  5  2 ]
 [ 4  7  6  2 ]
 [ 4  8  1  3 ]
 [ 4  8  1  5 ]
 [ 4  8  1  6 ]
 [ 4  8  1  2 ]
 [ 4  8  3  5 ]
 [ 4  8  3  6 ]
 [ 4  8  3  2 ]
 [ 4  8  5  6 ]
 [ 4  8  5  2 ]
 [ 4  8  6  2 ]
 [ 4  1  3  5 ]
 [ 4  1  3  6 ]
 [ 4  1  3  2 ]
 [ 4  1  5  6 ]
 [ 4  1  5  2 ]
 [ 4  1  6  2 ]
 [ 4  3  5  6 ]
 [ 4  3  5  2 ]
 [ 4  3  6  2 ]
 [ 4  5  6  2 ]
 [ 7  8  1  3 ]
 [ 7  8  1  5 ]
 [ 7  8  1  6 ]
 [ 7  8  1  2 ]
 [ 7  8  3  5 ]
 [ 7  8  3  6 ]
 [ 7  8  3  2 ]
 [ 7  8  5  6 ]
 [ 7  8  5  2 ]
 [ 7  8  6  2 ]
 [ 7  1  3  5 ]
 [ 7  1  3  6 ]
 [ 7  1  3  2 ]
 [ 7  1  5  6 ]
 [ 7  1  5  2 ]
 [ 7  1  6  2 ]
 [ 7  3  5  6 ]
 [ 7  3  5  2 ]
 [ 7  3  6  2 ]
 [ 7  5  6  2 ]
 [ 8  1  3  5 ]
 [ 8  1  3  6 ]
 [ 8  1  3  2 ]
 [ 8  1  5  6 ]
 [ 8  1  5  2 ]
 [ 8  1  6  2 ]
 [ 8  3  5  6 ]
 [ 8  3  5  2 ]
 [ 8  3  6  2 ]
 [ 8  5  6  2 ]
 [ 1  3  5  6 ]
 [ 1  3  5  2 ]
 [ 1  3  6  2 ]
 [ 1  5  6  2 ]
 [ 3  5  6  2 ]

 Subsequences of size 6
 [ 4  7  8  1  3  5 ]
 [ 4  7  8  1  3  6 ]
 [ 4  7  8  1  3  2 ]
 [ 4  7  8  1  5  6 ]
 [ 4  7  8  1  5  2 ]
 [ 4  7  8  1  6  2 ]
 [ 4  7  8  3  5  6 ]
 [ 4  7  8  3  5  2 ]
 [ 4  7  8  3  6  2 ]
 [ 4  7  8  5  6  2 ]
 [ 4  7  1  3  5  6 ]
 [ 4  7  1  3  5  2 ]
 [ 4  7  1  3  6  2 ]
 [ 4  7  1  5  6  2 ]
 [ 4  7  3  5  6  2 ]
 [ 4  8  1  3  5  6 ]
 [ 4  8  1  3  5  2 ]
 [ 4  8  1  3  6  2 ]
 [ 4  8  1  5  6  2 ]
 [ 4  8  3  5  6  2 ]
 [ 4  1  3  5  6  2 ]
 [ 7  8  1  3  5  6 ]
 [ 7  8  1  3  5  2 ]
 [ 7  8  1  3  6  2 ]
 [ 7  8  1  5  6  2 ]
 [ 7  8  3  5  6  2 ]
 [ 7  1  3  5  6  2 ]
 [ 8  1  3  5  6  2 ]
//Include namespace system
using System;
/* 
  C# program 
  Print all subsequences of given size
*/
class Subsequence
{
	//Print all subsequences in a given size k
	public void print_subsequences(int[] collection, int[] output, int n, int k, int next, int location)
	{
		int i = 0;
		if (location == k)
		{
			// When get new subsequence of k size
			Console.Write(" [");
			while (i < k)
			{
				Console.Write(" " + collection[output[i]] + " ");
				++i;
			}
			Console.Write("]\n");
			return;
		}
		else
		{
			i = next;
			while (i < n)
			{
				// Get location of subset collection 
				output[location] = i;
				print_subsequences(collection, output, n, k, i + 1, location + 1);
				++i;
			}
		}
	}
	// Handles the request to print subsequence element
	public void subsequences(int[] collection, int n, int size)
	{
		if (n <= 0 || size <= 0 && size >= n)
		{
			//if not a valid inputs
			return;
		}
		//Used to display result
		int[] output = new int[size];
		Console.Write("\n Subsequences of size " + size + " \n");
		print_subsequences(collection, output, n, size, 0, 0);
	}
	public static void Main(String[] args)
	{
		Subsequence obj = new Subsequence();
		//Define the element of integers
		int[] arr = {
			4 , 7 , 8 , 1 , 3 , 5 , 6 , 2
		};
		int size = 4;
		//Get the size 
		int n = arr.Length;
		//Test Case 1
		obj.subsequences(arr, n, size);
		size = 6;
		//Test Case 2
		obj.subsequences(arr, n, size);
	}
}

Output

 Subsequences of size 4
 [ 4  7  8  1 ]
 [ 4  7  8  3 ]
 [ 4  7  8  5 ]
 [ 4  7  8  6 ]
 [ 4  7  8  2 ]
 [ 4  7  1  3 ]
 [ 4  7  1  5 ]
 [ 4  7  1  6 ]
 [ 4  7  1  2 ]
 [ 4  7  3  5 ]
 [ 4  7  3  6 ]
 [ 4  7  3  2 ]
 [ 4  7  5  6 ]
 [ 4  7  5  2 ]
 [ 4  7  6  2 ]
 [ 4  8  1  3 ]
 [ 4  8  1  5 ]
 [ 4  8  1  6 ]
 [ 4  8  1  2 ]
 [ 4  8  3  5 ]
 [ 4  8  3  6 ]
 [ 4  8  3  2 ]
 [ 4  8  5  6 ]
 [ 4  8  5  2 ]
 [ 4  8  6  2 ]
 [ 4  1  3  5 ]
 [ 4  1  3  6 ]
 [ 4  1  3  2 ]
 [ 4  1  5  6 ]
 [ 4  1  5  2 ]
 [ 4  1  6  2 ]
 [ 4  3  5  6 ]
 [ 4  3  5  2 ]
 [ 4  3  6  2 ]
 [ 4  5  6  2 ]
 [ 7  8  1  3 ]
 [ 7  8  1  5 ]
 [ 7  8  1  6 ]
 [ 7  8  1  2 ]
 [ 7  8  3  5 ]
 [ 7  8  3  6 ]
 [ 7  8  3  2 ]
 [ 7  8  5  6 ]
 [ 7  8  5  2 ]
 [ 7  8  6  2 ]
 [ 7  1  3  5 ]
 [ 7  1  3  6 ]
 [ 7  1  3  2 ]
 [ 7  1  5  6 ]
 [ 7  1  5  2 ]
 [ 7  1  6  2 ]
 [ 7  3  5  6 ]
 [ 7  3  5  2 ]
 [ 7  3  6  2 ]
 [ 7  5  6  2 ]
 [ 8  1  3  5 ]
 [ 8  1  3  6 ]
 [ 8  1  3  2 ]
 [ 8  1  5  6 ]
 [ 8  1  5  2 ]
 [ 8  1  6  2 ]
 [ 8  3  5  6 ]
 [ 8  3  5  2 ]
 [ 8  3  6  2 ]
 [ 8  5  6  2 ]
 [ 1  3  5  6 ]
 [ 1  3  5  2 ]
 [ 1  3  6  2 ]
 [ 1  5  6  2 ]
 [ 3  5  6  2 ]

 Subsequences of size 6
 [ 4  7  8  1  3  5 ]
 [ 4  7  8  1  3  6 ]
 [ 4  7  8  1  3  2 ]
 [ 4  7  8  1  5  6 ]
 [ 4  7  8  1  5  2 ]
 [ 4  7  8  1  6  2 ]
 [ 4  7  8  3  5  6 ]
 [ 4  7  8  3  5  2 ]
 [ 4  7  8  3  6  2 ]
 [ 4  7  8  5  6  2 ]
 [ 4  7  1  3  5  6 ]
 [ 4  7  1  3  5  2 ]
 [ 4  7  1  3  6  2 ]
 [ 4  7  1  5  6  2 ]
 [ 4  7  3  5  6  2 ]
 [ 4  8  1  3  5  6 ]
 [ 4  8  1  3  5  2 ]
 [ 4  8  1  3  6  2 ]
 [ 4  8  1  5  6  2 ]
 [ 4  8  3  5  6  2 ]
 [ 4  1  3  5  6  2 ]
 [ 7  8  1  3  5  6 ]
 [ 7  8  1  3  5  2 ]
 [ 7  8  1  3  6  2 ]
 [ 7  8  1  5  6  2 ]
 [ 7  8  3  5  6  2 ]
 [ 7  1  3  5  6  2 ]
 [ 8  1  3  5  6  2 ]
//Include header file
#include <iostream>
using namespace std;

/*
  C++ program 
  Print all subsequences of given size
*/

class Subsequence
{
	public:
		//Print all subsequences in a given size k
		void print_subsequences(int collection[], int output[], int n, int k, int next, int location)
		{
			if (location == k)
			{
				// When get new subsequence of k size
				cout << " [";
				for (int i = 0; i < k; ++i)
				{
					cout << " " << collection[output[i]] << " ";
				}
				cout << "]\n";
				return;
			}
			else
			{
				for (int i = next; i < n; ++i)
				{
					// Get location of subset collection 
					output[location] = i;
					this->print_subsequences(collection, output, n, k, i + 1, location + 1);
				}
			}
		}
	// Handles the request to print subsequence element
	void subsequences(int collection[], int n, int size)
	{
		if (n <= 0 || size <= 0 && size >= n)
		{
			//if not a valid inputs
			return;
		}
		//Used to display result
		int output[size];
		cout << "\n Subsequences of size " << size << " \n";
		this->print_subsequences(collection, output, n, size, 0, 0);
	}
};
int main()
{
	Subsequence obj = Subsequence();
	//Define the element of integers
	int arr[] = {
		4 , 7 , 8 , 1 , 3 , 5 , 6 , 2
	};
	int size = 4;
	//Get the size 
	int n = sizeof(arr) / sizeof(arr[0]);
	//Test Case 1
	obj.subsequences(arr, n, size);
	size = 6;
	//Test Case 2
	obj.subsequences(arr, n, size);
	return 0;
}

Output

 Subsequences of size 4
 [ 4  7  8  1 ]
 [ 4  7  8  3 ]
 [ 4  7  8  5 ]
 [ 4  7  8  6 ]
 [ 4  7  8  2 ]
 [ 4  7  1  3 ]
 [ 4  7  1  5 ]
 [ 4  7  1  6 ]
 [ 4  7  1  2 ]
 [ 4  7  3  5 ]
 [ 4  7  3  6 ]
 [ 4  7  3  2 ]
 [ 4  7  5  6 ]
 [ 4  7  5  2 ]
 [ 4  7  6  2 ]
 [ 4  8  1  3 ]
 [ 4  8  1  5 ]
 [ 4  8  1  6 ]
 [ 4  8  1  2 ]
 [ 4  8  3  5 ]
 [ 4  8  3  6 ]
 [ 4  8  3  2 ]
 [ 4  8  5  6 ]
 [ 4  8  5  2 ]
 [ 4  8  6  2 ]
 [ 4  1  3  5 ]
 [ 4  1  3  6 ]
 [ 4  1  3  2 ]
 [ 4  1  5  6 ]
 [ 4  1  5  2 ]
 [ 4  1  6  2 ]
 [ 4  3  5  6 ]
 [ 4  3  5  2 ]
 [ 4  3  6  2 ]
 [ 4  5  6  2 ]
 [ 7  8  1  3 ]
 [ 7  8  1  5 ]
 [ 7  8  1  6 ]
 [ 7  8  1  2 ]
 [ 7  8  3  5 ]
 [ 7  8  3  6 ]
 [ 7  8  3  2 ]
 [ 7  8  5  6 ]
 [ 7  8  5  2 ]
 [ 7  8  6  2 ]
 [ 7  1  3  5 ]
 [ 7  1  3  6 ]
 [ 7  1  3  2 ]
 [ 7  1  5  6 ]
 [ 7  1  5  2 ]
 [ 7  1  6  2 ]
 [ 7  3  5  6 ]
 [ 7  3  5  2 ]
 [ 7  3  6  2 ]
 [ 7  5  6  2 ]
 [ 8  1  3  5 ]
 [ 8  1  3  6 ]
 [ 8  1  3  2 ]
 [ 8  1  5  6 ]
 [ 8  1  5  2 ]
 [ 8  1  6  2 ]
 [ 8  3  5  6 ]
 [ 8  3  5  2 ]
 [ 8  3  6  2 ]
 [ 8  5  6  2 ]
 [ 1  3  5  6 ]
 [ 1  3  5  2 ]
 [ 1  3  6  2 ]
 [ 1  5  6  2 ]
 [ 3  5  6  2 ]

 Subsequences of size 6
 [ 4  7  8  1  3  5 ]
 [ 4  7  8  1  3  6 ]
 [ 4  7  8  1  3  2 ]
 [ 4  7  8  1  5  6 ]
 [ 4  7  8  1  5  2 ]
 [ 4  7  8  1  6  2 ]
 [ 4  7  8  3  5  6 ]
 [ 4  7  8  3  5  2 ]
 [ 4  7  8  3  6  2 ]
 [ 4  7  8  5  6  2 ]
 [ 4  7  1  3  5  6 ]
 [ 4  7  1  3  5  2 ]
 [ 4  7  1  3  6  2 ]
 [ 4  7  1  5  6  2 ]
 [ 4  7  3  5  6  2 ]
 [ 4  8  1  3  5  6 ]
 [ 4  8  1  3  5  2 ]
 [ 4  8  1  3  6  2 ]
 [ 4  8  1  5  6  2 ]
 [ 4  8  3  5  6  2 ]
 [ 4  1  3  5  6  2 ]
 [ 7  8  1  3  5  6 ]
 [ 7  8  1  3  5  2 ]
 [ 7  8  1  3  6  2 ]
 [ 7  8  1  5  6  2 ]
 [ 7  8  3  5  6  2 ]
 [ 7  1  3  5  6  2 ]
 [ 8  1  3  5  6  2 ]
<?php
/* 
  Php program 
  Print all subsequences of given size
*/
class Subsequence
{
	//Print all subsequences in a given size k
	public	function print_subsequences( & $collection, & $output, $n, $k, $next, $location)
	{
		if ($location == $k)
		{
			// When get new subsequence of k size
			echo " [";
			for ($i = 0; $i < $k; ++$i)
			{
				echo " ". $collection[$output[$i]] ." ";
			}
			echo "]\n";
			return;
		}
		else
		{
			for ($i = $next; $i < $n; ++$i)
			{
				// Get location of subset collection 
				$output[$location] = $i;
				$this->print_subsequences($collection, $output, $n, $k, $i + 1, $location + 1);
			}
		}
	}
	// Handles the request to print subsequence element
	public	function subsequences( & $collection, $n, $size)
	{
		if ($n <= 0 || $size <= 0 && $size >= $n)
		{
			//if not a valid inputs
			return;
		}
		//Used to display result
		$output = array_fill(0, $size, 0);
		echo "\n Subsequences of size ". $size ." \n";
		$this->print_subsequences($collection, $output, $n, $size, 0, 0);
	}
}

function main()
{
	$obj = new Subsequence();
	//Define the element of integers
	$arr = array(4, 7, 8, 1, 3, 5, 6, 2);
	$size = 4;
	//Get the size 
	$n = count($arr);
	//Test Case 1
	$obj->subsequences($arr, $n, $size);
	$size = 6;
	//Test Case 2
	$obj->subsequences($arr, $n, $size);
}
main();

Output

 Subsequences of size 4
 [ 4  7  8  1 ]
 [ 4  7  8  3 ]
 [ 4  7  8  5 ]
 [ 4  7  8  6 ]
 [ 4  7  8  2 ]
 [ 4  7  1  3 ]
 [ 4  7  1  5 ]
 [ 4  7  1  6 ]
 [ 4  7  1  2 ]
 [ 4  7  3  5 ]
 [ 4  7  3  6 ]
 [ 4  7  3  2 ]
 [ 4  7  5  6 ]
 [ 4  7  5  2 ]
 [ 4  7  6  2 ]
 [ 4  8  1  3 ]
 [ 4  8  1  5 ]
 [ 4  8  1  6 ]
 [ 4  8  1  2 ]
 [ 4  8  3  5 ]
 [ 4  8  3  6 ]
 [ 4  8  3  2 ]
 [ 4  8  5  6 ]
 [ 4  8  5  2 ]
 [ 4  8  6  2 ]
 [ 4  1  3  5 ]
 [ 4  1  3  6 ]
 [ 4  1  3  2 ]
 [ 4  1  5  6 ]
 [ 4  1  5  2 ]
 [ 4  1  6  2 ]
 [ 4  3  5  6 ]
 [ 4  3  5  2 ]
 [ 4  3  6  2 ]
 [ 4  5  6  2 ]
 [ 7  8  1  3 ]
 [ 7  8  1  5 ]
 [ 7  8  1  6 ]
 [ 7  8  1  2 ]
 [ 7  8  3  5 ]
 [ 7  8  3  6 ]
 [ 7  8  3  2 ]
 [ 7  8  5  6 ]
 [ 7  8  5  2 ]
 [ 7  8  6  2 ]
 [ 7  1  3  5 ]
 [ 7  1  3  6 ]
 [ 7  1  3  2 ]
 [ 7  1  5  6 ]
 [ 7  1  5  2 ]
 [ 7  1  6  2 ]
 [ 7  3  5  6 ]
 [ 7  3  5  2 ]
 [ 7  3  6  2 ]
 [ 7  5  6  2 ]
 [ 8  1  3  5 ]
 [ 8  1  3  6 ]
 [ 8  1  3  2 ]
 [ 8  1  5  6 ]
 [ 8  1  5  2 ]
 [ 8  1  6  2 ]
 [ 8  3  5  6 ]
 [ 8  3  5  2 ]
 [ 8  3  6  2 ]
 [ 8  5  6  2 ]
 [ 1  3  5  6 ]
 [ 1  3  5  2 ]
 [ 1  3  6  2 ]
 [ 1  5  6  2 ]
 [ 3  5  6  2 ]

 Subsequences of size 6
 [ 4  7  8  1  3  5 ]
 [ 4  7  8  1  3  6 ]
 [ 4  7  8  1  3  2 ]
 [ 4  7  8  1  5  6 ]
 [ 4  7  8  1  5  2 ]
 [ 4  7  8  1  6  2 ]
 [ 4  7  8  3  5  6 ]
 [ 4  7  8  3  5  2 ]
 [ 4  7  8  3  6  2 ]
 [ 4  7  8  5  6  2 ]
 [ 4  7  1  3  5  6 ]
 [ 4  7  1  3  5  2 ]
 [ 4  7  1  3  6  2 ]
 [ 4  7  1  5  6  2 ]
 [ 4  7  3  5  6  2 ]
 [ 4  8  1  3  5  6 ]
 [ 4  8  1  3  5  2 ]
 [ 4  8  1  3  6  2 ]
 [ 4  8  1  5  6  2 ]
 [ 4  8  3  5  6  2 ]
 [ 4  1  3  5  6  2 ]
 [ 7  8  1  3  5  6 ]
 [ 7  8  1  3  5  2 ]
 [ 7  8  1  3  6  2 ]
 [ 7  8  1  5  6  2 ]
 [ 7  8  3  5  6  2 ]
 [ 7  1  3  5  6  2 ]
 [ 8  1  3  5  6  2 ]
/* 
  Node Js program 
  Print all subsequences of given size
*/
class Subsequence
{
	//Print all subsequences in a given size k
	print_subsequences(collection, output, n, k, next, location)
	{
		if (location == k)
		{
			// When get new subsequence of k size
			process.stdout.write(" [");
			for (var i = 0; i < k; ++i)
			{
				process.stdout.write(" " + collection[output[i]] + " ");
			}
			process.stdout.write("]\n");
			return;
		}
		else
		{
			for (var i = next; i < n; ++i)
			{
				// Get location of subset collection 
				output[location] = i;
				this.print_subsequences(collection, output, n, k, i + 1, location + 1);
			}
		}
	}
	// Handles the request to print subsequence element
	subsequences(collection, n, size)
	{
		if (n <= 0 || size <= 0 && size >= n)
		{
			//if not a valid inputs
			return;
		}
		//Used to display result
		var output = Array(size).fill(0);
		process.stdout.write("\n Subsequences of size " + size + " \n");
		this.print_subsequences(collection, output, n, size, 0, 0);
	}
}

function main()
{
	var obj = new Subsequence();
	//Define the element of integers
	var arr = [4, 7, 8, 1, 3, 5, 6, 2];
	var size = 4;
	//Get the size 
	var n = arr.length;
	//Test Case 1
	obj.subsequences(arr, n, size);
	size = 6;
	//Test Case 2
	obj.subsequences(arr, n, size);
}
main();

Output

 Subsequences of size 4
 [ 4  7  8  1 ]
 [ 4  7  8  3 ]
 [ 4  7  8  5 ]
 [ 4  7  8  6 ]
 [ 4  7  8  2 ]
 [ 4  7  1  3 ]
 [ 4  7  1  5 ]
 [ 4  7  1  6 ]
 [ 4  7  1  2 ]
 [ 4  7  3  5 ]
 [ 4  7  3  6 ]
 [ 4  7  3  2 ]
 [ 4  7  5  6 ]
 [ 4  7  5  2 ]
 [ 4  7  6  2 ]
 [ 4  8  1  3 ]
 [ 4  8  1  5 ]
 [ 4  8  1  6 ]
 [ 4  8  1  2 ]
 [ 4  8  3  5 ]
 [ 4  8  3  6 ]
 [ 4  8  3  2 ]
 [ 4  8  5  6 ]
 [ 4  8  5  2 ]
 [ 4  8  6  2 ]
 [ 4  1  3  5 ]
 [ 4  1  3  6 ]
 [ 4  1  3  2 ]
 [ 4  1  5  6 ]
 [ 4  1  5  2 ]
 [ 4  1  6  2 ]
 [ 4  3  5  6 ]
 [ 4  3  5  2 ]
 [ 4  3  6  2 ]
 [ 4  5  6  2 ]
 [ 7  8  1  3 ]
 [ 7  8  1  5 ]
 [ 7  8  1  6 ]
 [ 7  8  1  2 ]
 [ 7  8  3  5 ]
 [ 7  8  3  6 ]
 [ 7  8  3  2 ]
 [ 7  8  5  6 ]
 [ 7  8  5  2 ]
 [ 7  8  6  2 ]
 [ 7  1  3  5 ]
 [ 7  1  3  6 ]
 [ 7  1  3  2 ]
 [ 7  1  5  6 ]
 [ 7  1  5  2 ]
 [ 7  1  6  2 ]
 [ 7  3  5  6 ]
 [ 7  3  5  2 ]
 [ 7  3  6  2 ]
 [ 7  5  6  2 ]
 [ 8  1  3  5 ]
 [ 8  1  3  6 ]
 [ 8  1  3  2 ]
 [ 8  1  5  6 ]
 [ 8  1  5  2 ]
 [ 8  1  6  2 ]
 [ 8  3  5  6 ]
 [ 8  3  5  2 ]
 [ 8  3  6  2 ]
 [ 8  5  6  2 ]
 [ 1  3  5  6 ]
 [ 1  3  5  2 ]
 [ 1  3  6  2 ]
 [ 1  5  6  2 ]
 [ 3  5  6  2 ]

 Subsequences of size 6
 [ 4  7  8  1  3  5 ]
 [ 4  7  8  1  3  6 ]
 [ 4  7  8  1  3  2 ]
 [ 4  7  8  1  5  6 ]
 [ 4  7  8  1  5  2 ]
 [ 4  7  8  1  6  2 ]
 [ 4  7  8  3  5  6 ]
 [ 4  7  8  3  5  2 ]
 [ 4  7  8  3  6  2 ]
 [ 4  7  8  5  6  2 ]
 [ 4  7  1  3  5  6 ]
 [ 4  7  1  3  5  2 ]
 [ 4  7  1  3  6  2 ]
 [ 4  7  1  5  6  2 ]
 [ 4  7  3  5  6  2 ]
 [ 4  8  1  3  5  6 ]
 [ 4  8  1  3  5  2 ]
 [ 4  8  1  3  6  2 ]
 [ 4  8  1  5  6  2 ]
 [ 4  8  3  5  6  2 ]
 [ 4  1  3  5  6  2 ]
 [ 7  8  1  3  5  6 ]
 [ 7  8  1  3  5  2 ]
 [ 7  8  1  3  6  2 ]
 [ 7  8  1  5  6  2 ]
 [ 7  8  3  5  6  2 ]
 [ 7  1  3  5  6  2 ]
 [ 8  1  3  5  6  2 ]
#   Python 3 program 
#   Print all subsequences of given size

class Subsequence :
	# Print all subsequences in a given size k
	def print_subsequences(self, collection, output, n, k, next, location) :
		i = 0
		if (location == k) :
			#  When get new subsequence of k size
			print(" [", end = "")
			while (i < k) :
				print(" ", collection[output[i]] ," ", end = "")
				i += 1
			
			print("]\n", end = "")
			return
		else :
			i = next
			while (i < n) :
				#  Get location of subset collection 
				output[location] = i
				self.print_subsequences(collection, output, n, k, i + 1, location + 1)
				i += 1
			
		
	
	#  Handles the request to print subsequence element
	def subsequences(self, collection, n, size) :
		if (n <= 0 or size <= 0 and size >= n) :
			# if not a valid inputs
			return
		
		# Used to display result
		output = [0] * (size)
		print("\n Subsequences of size ", size ," \n", end = "")
		self.print_subsequences(collection, output, n, size, 0, 0)
	

def main() :
	obj = Subsequence()
	# Define the element of integers
	arr = [4, 7, 8, 1, 3, 5, 6, 2]
	size = 4
	# Get the size 
	n = len(arr)
	# Test Case 1
	obj.subsequences(arr, n, size)
	size = 6
	# Test Case 2
	obj.subsequences(arr, n, size)

if __name__ == "__main__": main()

Output

 Subsequences of size  4
 [  4    7    8    1  ]
 [  4    7    8    3  ]
 [  4    7    8    5  ]
 [  4    7    8    6  ]
 [  4    7    8    2  ]
 [  4    7    1    3  ]
 [  4    7    1    5  ]
 [  4    7    1    6  ]
 [  4    7    1    2  ]
 [  4    7    3    5  ]
 [  4    7    3    6  ]
 [  4    7    3    2  ]
 [  4    7    5    6  ]
 [  4    7    5    2  ]
 [  4    7    6    2  ]
 [  4    8    1    3  ]
 [  4    8    1    5  ]
 [  4    8    1    6  ]
 [  4    8    1    2  ]
 [  4    8    3    5  ]
 [  4    8    3    6  ]
 [  4    8    3    2  ]
 [  4    8    5    6  ]
 [  4    8    5    2  ]
 [  4    8    6    2  ]
 [  4    1    3    5  ]
 [  4    1    3    6  ]
 [  4    1    3    2  ]
 [  4    1    5    6  ]
 [  4    1    5    2  ]
 [  4    1    6    2  ]
 [  4    3    5    6  ]
 [  4    3    5    2  ]
 [  4    3    6    2  ]
 [  4    5    6    2  ]
 [  7    8    1    3  ]
 [  7    8    1    5  ]
 [  7    8    1    6  ]
 [  7    8    1    2  ]
 [  7    8    3    5  ]
 [  7    8    3    6  ]
 [  7    8    3    2  ]
 [  7    8    5    6  ]
 [  7    8    5    2  ]
 [  7    8    6    2  ]
 [  7    1    3    5  ]
 [  7    1    3    6  ]
 [  7    1    3    2  ]
 [  7    1    5    6  ]
 [  7    1    5    2  ]
 [  7    1    6    2  ]
 [  7    3    5    6  ]
 [  7    3    5    2  ]
 [  7    3    6    2  ]
 [  7    5    6    2  ]
 [  8    1    3    5  ]
 [  8    1    3    6  ]
 [  8    1    3    2  ]
 [  8    1    5    6  ]
 [  8    1    5    2  ]
 [  8    1    6    2  ]
 [  8    3    5    6  ]
 [  8    3    5    2  ]
 [  8    3    6    2  ]
 [  8    5    6    2  ]
 [  1    3    5    6  ]
 [  1    3    5    2  ]
 [  1    3    6    2  ]
 [  1    5    6    2  ]
 [  3    5    6    2  ]

 Subsequences of size  6
 [  4    7    8    1    3    5  ]
 [  4    7    8    1    3    6  ]
 [  4    7    8    1    3    2  ]
 [  4    7    8    1    5    6  ]
 [  4    7    8    1    5    2  ]
 [  4    7    8    1    6    2  ]
 [  4    7    8    3    5    6  ]
 [  4    7    8    3    5    2  ]
 [  4    7    8    3    6    2  ]
 [  4    7    8    5    6    2  ]
 [  4    7    1    3    5    6  ]
 [  4    7    1    3    5    2  ]
 [  4    7    1    3    6    2  ]
 [  4    7    1    5    6    2  ]
 [  4    7    3    5    6    2  ]
 [  4    8    1    3    5    6  ]
 [  4    8    1    3    5    2  ]
 [  4    8    1    3    6    2  ]
 [  4    8    1    5    6    2  ]
 [  4    8    3    5    6    2  ]
 [  4    1    3    5    6    2  ]
 [  7    8    1    3    5    6  ]
 [  7    8    1    3    5    2  ]
 [  7    8    1    3    6    2  ]
 [  7    8    1    5    6    2  ]
 [  7    8    3    5    6    2  ]
 [  7    1    3    5    6    2  ]
 [  8    1    3    5    6    2  ]
#   Ruby program 
#   Print all subsequences of given size

class Subsequence 
	# Print all subsequences in a given size k
	def print_subsequences(collection, output, n, k, next_element, location) 
		i = 0
		if (location == k) 
			#  When get new subsequence of k size
			print(" [")
			while (i < k) 
				print(" ", collection[output[i]] ," ")
				i += 1
			end

			print("]\n")
			return
		else 
			i = next_element
			while (i < n) 
				#  Get location of subset collection 
				output[location] = i
				self.print_subsequences(collection, output, n, k, i + 1, location + 1)
				i += 1
			end

		end

	end

	#  Handles the request to print subsequence element
	def subsequences(collection, n, size) 
		if (n <= 0 || size <= 0 && size >= n) 
			# if not a valid inputs
			return
		end

		# Used to display result
		output = Array.new(size) {0}
		print("\n Subsequences of size ", size ," \n")
		self.print_subsequences(collection, output, n, size, 0, 0)
	end

end

def main() 
	obj = Subsequence.new()
	# Define the element of integers
	arr = [4, 7, 8, 1, 3, 5, 6, 2]
	size = 4
	# Get the size 
	n = arr.length
	# Test Case 1
	obj.subsequences(arr, n, size)
	size = 6
	# Test Case 2
	obj.subsequences(arr, n, size)
end

main()

Output

 Subsequences of size 4 
 [ 4  7  8  1 ]
 [ 4  7  8  3 ]
 [ 4  7  8  5 ]
 [ 4  7  8  6 ]
 [ 4  7  8  2 ]
 [ 4  7  1  3 ]
 [ 4  7  1  5 ]
 [ 4  7  1  6 ]
 [ 4  7  1  2 ]
 [ 4  7  3  5 ]
 [ 4  7  3  6 ]
 [ 4  7  3  2 ]
 [ 4  7  5  6 ]
 [ 4  7  5  2 ]
 [ 4  7  6  2 ]
 [ 4  8  1  3 ]
 [ 4  8  1  5 ]
 [ 4  8  1  6 ]
 [ 4  8  1  2 ]
 [ 4  8  3  5 ]
 [ 4  8  3  6 ]
 [ 4  8  3  2 ]
 [ 4  8  5  6 ]
 [ 4  8  5  2 ]
 [ 4  8  6  2 ]
 [ 4  1  3  5 ]
 [ 4  1  3  6 ]
 [ 4  1  3  2 ]
 [ 4  1  5  6 ]
 [ 4  1  5  2 ]
 [ 4  1  6  2 ]
 [ 4  3  5  6 ]
 [ 4  3  5  2 ]
 [ 4  3  6  2 ]
 [ 4  5  6  2 ]
 [ 7  8  1  3 ]
 [ 7  8  1  5 ]
 [ 7  8  1  6 ]
 [ 7  8  1  2 ]
 [ 7  8  3  5 ]
 [ 7  8  3  6 ]
 [ 7  8  3  2 ]
 [ 7  8  5  6 ]
 [ 7  8  5  2 ]
 [ 7  8  6  2 ]
 [ 7  1  3  5 ]
 [ 7  1  3  6 ]
 [ 7  1  3  2 ]
 [ 7  1  5  6 ]
 [ 7  1  5  2 ]
 [ 7  1  6  2 ]
 [ 7  3  5  6 ]
 [ 7  3  5  2 ]
 [ 7  3  6  2 ]
 [ 7  5  6  2 ]
 [ 8  1  3  5 ]
 [ 8  1  3  6 ]
 [ 8  1  3  2 ]
 [ 8  1  5  6 ]
 [ 8  1  5  2 ]
 [ 8  1  6  2 ]
 [ 8  3  5  6 ]
 [ 8  3  5  2 ]
 [ 8  3  6  2 ]
 [ 8  5  6  2 ]
 [ 1  3  5  6 ]
 [ 1  3  5  2 ]
 [ 1  3  6  2 ]
 [ 1  5  6  2 ]
 [ 3  5  6  2 ]

 Subsequences of size 6 
 [ 4  7  8  1  3  5 ]
 [ 4  7  8  1  3  6 ]
 [ 4  7  8  1  3  2 ]
 [ 4  7  8  1  5  6 ]
 [ 4  7  8  1  5  2 ]
 [ 4  7  8  1  6  2 ]
 [ 4  7  8  3  5  6 ]
 [ 4  7  8  3  5  2 ]
 [ 4  7  8  3  6  2 ]
 [ 4  7  8  5  6  2 ]
 [ 4  7  1  3  5  6 ]
 [ 4  7  1  3  5  2 ]
 [ 4  7  1  3  6  2 ]
 [ 4  7  1  5  6  2 ]
 [ 4  7  3  5  6  2 ]
 [ 4  8  1  3  5  6 ]
 [ 4  8  1  3  5  2 ]
 [ 4  8  1  3  6  2 ]
 [ 4  8  1  5  6  2 ]
 [ 4  8  3  5  6  2 ]
 [ 4  1  3  5  6  2 ]
 [ 7  8  1  3  5  6 ]
 [ 7  8  1  3  5  2 ]
 [ 7  8  1  3  6  2 ]
 [ 7  8  1  5  6  2 ]
 [ 7  8  3  5  6  2 ]
 [ 7  1  3  5  6  2 ]
 [ 8  1  3  5  6  2 ]
/* 
  Scala program 
  Print all subsequences of given size
*/
class Subsequence
{
	//Print all subsequences in a given size k
	def print_subsequences(collection: Array[Int], output: Array[Int], n: Int, k: Int, next: Int, location: Int): Unit = {
		var i: Int = 0;
		if (location == k)
		{
			// When get new subsequence of k size
			print(" [");
			while (i < k)
			{
				print(" " + collection(output(i)) + " ");
				i += 1;
			}
			print("]\n");
			return;
		}
		else
		{
			i = next;
			while (i < n)
			{
				// Get location of subset collection 
				output(location) = i;
				print_subsequences(collection, output, n, k, i + 1, location + 1);
				i += 1;
			}
		}
	}
	// Handles the request to print subsequence element
	def subsequences(collection: Array[Int], n: Int, size: Int): Unit = {
		if (n <= 0 || size <= 0 && size >= n)
		{
			//if not a valid inputs
			return;
		}
		//Used to display result
		var output: Array[Int] = Array.fill[Int](size)(0);
		print("\n Subsequences of size " + size + " \n");
		print_subsequences(collection, output, n, size, 0, 0);
	}
}
object Main
{
	def main(args: Array[String]): Unit = {
		var obj: Subsequence = new Subsequence();
		//Define the element of integers
		var arr: Array[Int] = Array(4, 7, 8, 1, 3, 5, 6, 2);
		var size: Int = 4;
		//Get the size 
		var n: Int = arr.length;
		//Test Case 1
		obj.subsequences(arr, n, size);
		size = 6;
		//Test Case 2
		obj.subsequences(arr, n, size);
	}
}

Output

 Subsequences of size 4
 [ 4  7  8  1 ]
 [ 4  7  8  3 ]
 [ 4  7  8  5 ]
 [ 4  7  8  6 ]
 [ 4  7  8  2 ]
 [ 4  7  1  3 ]
 [ 4  7  1  5 ]
 [ 4  7  1  6 ]
 [ 4  7  1  2 ]
 [ 4  7  3  5 ]
 [ 4  7  3  6 ]
 [ 4  7  3  2 ]
 [ 4  7  5  6 ]
 [ 4  7  5  2 ]
 [ 4  7  6  2 ]
 [ 4  8  1  3 ]
 [ 4  8  1  5 ]
 [ 4  8  1  6 ]
 [ 4  8  1  2 ]
 [ 4  8  3  5 ]
 [ 4  8  3  6 ]
 [ 4  8  3  2 ]
 [ 4  8  5  6 ]
 [ 4  8  5  2 ]
 [ 4  8  6  2 ]
 [ 4  1  3  5 ]
 [ 4  1  3  6 ]
 [ 4  1  3  2 ]
 [ 4  1  5  6 ]
 [ 4  1  5  2 ]
 [ 4  1  6  2 ]
 [ 4  3  5  6 ]
 [ 4  3  5  2 ]
 [ 4  3  6  2 ]
 [ 4  5  6  2 ]
 [ 7  8  1  3 ]
 [ 7  8  1  5 ]
 [ 7  8  1  6 ]
 [ 7  8  1  2 ]
 [ 7  8  3  5 ]
 [ 7  8  3  6 ]
 [ 7  8  3  2 ]
 [ 7  8  5  6 ]
 [ 7  8  5  2 ]
 [ 7  8  6  2 ]
 [ 7  1  3  5 ]
 [ 7  1  3  6 ]
 [ 7  1  3  2 ]
 [ 7  1  5  6 ]
 [ 7  1  5  2 ]
 [ 7  1  6  2 ]
 [ 7  3  5  6 ]
 [ 7  3  5  2 ]
 [ 7  3  6  2 ]
 [ 7  5  6  2 ]
 [ 8  1  3  5 ]
 [ 8  1  3  6 ]
 [ 8  1  3  2 ]
 [ 8  1  5  6 ]
 [ 8  1  5  2 ]
 [ 8  1  6  2 ]
 [ 8  3  5  6 ]
 [ 8  3  5  2 ]
 [ 8  3  6  2 ]
 [ 8  5  6  2 ]
 [ 1  3  5  6 ]
 [ 1  3  5  2 ]
 [ 1  3  6  2 ]
 [ 1  5  6  2 ]
 [ 3  5  6  2 ]

 Subsequences of size 6
 [ 4  7  8  1  3  5 ]
 [ 4  7  8  1  3  6 ]
 [ 4  7  8  1  3  2 ]
 [ 4  7  8  1  5  6 ]
 [ 4  7  8  1  5  2 ]
 [ 4  7  8  1  6  2 ]
 [ 4  7  8  3  5  6 ]
 [ 4  7  8  3  5  2 ]
 [ 4  7  8  3  6  2 ]
 [ 4  7  8  5  6  2 ]
 [ 4  7  1  3  5  6 ]
 [ 4  7  1  3  5  2 ]
 [ 4  7  1  3  6  2 ]
 [ 4  7  1  5  6  2 ]
 [ 4  7  3  5  6  2 ]
 [ 4  8  1  3  5  6 ]
 [ 4  8  1  3  5  2 ]
 [ 4  8  1  3  6  2 ]
 [ 4  8  1  5  6  2 ]
 [ 4  8  3  5  6  2 ]
 [ 4  1  3  5  6  2 ]
 [ 7  8  1  3  5  6 ]
 [ 7  8  1  3  5  2 ]
 [ 7  8  1  3  6  2 ]
 [ 7  8  1  5  6  2 ]
 [ 7  8  3  5  6  2 ]
 [ 7  1  3  5  6  2 ]
 [ 8  1  3  5  6  2 ]
/* 
  Swift 4 program 
  Print all subsequences of given size
*/
class Subsequence
{
	//Print all subsequences in a given size k
	func print_subsequences(_ collection: [Int], _ output: inout[Int], _ n: Int, _ k: Int, _ next: Int, _ location: Int)
	{
		var i: Int = 0;
		if (location == k)
		{
			// When get new subsequence of k size
			print(" [", terminator: "");
			while (i < k)
			{
				print(" ", collection[output[i]]," ", terminator: "");
				i += 1;
			}
			print("]\n", terminator: "");
			return;
		}
		else
		{
			i = next;
			while (i < n)
			{
				// Get location of subset collection 
				output[location] = i;
				self.print_subsequences(collection, &output, n, k, i + 1, location + 1);
				i += 1;
			}
		}
	}
	// Handles the request to print subsequence element
	func subsequences(_ collection: [Int], _ n: Int, _ size: Int)
	{
		if (n <= 0 || size <= 0 && size >= n)
		{
			//if not a valid inputs
			return;
		}
		//Used to display result
		var output: [Int] = Array(repeating: 0, count: size);
		print("\n Subsequences of size ", size ," \n", terminator: "");
		self.print_subsequences(collection, &output, n, size, 0, 0);
	}
}
func main()
{
	let obj: Subsequence = Subsequence();
	//Define the element of integers
	let arr: [Int] = [4, 7, 8, 1, 3, 5, 6, 2];
	var size: Int = 4;
	//Get the size 
	let n: Int = arr.count;
	//Test Case 1
	obj.subsequences(arr, n, size);
	size = 6;
	//Test Case 2
	obj.subsequences(arr, n, size);
}
main();

Output

 Subsequences of size  4
 [  4    7    8    1  ]
 [  4    7    8    3  ]
 [  4    7    8    5  ]
 [  4    7    8    6  ]
 [  4    7    8    2  ]
 [  4    7    1    3  ]
 [  4    7    1    5  ]
 [  4    7    1    6  ]
 [  4    7    1    2  ]
 [  4    7    3    5  ]
 [  4    7    3    6  ]
 [  4    7    3    2  ]
 [  4    7    5    6  ]
 [  4    7    5    2  ]
 [  4    7    6    2  ]
 [  4    8    1    3  ]
 [  4    8    1    5  ]
 [  4    8    1    6  ]
 [  4    8    1    2  ]
 [  4    8    3    5  ]
 [  4    8    3    6  ]
 [  4    8    3    2  ]
 [  4    8    5    6  ]
 [  4    8    5    2  ]
 [  4    8    6    2  ]
 [  4    1    3    5  ]
 [  4    1    3    6  ]
 [  4    1    3    2  ]
 [  4    1    5    6  ]
 [  4    1    5    2  ]
 [  4    1    6    2  ]
 [  4    3    5    6  ]
 [  4    3    5    2  ]
 [  4    3    6    2  ]
 [  4    5    6    2  ]
 [  7    8    1    3  ]
 [  7    8    1    5  ]
 [  7    8    1    6  ]
 [  7    8    1    2  ]
 [  7    8    3    5  ]
 [  7    8    3    6  ]
 [  7    8    3    2  ]
 [  7    8    5    6  ]
 [  7    8    5    2  ]
 [  7    8    6    2  ]
 [  7    1    3    5  ]
 [  7    1    3    6  ]
 [  7    1    3    2  ]
 [  7    1    5    6  ]
 [  7    1    5    2  ]
 [  7    1    6    2  ]
 [  7    3    5    6  ]
 [  7    3    5    2  ]
 [  7    3    6    2  ]
 [  7    5    6    2  ]
 [  8    1    3    5  ]
 [  8    1    3    6  ]
 [  8    1    3    2  ]
 [  8    1    5    6  ]
 [  8    1    5    2  ]
 [  8    1    6    2  ]
 [  8    3    5    6  ]
 [  8    3    5    2  ]
 [  8    3    6    2  ]
 [  8    5    6    2  ]
 [  1    3    5    6  ]
 [  1    3    5    2  ]
 [  1    3    6    2  ]
 [  1    5    6    2  ]
 [  3    5    6    2  ]

 Subsequences of size  6
 [  4    7    8    1    3    5  ]
 [  4    7    8    1    3    6  ]
 [  4    7    8    1    3    2  ]
 [  4    7    8    1    5    6  ]
 [  4    7    8    1    5    2  ]
 [  4    7    8    1    6    2  ]
 [  4    7    8    3    5    6  ]
 [  4    7    8    3    5    2  ]
 [  4    7    8    3    6    2  ]
 [  4    7    8    5    6    2  ]
 [  4    7    1    3    5    6  ]
 [  4    7    1    3    5    2  ]
 [  4    7    1    3    6    2  ]
 [  4    7    1    5    6    2  ]
 [  4    7    3    5    6    2  ]
 [  4    8    1    3    5    6  ]
 [  4    8    1    3    5    2  ]
 [  4    8    1    3    6    2  ]
 [  4    8    1    5    6    2  ]
 [  4    8    3    5    6    2  ]
 [  4    1    3    5    6    2  ]
 [  7    8    1    3    5    6  ]
 [  7    8    1    3    5    2  ]
 [  7    8    1    3    6    2  ]
 [  7    8    1    5    6    2  ]
 [  7    8    3    5    6    2  ]
 [  7    1    3    5    6    2  ]
 [  8    1    3    5    6    2  ]


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment







© 2021, kalkicode.com, All rights reserved