So after almost 5 months
, the fifth programming challenge is finally here.
Thanks to rush2049 because I'm using his suggestion for this programming challenge.
*A little change in the format of these challenges is that each challenge from now on will have three levels of difficulty: Beginner, Intermediate, Advanced. These difficulty levels will be divided up according to the extra conditions the solution program has to satisfy.*
THE CHALLENGE:
The program must take a non-negative integer (0 to infinity) as input and must output a particular pattern of symbols (asterisks in this case) depending on the integer input.
(This is in some way a bit similar to the first programming challenge if you remember doing that.)
The following specifies how different patterns will be output depending on the input.
INPUT:
OUTPUT:
INPUT:
OUTPUT:
INPUT:
OUTPUT:
INPUT:
OUTPUT:
INPUT:
OUTPUT:
and so on... You get the pattern, I assume.
Now the CONDITIONS:
Must work for all integers >= 0.
Output must not be hard-coded, obviously.
Solution must use a recursive algorithm (i.e. not iterative)
Make sure the solution is "significantly faster than" O(n^(1/2*n)) which is about equal to the run-time complexity of the typical solution of this problem.
(Here I'm taking rush2049's word for it because I haven't had time to test this myself since I'm a bit busy right now. I admit, I have only done the simple iterative solution, yet.
)
Obviously, the subsequent difficulty levels must satisfy the conditions of the preceding difficulty levels. You may also wish to add input validation checks and what not to make your solution program more robust.
If you have any questions or suggestions, you may either post them here or PM me. Looking forward to see your codes. If you have any questions regarding the general format of the challenge, refer to The Programming Challenge Master Thread.
Code on... (I need a suggestion for what to say when signing off too.
...preferably something that elicits particular enthusiasm for programming
)
, the fifth programming challenge is finally here.Thanks to rush2049 because I'm using his suggestion for this programming challenge.
*A little change in the format of these challenges is that each challenge from now on will have three levels of difficulty: Beginner, Intermediate, Advanced. These difficulty levels will be divided up according to the extra conditions the solution program has to satisfy.*
THE CHALLENGE:
The program must take a non-negative integer (0 to infinity) as input and must output a particular pattern of symbols (asterisks in this case) depending on the integer input.
(This is in some way a bit similar to the first programming challenge if you remember doing that.)
The following specifies how different patterns will be output depending on the input.
INPUT:
Code:
0
Code:
<NOTHING>
INPUT:
Code:
1
Code:
*
INPUT:
Code:
2
Code:
*
* *
*
INPUT:
Code:
3
Code:
*
* *
*
* * *
*
* *
*
INPUT:
Code:
4
Code:
*
* *
*
* * *
*
* *
*
* * * *
*
* *
*
* * *
*
* *
*
and so on... You get the pattern, I assume.
Now the CONDITIONS:
Beginner:
Must work for all integers >= 0.
Output must not be hard-coded, obviously.
Intermediate:
Solution must use a recursive algorithm (i.e. not iterative)
Advanced:
Make sure the solution is "significantly faster than" O(n^(1/2*n)) which is about equal to the run-time complexity of the typical solution of this problem.
(Here I'm taking rush2049's word for it because I haven't had time to test this myself since I'm a bit busy right now. I admit, I have only done the simple iterative solution, yet.
)Obviously, the subsequent difficulty levels must satisfy the conditions of the preceding difficulty levels. You may also wish to add input validation checks and what not to make your solution program more robust.
If you have any questions or suggestions, you may either post them here or PM me. Looking forward to see your codes. If you have any questions regarding the general format of the challenge, refer to The Programming Challenge Master Thread.
Code on... (I need a suggestion for what to say when signing off too.
...preferably something that elicits particular enthusiasm for programming
)












