It's UWAweek 47

help3001

This forum is provided to promote discussion amongst students enrolled in CITS3001 Advanced Algorithms.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 3 articles in this topic
Showing 3 of 202 articles.
Currently 22 other people reading this forum.


 UWA week 36 (2nd semester, mid-semester break) ↓
SVG not supported

Login to reply

👍?
helpful
12:20pm Fri 6th Sep, Mahit G.

I tried this problem using top down approach(recursion), it worked on smaller test cases and failed on bigger, another thing was that it was giving me (answer-1) for bigger test cases, I read the hints and tried the bottom up with Kahn's and it works perfectly, another thing is that this is faster. I prefer using the top down approach as I understand it better, can i get a hint if this problem is solvable using top down and recursion(not reaching pythons limit), the way I was able to look for cycles was also much more convenient using that approach. I wanted put down my code so that I could get a review but I'm happy to email it for suggestions. Thanks


SVG not supported

Login to reply

👍?
helpful
12:42pm Fri 6th Sep, Mahit G.

update, recession seems to work properly in everything but just getting max depth error in the largest cases, is there a way to still do top down through recursion then?


 UWA week 37 (2nd semester, week 7) ↓
SVG not supported

Login to reply

👍?
helpful
2:50pm Mon 9th Sep, Andrew G.

"Mahit Gupta" [email protected] wrote:

update, recession seems to work properly in everything but just getting max depth error in the largest cases, is there a way to still do top down through recursion then?

I would encourage you to make sure you are comfortable with the other techniques. In particular, try implementing it with a stack manually, as all the recursive solution is doing is a trick to use the call stack rather than having to make your own. If you are hitting the recursion limit, it is generally a sign that you shouldn't be recursing that much.

Having said that, if you want to make sure your recursive solution is correct, have a look at sys.setrecursionlimit().

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy