currNum as 1 (root of the denary tree).k by 1 since we start from the root node which is the first number.k is greater than 0:
a. Calculate the gap between currNum and currNum + 1 using the getGap function.
b. If the gap is less than or equal to k, increment currNum and decrement k by the gap.
c. If the gap is greater than k, multiply currNum by 10 (move to the first child) and decrement k by 1.currNum as the k-th smallest lexicographical number.