FinalExam Review Spring2007: Draw the Tree
Back to Final Review-Spring 2007
Questions? Answers? Comments?
root ——–branch1——-("is"+"snap")
' '——————–("snap"+"clave")
' '——————–("is"+"is")
'
'—————-scaled branch(2.0)
' '————–(clave + gong)
' '————–(chirp + clap)
'
'————————-scaled branch(0.5)
' '————-("is"+"gong")
'
'
'———————-branch 2
'————–(clap +clave)
'————–(snap+clave)
'—————(snap+clave)
that did not show up right. well all the once after two cotations has to move underneath the branch1 or scaled branch (2) or scaled branch (0.5) or branch 2.(for the last one all go under the branch 2).
drawTree.bmp
take a look a the bitmap and let me know if it works...
I think this diagram below is pretty accurate. However, when you have like "guzdial, is, snap" I think they're supposed to have a next between them. For instance, "guzdial" next -> "is" next -> "snap". I think it is supposed to be this way because they are appended to each other ( as a linked list) and so they know they're next (remember SongNode?). I hope someone can tell me if this is correct.
should children(in each branch) be connected with arrows?
one problem with the diagram: scaledBranch(0.5) is a child of branch1, not of root.. and all the other branches are children of root, and should be displayed that way i think.. the way i have it set up is root is the main center, with branch1, scaledBranch(2.0), and branch2 as children, branch1 being far left with its 4 children (counting scaledBranch(0.5)), with a next going from scaledBranch to scaledBranch, and a next going from "rest chirp clap" child of scaledBranch(2.0) to branch2.. i don't know if thats 100% correct, but whatever.
- A few things to note: Append does not mess with nexts, it merely adds the sound samples onto a given sound; Make sure you indicate ll the children coming from its parent; both ScaleBranches are children of root, NOT of branch 1(hence the "root.addREMOVEDld(scaledBranch)") (although if I'm not mistaken, the "scaledBranch" instance is never declared)
- Basically, root has 4 children, the first and last are SoundBranches each with 3 SongNode children and the middle two are ScaledBranches, one scaled 2.0 with 2 SongNode children and one scaled 0.5 with one child. The first three children of root have nexts and each of the SongNodes' nexts are the other children of the given branch, where applicable.
So this tree can have multiple branches? We are not asked to create a binary tree unless specified, correct?
ah i was looking at the actual method in the java source; that one says that the second scaled branch is a child of branch1. i opened that one in dr java and looked at it from there. from the code here, the guy above is correct. thanks for stressing the NOT to make me make sure :)
drawTree.bmp
Link to this Page