Should the function queens(N) be recursive or iterative, or should we write both versions ? In case of a recursive function, can we add more parameters to function's signature ?
Date: 24 Nov 2012 20:06
Number of posts: 4
RSS: New posts
You should write anything that makes it work in a reasonable amount of time…
You cannot change the queens(N) function signature (Because the instructors use automated tests), however you could make helper functions of your own and call them from within the queens(N) function implementation…
Anyways, I would like to hear that from the course staff, so that, u'know, there's no misunderstanding :)
In general, we do not enforce a certain implementation in this course. This is a decision the programer has to do on his/her own. We do check that the code is efficient, which means that a naive solution that simply generates all possible arrangements and checks them - will not be credited (and will also be very time consuming for large values of N).
Having said that, I strongly recommend to follow the guidelines written in the question, and solve this question in a recursive manner, so as to practice the issue of recursion.
You should never change the the signature of the main function of the question.