Welcome! Log In Create A New Profile


Make a Better Mess than this

Posted by slow_eddy 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
avatar Make a Better Mess than this
September 26, 2010 02:25PM
Here's an idea. Let's do Assignment B, but by way of "eddy's edifying errors" rather than by the unhelpful route of one person putting up one Right answer.

It's far more difficult to discover really subtle and dangerous ways of making a complete hash of it, and if you start to make one of these mistakes during an exam, you'll recognize it right away and save the bacon.

Think of it. There's more or less one single right answer. That's room for one person to contribute. There are tons of wrong answers though. And some would be really interestingly wrong.

Allow me some slack here. This is difficult. I'm going to start by offering an improvable bodge of Question 1. See me and raise me some is the game.

OK so here goes for 1(a)... Preorderr ... Easy!
Step1. "Visit" your node...
Let's see, that's A. "Hello A".
Step2. ER "Traverse" .. that means to "pass over," right? The left Subtree.

Left Subtree. .. left Subtree... OK so the book tells me that's B. So I pass over B.

Step3. "Traverse" (again) the "Right Subtree" So that's G. Hop over it and ... we're done, right? So that's {} Preorder gives you the Empty List. Easy.
avatar Re: Make a Better Mess than this
September 26, 2010 02:36PM
Sample Response:
Pathetic "Error", Eddy!!
What we want is bloomin subtle pitfalls, not sheer bumbling ...

Right so let's get the "Visit" part right for starters and try to mess up the "Traverse" bit only? Keep things simple.

My truncated reading of the def. for "Visit" is "ACT". One could also call it something like "DO". Or if one is verbose: "do_stuff_with_or_to_this_Object".

So step 1 is a proper visit. "ToDo" here is "print the name of the Node".
very nice. So on to step 2
Traverse the left subtree. OK so that would actually be like a complete traversal of some terrain, right? Like climbing all the branches of some tree? So we'd have
B,C,D. That's the left traversed.

OK but we still haven't traversed the right inside the traverse. So F then. In preorder.
So write down F

F .. we have AF so far.

Step2. Nothing there on the left. Step 3 Nothing there on the right.

... So now I suppose we go back up to the calling node ... which was? A, right?

and then finish off what was happening there. "Visit"? Done. "LeftTrav?" Done. So we do a Traverse of the Right hand subtree.

So the Whole Subtree.

GLM and we're at the top or bottom. OK so preorder means the Visit-is-Pre. Write the value

M .... Giving us AFM so far.

Then "Left" ... nothing.
"Right" ... nothing.
... and then Back.

Which takes us back to A, and whee hah! We're done.

No it's not a very good error....
Did I ever claim that this was Easy??
avatar Re: Make a Better Mess than this
September 26, 2010 02:42PM
Actually Eddy, "pass over" means to skip and go on to the next. "Traverse" means to walk along. eg. You traverse a rope bridge, you don't pass over it.
avatar Re: Make a Better Mess than this
September 26, 2010 05:57PM
Well I've got to get something wrong, don't I?

I have found that inorder trees are probably the easiest to make a good mess of. Preorder and postorder are reasonably difficult to make a good and proper mess of.

Anyway, thanks for the nice analogy for "traverse".
avatar Re: Make a Better Mess than this
September 29, 2010 11:21AM
OK. Spot the error.
Inorder traversal of Q1


Surely that's simple enough?
Sorry, only registered users may post in this forum.

Click here to login