[3] OUTPUT FOR SHIN SORT WITH 10 NUMERIC KEYS
<---------------
Shin sort starts from here ----------------->
Program reads key strings, stores them
into Shin tree, and
performs preorder traversal to print
every node value out.
Preorder after
key #1, "0316" is inserted.
0 3 1 6
-----------------------------------------------------------------
Preorder after
key #2, "0273" is inserted.
0 2 7 3 3 1 6
-----------------------------------------------------------------
Preorder after
key #3, "4329" is inserted.
0 2 7 3 3 1 6 4
3 2 9
-----------------------------------------------------------------
Preorder after
key #4, "9837" is inserted.
0 2 7 3 3 1 6 4
3 2 9 9 8 3 7
-----------------------------------------------------------------
Preorder after
key #5, "0016" is inserted.
0 0 1 6 2 7 3 3
1 6 4 3 2 9 9 8 3 7
-----------------------------------------------------------------
Preorder after
key #6, "0274" is inserted.
0 0 1 6 2 7 3 4
3 1 6 4 3 2 9 9 8 3 7
-----------------------------------------------------------------
Preorder after
key #7, "0107" is inserted.
0 0 1 6 1 0 7 2
7 3 4 3 1 6 4 3 2 9 9 8 3 7
-----------------------------------------------------------------
Preorder after
key #8, "0273" is inserted.
0 0 1 6 1 0 7 2
7 3:1 4 3 1 6 4 3 2 9 9 8 3 7
-----------------------------------------------------------------
Preorder after
key #9, "0005" is inserted.
0 0 0 5 1 6 1 0
7 2 7 3:1 4 3 1 6 4 3 2 9 9 8 3 7
-----------------------------------------------------------------
Preorder after
key #10, "0272" is inserted.
0 0 0 5 1 6 1 0
7 2 7 2 3:1 4 3 1 6 4 3 2 9 9 8 3 7
-----------------------------------------------------------------
----------------<Input
List for the 10 Keys>----------------
0316; 0273; 4329; 9837; 0016; 0274; 0107;
0273; 0005; 0272;
________________________________________________________________
Preorder
traversal after 10 keys are inserted into the tree.
0 0 0 5 1 6 1 0
7 2 7 2 3:1 4 3 1 6 4 3 2 9 9 8 3 7
________________________________________________________________
Inorder
traversal after 10 keys are inserted into the tree.
5 0 6 1 0 7 0 1
2 3:1 4 7 2 6 1 3 0 9 2 3 4 7 3 8 9
________________________________________________________________
Postorder
traversal after 10 keys are inserted into the tree.
5 6 1 0 7 0 4
3:1 2 7 6 1 3 2 1 0 9 2 3 7 3 8 9 4 0
________________________________________________________________
<-----------
Printing Shin tree starts from here ----------->
Traversing the tree in preorder, it will
print out keys and
show how stack is changed. It will push a node character
into the stack and pop one from the
stack. The following
shows how a key character is inserted
into and deleted from
the stack. A key will be printed out whenever
collected
stack items make a full key.
'0' pushed
--> '0' pushed --> '0' pushed --> '5' pushed -->
The stored key,
"0005", is printed out here.
'5' popped
--> '0' popped --> '1' pushed --> '6' pushed -->
The stored key,
"0016", is printed out here.
'6' popped
--> '1' popped --> '0' popped --> '1' pushed -->
'0' pushed
--> '7' pushed -->
The stored key,
"0107", is printed out here.
'7' popped
--> '0' popped --> '1' popped --> '2' pushed -->
'7' pushed
--> '2' pushed -->
The stored key,
"0272", is printed out here.
'2' popped
--> '3' pushed -->
The stored key,
"0273", is printed out here.
The stored key,
"0273", is printed out here.
'3' popped
--> '4' pushed -->
The stored key,
"0274", is printed out here.
'4' popped
--> '7' popped --> '2' popped --> '3' pushed -->
'1' pushed
--> '6' pushed -->
The stored key,
"0316", is printed out here.
'6' popped
--> '1' popped --> '3' popped --> '0' popped -->
'4' pushed
--> '3' pushed --> '2' pushed --> '9' pushed -->
The stored key,
"4329", is printed out here.
'9' popped
--> '2' popped --> '3' popped --> '4' popped -->
'9' pushed
--> '8' pushed --> '3' pushed --> '7' pushed -->
The stored key,
"9837", is printed out here.
'7' popped
--> '3' popped --> '8' popped --> '9' popped -->
----------------<Input
List for the 10 Keys>----------------
0316; 0273; 4329; 9837; 0016; 0274; 0107;
0273; 0005; 0272;
----------------<Sorted
List for the 10 Keys>----------------
0005; 0016; 0107; 0272; 0273; 0273; 0274;
0316; 4329; 9837;
<----------------
Shin search starts from here ---------------->
The following output will show what keys
are looked for and
how characters in a key are searched one
after another in the
tree. The search result, found or not found,
will be printed
after all.
1. Search the Key: 9835 Size: 4
Character of the Node:
9 Counter Value of the
Node: 0
Character of the Node:
8 Counter Value of the
Node: 0
Character of the Node:
3 Counter Value of the
Node: 0
The key,
"9835", is not found.
2. Search the Key: 0275 Size: 4
Character of the Node:
0 Counter Value of the
Node: 0
Character of the Node:
2 Counter Value of the
Node: 0
Character of the Node:
7 Counter Value of the
Node: 0
The key,
"0275", is not found.
3. Search the Key: 0273 Size: 4
Character of the Node:
0 Counter Value of the
Node: 0
Character of the Node:
2 Counter Value of the
Node: 0
Character of the Node:
7 Counter Value of the
Node: 0
Character of the Node:
3 Counter Value of the
Node: 1
The key,
"0273", is found in the Shin tree.
4. Search the Key: 43295 Size: 5
Character of the Node:
4 Counter Value of the
Node: 0
Character of the Node:
3 Counter Value of the
Node: 0
Character of the Node:
2 Counter Value of the
Node: 0
Character of the Node:
9 Counter Value of the
Node: 0
The key,
"43295", is not found.
5. Search the Key: 0271 Size: 4
Character of the Node:
0 Counter Value of the
Node: 0
Character of the Node:
2 Counter Value of the
Node: 0
Character of the Node:
7 Counter Value of the
Node: 0
The key,
"0271", is not found.
6. Search the Key: 0316 Size: 4
Character of the Node:
0 Counter Value of the
Node: 0
Character of the Node:
3 Counter Value of the
Node: 0
Character of the Node:
1 Counter Value of the
Node: 0
Character of the Node:
6 Counter Value of the
Node: 0
The key,
"0316", is found in the Shin tree.
7. Search the Key: 0015 Size: 4
Character of the Node:
0 Counter Value of the
Node: 0
Character of the Node:
0 Counter Value of the Node: 0
Character of the Node:
1 Counter Value of the
Node: 0
The key,
"0015", is not found.