Assignment Development Guide Code Checklist |
You should use this guide to help you to complete your assignment.
You should follow it step by step,
resolving errors before going on to the next step.
Refer to the HW5 Assignment page for the descriptions for each method you need to write.
Once you can follow this guide without errors,
you should come up with more test cases to test your program.
Note: Before step 8, it is okay that there are memory leaks after you press^D.
However, after step 8 (in which you will implement the jettison methods) you should not see any memory leaks after ^D terminates the program.
Another Note: If you are not working on the ieng6 server, you might get differet sizes of the objects when checking your memory usage.
In your terminal use jdb to execute your program,
$ jdb Driver1
Open another terminal to use as your jdb terminal, copy paste what you got from the jdb window to execute your program.
$ \jdb -attach 80[xx]
In your jdb terminal
main[1] stop in List$ListEngine.<init>
main[1] run
Breakpoint hit: "thread=main", List$ListEngine.<init>(), line=66 bci=0
66 public ListEngine (Base sample, String caller) {
main[1] next
…repeat until you have reached the bottom of your method.
main[1] print occupancy
occupancy = 0
main[1] print end
end = null
main[1] print this.sample
this.sample = null
main[1] print List.listCounter
List.listCounter = 1
Note: You should also test this with Driver2, and you should see this.sample is not null.
% ./Driver1 -x
[List 1 has been allocated]
The commands are:
is(e)mpty, (o)ccupancy, (c)heck memory,
(a)dvance pre, advance (n)ext,
p(u)sh, (p)op, (t)op,
(i)nsert, (r)emove, (v)iew
(w)rite, (W)rite reverse,
Please enter a command: w
------------ TRACKED MEMORY ------------
36 bytes of heap memory, created in baseStack in Driver.main calling BaseStack Ctor
calling List Ctor calling ListEngine Ctor for the ListEngine object.
List 1 has 0 items in it.
The commands are:
is(e)mpty, (o)ccupancy, (c)heck memory,
(a)dvance pre, advance (n)ext,
p(u)sh, (p)op, (t)op,
(i)nsert, (r)emove, (v)iew
(w)rite, (W)rite reverse,
Please enter a command: ^D
// You will see some memory leaks after you end the program until you have finished step 8.
// This is expected because we have not yet implemented the jettison methods.
$ jdb Driver1
Set up the two terminals like before.
$ \jdb -attach 80[xx]
In your jdb terminal
main[1] stop in List$ListEngine$Node$NodeEngine.insert
main[1] run
The commands are:
is(e)mpty, (o)ccupancy, (c)heck memory,
(a)dvance pre, advance (n)ext,
p(u)sh, (p)op, (t)op,
(i)nsert, (r)emove, (v)iew
(w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 10
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
At this point the breakpoint should not be reached yet because we only allocated one node. Continue with the second prompt.
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 20
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
Now we will have reached the breakpoint at ListEngine's insert.
Type 'cont' so we can insert a third node and look at them all at once.
main[1] cont
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 30
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
main[1] next
Repeat until you pass your variable reassignments to include the new 30 node into the list.
Right now, the linked list looks like 30->20->10, with 10 as the end, -> indicates a next pointer.
Assuming our newly created node is called 'newNode',
we can check the next and pre fields of newNode and the thisNode (the first parameter to NodeEngine's insert, aka the end before inserting newNode).
main[1] print newNode.nodeEngine.data
newNode.nodeEngine.data = "30"
main[1] print newNode.nodeEngine.next.nodeEngine.data
newNode.nodeEngine.next.nodeEngine.data = "20"
This value should match that of thisNode since we are inserting before it as the new front now.
main[1] print newNode.nodeEngine.pre.nodeEngine.data
newNode.nodeEngine.pre.nodeEngine.data = "10"
This value should match our 'last' node's value (first one we put in) since we are implementing a circular linked list so to the newNode (which is at the beginning of the list) pointer's pre field points to the end of the list.
main[1] print thisNode.nodeEngine.data
thisNode.nodeEngine.data = "10"
This value should match that of the most recent element you inserted since we've been inserting at the front each time (20)
main[1] print thisNode.nodeEngine.next.nodeEngine.data
thisNode.nodeEngine.next.nodeEngine.data = "30"
This value should match that of the FIRST element we INSERTED into the list since it came before the previous number (10)
main[1] print thisNode.nodeEngine.pre.nodeEngine.data
thisNode.nodeEngine.pre.nodeEngine.data = "20"
This value should match that of the newNode since we inserted newNode in front of the thisNode.
% ./Driver1 -x
[List 1 has been allocated]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 1
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 0
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 2
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 0
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 3
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 0
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 4
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 5
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 6
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 6 items in it.
element 1: 6
[List 1 - Advancing next]
element 2: 5
[List 1 - Advancing next]
element 3: 4
[List 1 - Advancing next]
element 4: 1
[List 1 - Advancing next]
element 5: 2
[List 1 - Advancing next]
element 6: 3
[List 1 - Advancing next]
------------ TRACKED MEMORY ------------
36 bytes of heap memory, created in baseStack in Driver.main calling BaseStack Ctor
calling List Ctor calling ListEngine Ctor for the ListEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 3333
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 7 items in it.
element 1: 6
[List 1 - Advancing next]
element 2: 5
[List 1 - Advancing next]
element 3: 4
[List 1 - Advancing next]
element 4: 1
[List 1 - Advancing next]
element 5: 2
[List 1 - Advancing next]
element 6: 3
[List 1 - Advancing next]
element 7: 3333
[List 1 - Advancing next]
------------ TRACKED MEMORY ------------
36 bytes of heap memory, created in baseStack in Driver.main calling BaseStack Ctor
calling List Ctor calling ListEngine Ctor for the ListEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: ^D
// You will see some memory leaks after you end the program until you have finished step 8.
// This is expected because we have not yet implemented the jettison methods.
% ./Driver1
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 1
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 2
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 3
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 4
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 5
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 5 items in it.
element 1: 1
element 2: 2
element 3: 3
element 4: 4
element 5: 5
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: a
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 5 items in it.
element 1: 5
element 2: 1
element 3: 2
element 4: 3
element 5: 4
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: n
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 5 items in it.
element 1: 1
element 2: 2
element 3: 3
element 4: 4
element 5: 5
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: ^D
// Again, you will see some memory leaks after you end the program until you have finished step 8.
// This is expected because we have not yet implemented the jettison methods.
% ./Driver1 -x
[List 1 has been allocated]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 1
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 2
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 3
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: i
Please enter a number to insert into list: 4
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 4 items in it:
[List 1 - Advancing next]
element 1: 4
[List 1 - Advancing next]
element 2: 3
[List 1 - Advancing next]
element 3: 2
[List 1 - Advancing next]
element 4: 1
[List 1 - Advancing next]
------------ TRACKED MEMORY ------------
36 bytes of heap memory, created in baseStack in Driver.main calling BaseStack Ctor
calling List Ctor calling ListEngine Ctor for the ListEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
Please enter a command: i
Please enter a number to insert into list: 8888
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 4
[List 1 - Inserting node]
[List 1 - Advancing pre]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 5 items in it:
[List 1 - Advancing next]
element 1: 4
[List 1 - Advancing next]
element 2: 3
[List 1 - Advancing next]
element 3: 2
[List 1 - Advancing next]
element 4: 8888
[List 1 - Advancing next]
element 5: 1
[List 1 - Advancing next]
------------ TRACKED MEMORY ------------
36 bytes of heap memory, created in baseStack in Driver.main calling BaseStack Ctor
calling List Ctor calling ListEngine Ctor for the ListEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: ^D
// Memory leaks are expected.
Now we will test with a harder case.
Note that in the first insertion, we advanced pre, and on the second insertion, we advanced next. This indicates that our checkToGoForward> is correctly choosing the optimum path to travel.
% ./Driver1 -x
[List 1 has been allocated]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: e
Stack is empty.
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 1111
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 2222
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: e
Stack is not empty.
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: ^D
// This is the LAST PLACE where memory Leaks are expected in all the tests shown on dev guide.
% ./Driver1 -x
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 1
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 2
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 3
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 4
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 5
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 5 items in it.
element 1: 1
element 2: 2
element 3: 3
element 4: 4
element 5: 5
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: v
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 0
Number viewed from list is: 5
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: v
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 1
Number viewed from list is: 1
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: v
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 2
[List 1 - Viewing node]
Number viewed from list is: 2
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: ^D
No memory leaks! All memory has been correctly deallocated.
% ./Driver1 -x
[List 1 has been allocated]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: r
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 0
[List 1 - Removing node]
Remove from empty list!!!
WARNING: remove FAILED
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 2
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 3
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 4
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 5
[List 1 - Inserting node]
Please enter a command: r
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 0
[List 1 - Removing node]
Number removed from list is: 5
Please enter a command: r
Specify 1 for FRONT, 0 for END, or location number
Please enter choice: 3
[List 1 - Removing node]
[List 1 - Advancing next]
Number removed from list is: 3
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
Please enter a command: w
List 1 has 3 items in it:
[List 1 - Advancing next]
element 1: 1
[List 1 - Advancing next]
element 2: 2
[List 1 - Advancing next]
element 3: 4
[List 1 - Advancing next]
------------ TRACKED MEMORY ------------
36 bytes of heap memory, created in baseStack in Driver.main calling BaseStack Ctor
calling List Ctor calling ListEngine Ctor for the ListEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: ^D [List 1 has been jettisoned]
No memory leaks! All memory has been correctly deallocated.
Now test your code with the insert, remove, insert (push, pop, push)
% ./Driver1 -x
[List 1 has been allocated]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: p
[List 1 - Removing node]
[List 1 - Advancing next]
Number popped from list is: 1
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: u
Please enter a number to push to stack: 1
[List 1 - Inserting node]
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: w
List 1 has 1 items in it:
[List 1 - Advancing next]
element 1: 1
[List 1 - Advancing next]
------------ TRACKED MEMORY ------------
36 bytes of heap memory, created in baseStack in Driver.main calling BaseStack Ctor
calling List Ctor calling ListEngine Ctor for the ListEngine object.
16 bytes of heap memory, created in Driver.main calling Ctor for the MyRec object.
32 bytes of heap memory, created in Node Ctor calling NodeEngine Ctor for the NodeEngine object.
The commands are:
is(e)mpty, (i)nsert, (p)op,
(a)dvance pre, advance (n)ext,
(r)emove, (t)op, p(u)sh,
(v)iew, (w)rite, (W)rite reverse,
Please enter a command: ^D
$ ~/../public/hw5/java/Driver1 [-x]
$ ~/../public/hw5/java/Driver2 [-x]
$ ~/../public/hw5/java/Calc [-x]
Note that, in order for your homework to be collected correctly, you must name your file List.java and the file must be located in a folder called hw5/java in your home directory.
Assignment Development Guide Code Checklist |