Backtracking implementation in c (without using any data structure)

Viewed 90

after many hours of trying i decided to post my problem here. i want to solve this question with "Backtracking" implementation without any data-structure.

write a recursive function that recieve integer number (>=0) and will print all options that the number can to be broke down, but the numbers can be only odd numbers. and we have a global const variable N and his purpose is to tell us how many odd numbers this number can split up(Max splits).

For example: function that receive number=7 and we have a global variable the we defined up to our code N=6 the function will print: 7=1+1+1+1+3, 7=1+3+3, 7=1+1+5, 7=7

note that: 1+3+3 and 3+1+3 is the same solution and the function will not print that option twice, only once time.

Thanks a lot !

0 Answers
Related