algorithms.tutorialhorizon.com

Generate all the strings of length n from 0 to k-1. | Algorithms

Objective: Given two numbers, n and k (k>=n), write an algorithm to generate all the strings of length n drawn from 0 – k-1. Example: k = 2, n = 2 Output: 0 0, 0 1, 1 0, 1 1 k = 3, n = 2 Output: 0 0, 1 0, 2 0, 0 1, 1 1, 2 1, 0 2, 1 2, 2 2