---
# System prepended metadata

title: ntut ds hw3
tags: [learning, data structure]

---

###### tags: `learning` `data structure`

# ntut ds hw3

![](https://i.imgur.com/Z1hFMjr.png)

compiled on https://www.onlinegdb.com/edit/BJkTApChV


```
Hello World
pop is trigered.
arrayLen=4
top=-1
The stack is empty. You got a default DatumItem object key=-1 datum=\0
i = 0
old
0 | 0 | 0 | 0 | 
new
0x77d301de6920 | 0 | 0 | 0 | 
test getSize ==> 4
i = 1
old
0x77d301de6920 | 0 | 0 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 
test getSize ==> 4
i = 2
old
0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 
test getSize ==> 4
i = 3
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 
test getSize ==> 4
i = 4
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 
Stack (size=4) is full. Create and use a double-size array(size=8)!
0x248f480
0x248f4b0
0x248f4b0
0x248f4b0
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 0 | 
test getSize ==> 8
i = 5
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 
test getSize ==> 8
i = 6
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 
test getSize ==> 8
i = 7
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 
test getSize ==> 8
i = 8
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 
Stack (size=8) is full. Create and use a double-size array(size=16)!
0x248f4b0
0x248f500
0x248f500
0x248f500
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 
test getSize ==> 16
i = 0
pop is trigered.
arrayLen=16
top=8
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 
0x248f500
0x248f4b0
0x248f4b0
0x248f4b0
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 
pop is trigered.
arrayLen=8
top=7
test getSize ==> 8
i = 1
pop is trigered.
arrayLen=8
top=7
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 
pop is trigered.
arrayLen=8
top=6
test getSize ==> 8
i = 2
pop is trigered.
arrayLen=8
top=6
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 
pop is trigered.
arrayLen=8
top=5
test getSize ==> 8
i = 3
pop is trigered.
arrayLen=8
top=5
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 0 | 
pop is trigered.
arrayLen=8
top=4
test getSize ==> 8
i = 4
pop is trigered.
arrayLen=8
top=4
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 0 | 
0x248f4b0
0x248f480
0x248f480
0x248f480
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 
pop is trigered.
arrayLen=4
top=3
test getSize ==> 4
i = 5
pop is trigered.
arrayLen=4
top=3
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 
new
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 
pop is trigered.
arrayLen=4
top=2
test getSize ==> 4
i = 6
pop is trigered.
arrayLen=4
top=2
old
0x77d301de6920 | 0x77d301de6920 | 0x77d301de6920 | 0 | 
new
0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 
pop is trigered.
arrayLen=4
top=1
test getSize ==> 4
i = 7
pop is trigered.
arrayLen=4
top=1
old
0x77d301de6920 | 0x77d301de6920 | 0 | 0 | 
new
0x77d301de6920 | 0 | 0 | 0 | 
pop is trigered.
arrayLen=4
top=0
test getSize ==> 4
i = 8
pop is trigered.
arrayLen=4
top=0
old
0x77d301de6920 | 0 | 0 | 0 | 
new
0 | 0 | 0 | 0 | 
pop is trigered.
arrayLen=4
top=-1
test getSize ==> 4
Mom! I am here!
```