Assignment • FAQ • Development Guide • Code • Checklist • |
You should use this guide to help you to complete your assingment. You should follow it step by step, resolving errors before going on to the next step. Once you can follow this guide without errors, you should come up with more test cases and compare the output of your program with that of the solution.
% ./Driver -x
[Tree 1 - Allocating]
Initial Symbol Table:
Tree 1:
occupancy is 0 elements.
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: a
Please enter UCSD student number: 1
[Tree 1 - Inserting a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite:^D
Final Symbol Table:
Tree 1:
occupancy is 1 elements.
at height: 0 with balance: 0 name: a with studentnum: 1
...... Where memory leaks are expected ......
Note: The heights and balances in the output above reports 0 because the setHeightAndBalance method has yet to be written. If you've already implemented setHeightAndBalance, your heights and balances may be different from that listed below. Also, you might have memory leaks at this point. That is okay! They will disappear when we write jettisonAllTNodes later.
% ./Driver -x
[Tree 1 - Allocating]
Initial Symbol Table:
Tree 1:
occupancy is 0 elements.
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: aaa
Please enter UCSD student number: 1
[Tree 1 - Inserting aaa]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: bbb
Please enter UCSD student number: 2
[Tree 1 - Comparing bbb and aaa]
[Tree 1 - Inserting bbb]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: ccc
Please enter UCSD student number: 3
[Tree 1 - Comparing ccc and aaa]
[Tree 1 - Comparing ccc and bbb]
[Tree 1 - Inserting ccc]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: ^D
Final Symbol Table:
Tree 1:
occupancy is 3 elements.
at height: 0 with balance: 0 name: aaa with studentnum: 1
at height: 0 with balance: 0 name: bbb with studentnum: 2
at height: 0 with balance: 0 name: ccc with studentnum: 3
...... Where memory leaks are expected ......
% ./Driver -x
[Tree 1 - Allocating]
Initial Symbol Table:
Tree 1:
occupancy is 0 elements.
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: aaa
Please enter UCSD student number: 1
[Tree 1 - Inserting aaa]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: bbb
Please enter UCSD student number: 2
[Tree 1 - Comparing bbb and aaa]
[Tree 1 - Inserting bbb]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: ccc
Please enter UCSD student number: 3
[Tree 1 - Comparing ccc and aaa]
[Tree 1 - Comparing ccc and bbb]
[Tree 1 - Inserting ccc]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: r
Please enter UCSD student name to remove: bbb
[Tree 1 - Comparing bbb and aaa]
[Tree 1 - Comparing bbb and bbb]
Student removed!!!
name: bbb with studentnum: 2
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: ^D
Final Symbol Table:
Tree 1:
occupancy is 2 elements.
at height: 0 with balance: 0 name: aaa with studentnum: 1
at height: 0 with balance: 0 name: ccc with studentnum: 3
......
% ./Driver -x
[Tree 1 - Allocating]
Initial Symbol Table:
Tree 1:
occupancy is 0 elements.
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: a
Please enter UCSD student number: 1
[Tree 1 - Inserting a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: b
Please enter UCSD student number: 2
[Tree 1 - Comparing b and a]
[Tree 1 - Inserting b]
[Tree 1 - Updating a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: c
Please enter UCSD student number: 3
[Tree 1 - Comparing c and a]
[Tree 1 - Comparing c and b]
[Tree 1 - Inserting c]
[Tree 1 - Updating b]
[Tree 1 - Updating a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: d
Please enter UCSD student number: 4
[Tree 1 - Comparing d and a]
[Tree 1 - Comparing d and b]
[Tree 1 - Comparing d and c]
[Tree 1 - Inserting d]
[Tree 1 - Updating c]
[Tree 1 - Updating b]
[Tree 1 - Updating a]
[Tree 1 - Comparing a and a]
[Tree 1 - Comparing a and b]
[Tree 1 - Inserting a]
[Tree 1 - Updating b]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: ^D
Final Symbol Table:
Tree 1:
occupancy is 4 elements.
at height: 0 with balance: 0 name: a with studentnum: 1
at height: 2 with balance: -1 name: b with studentnum: 2
at height: 1 with balance: -1 name: c with studentnum: 3
at height: 0 with balance: 0 name: d with studentnum: 4
......
% ./Driver -x
[Tree 1 - Allocating]
Initial Symbol Table:
Tree 1:
occupancy is 0 elements.
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: a
Please enter UCSD student number: 1
[Tree 1 - Inserting a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: b
Please enter UCSD student number: 2
[Tree 1 - Comparing b and a]
[Tree 1 - Inserting b]
[Tree 1 - Updating a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: c
Please enter UCSD student number: 3
[Tree 1 - Comparing c and a]
[Tree 1 - Comparing c and b]
[Tree 1 - Inserting c]
[Tree 1 - Updating b]
[Tree 1 - Updating a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: d
Please enter UCSD student number: 4
[Tree 1 - Comparing d and a]
[Tree 1 - Comparing d and b]
[Tree 1 - Comparing d and c]
[Tree 1 - Inserting d]
[Tree 1 - Updating c]
[Tree 1 - Updating b]
[Tree 1 - Updating a]
[Tree 1 - Comparing a and a]
[Tree 1 - Comparing a and b]
[Tree 1 - Inserting a]
[Tree 1 - Updating b]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: e
Please enter UCSD student number: 5
[Tree 1 - Comparing e and b]
[Tree 1 - Comparing e and c]
[Tree 1 - Comparing e and d]
[Tree 1 - Inserting e]
[Tree 1 - Updating d]
[Tree 1 - Updating c]
[Tree 1 - Updating b]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: f
Please enter UCSD student number: 6
[Tree 1 - Comparing f and b]
[Tree 1 - Comparing f and c]
[Tree 1 - Comparing f and d]
[Tree 1 - Comparing f and e]
[Tree 1 - Inserting f]
[Tree 1 - Updating e]
[Tree 1 - Updating d]
[Tree 1 - Updating c]
[Tree 1 - Comparing c and c]
[Tree 1 - Comparing c and d]
[Tree 1 - Inserting c]
[Tree 1 - Updating d]
[Tree 1 - Updating b]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: g
Please enter UCSD student number: 7
[Tree 1 - Comparing g and b]
[Tree 1 - Comparing g and d]
[Tree 1 - Comparing g and e]
[Tree 1 - Comparing g and f]
[Tree 1 - Inserting g]
[Tree 1 - Updating f]
[Tree 1 - Updating e]
[Tree 1 - Updating d]
[Tree 1 - Updating b]
[Tree 1 - Comparing b and b]
[Tree 1 - Checking d]
[Tree 1 - Checking c]
[Tree 1 - Replacing c]
[Tree 1 - Updating d]
[Tree 1 - Comparing d and d]
[Tree 1 - Comparing d and e]
[Tree 1 - Inserting d]
[Tree 1 - Updating e]
[Tree 1 - Comparing b and c]
[Tree 1 - Comparing b and a]
[Tree 1 - Inserting b]
[Tree 1 - Updating a]
[Tree 1 - Updating c]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite:
Final Symbol Table:
Tree 1:
occupancy is 7 elements.
at height: 1 with balance: -1 name: a with studentnum: 1
at height: 0 with balance: 0 name: b with studentnum: 2
at height: 3 with balance: -1 name: c with studentnum: 3
at height: 0 with balance: 0 name: d with studentnum: 4
at height: 2 with balance: -1 name: e with studentnum: 5
at height: 1 with balance: -1 name: f with studentnum: 6
at height: 0 with balance: 0 name: g with studentnum: 7
......
% ./Driver -x
[Tree 1 - Allocating]
Initial Symbol Table:
Tree 1:
occupancy is 0 elements.
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: a
Please enter UCSD student number: 1
[Tree 1 - Inserting a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: b
Please enter UCSD student number: 2
[Tree 1 - Comparing b and a]
[Tree 1 - Inserting b]
[Tree 1 - Updating a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: i
Please enter UCSD student name to insert: c
Please enter UCSD student number: 3
[Tree 1 - Comparing c and a]
[Tree 1 - Comparing c and b]
[Tree 1 - Inserting c]
[Tree 1 - Updating b]
[Tree 1 - Updating a]
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: l
Please enter UCSD student name to lookup: b
[Tree 1 - Comparing b and a]
[Tree 1 - Comparing b and b]
Student found!!!
name: b with studentnum: 2
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite: l
Please enter UCSD student name to lookup: d
[Tree 1 - Comparing d and a]
[Tree 1 - Comparing d and b]
[Tree 1 - Comparing d and c]
student d not there!
Please enter a command:
(c)heck memory, is(e)mpty, (i)nsert, (l)ookup, (r)emove, (w)rite:
Final Symbol Table:
Tree 1:
occupancy is 3 elements.
at height: 2 with balance: -2 name: a with studentnum: 1
at height: 1 with balance: -1 name: b with studentnum: 2
at height: 0 with balance: 0 name: c with studentnum: 3
.......
% ./Driver [-x] < alphabet
% ./Driver [-x] < alphabet.rev
% ./Driver [-x] < alphabet > my_sol.txt 2>&1
% ~/../public/hw8/java/Driver [-x] < alphabet > driver_output.txt 2>&1
% diff my_sol.txt driver_output.txt
The commands above will redirect both your standard input and output to a solution to a file, and then compare your output with our driver's output. If there are inconsistencies, make sure to compare the output to see if you need to debug your code.
% ./Calc [-x]
Note that, in order for your homework to be collected correctly, you must name your files Tree.java and Driver.java and the files must be located in a folder called hw8/java in your home directory.
Assignment • FAQ • Development Guide • Code • Checklist • |