So you have decided you need assistance to do the recursive tree traversal? Well, the report you write is much more important than the SQL used, as I am more interested in your experiences and observations in solving this problem. So, if you really cannot get anything to work in a way which could be seen as moving in the right direction, this document is for you!
Obviously using this information will result in a report which is not as good as one which has its own implementation. How this will affect your marks depends on what text you put around my code. However, an impact of 10-15% would seem like an average. You will lessen the impact if you also document a reasonable attempt of your own to solve the problem. If you use my code make this clear in your text by putting a reference to me in every paragraph or diagram which is based on this information. If you fail to do this I will be grumpy...
The following files are what you are looking for:
So, after downloaded these using saveas, log into sqlplus and execute sql.sql, and then execute query.sql. Normally you can do this by typing "@query" or "@sql" at the prompt. I am not sure of the search path taken by sqlplus, so you might have to specify a full path name to make this work.
Every time you execute "query", the attribute "parse" gets closer and closer to the right answer. After executing it a few times, the root of the tree (node 1) will have a parse attribute which is the correct answer.
A similar effect can be seen with the evaluation using "@query2". In this case the iterative calculation is held in the attribute "carry" rather than "parse", but the process is the same. Run query2 a few times to get the full answer.
I have made one or two "long-winded" parts in the queries, which the ultra awake may notice and be able to comment on (or even fix). Bonus marks for this. The queries may look complex, but actually they are the same query written over and over again with minor changes to reflect the operator being used or whether this is a value or operator node. The core SQL statement is actually only 10 lines or so. The views make the queries much simpler, as they provide either the original data or the iteration calculation so far, making the whole thing rather othogonal (it doesnt matter if this is original or calculated data, the queries are the same).
Good luck.