非递归实现二叉查找树
1、头文件:
the 1 insert is 500,the insert address is 006D4F20the tree head address is 006D4F20,the first data is 500the 2 insert is 456 x:456 < pt->data:500,so x:456 insert pt->data:500's left tree the insert address is 006D4F68,the data is 456the tree node address is 006D4F68,insert data is 456the 3 insert is 865 x:865 > pt->data:500,so x:865 insert pt->data:500's right tree the insert address is 006D4FB0,the data is 865the tree node address is 006D4FB0,insert data is 865the 4 insert is 986 x:986 > pt->data:500,so x:986 insert pt->data:500's right tree x:986 > pt->data:865,so x:986 insert pt->data:865's right tree the insert address is 006D22D0,the data is 986the tree node address is 006D22D0,insert data is 986the 5 insert is 213 x:213 < pt->data:500,so x:213 insert pt->data:500's left tree x:213 < pt->data:456,so x:213 insert pt->data:456's left tree the insert address is 006D2318,the data is 213the tree node address is 006D2318,insert data is 213the 6 insert is 666 x:666 > pt->data:500,so x:666 insert pt->data:500's right tree x:666 < pt->data:865,so x:666 insert pt->data:865's left tree the insert address is 006D2360,the data is 666the tree node address is 006D2360,insert data is 666the 7 insert is 333 x:333 < pt->data:500,so x:333 insert pt->data:500's left tree x:333 < pt->data:456,so x:333 insert pt->data:456's left tree x:333 > pt->data:213,so x:333 insert pt->data:213's right tree the insert address is 006D23A8,the data is 333the tree node address is 006D23A8,insert data is 333the 8 insert is 222 x:222 < pt->data:500,so x:222 insert pt->data:500's left tree x:222 < pt->data:456,so x:222 insert pt->data:456's left tree x:222 > pt->data:213,so x:222 insert pt->data:213's right tree x:222 < pt->data:333,so x:222 insert pt->data:333's left tree the insert address is 006D23F0,the data is 222the tree node address is 006D23F0,insert data is 222the 9 insert is 156 x:156 < pt->data:500,so x:156 insert pt->data:500's left tree x:156 < pt->data:456,so x:156 insert pt->data:456's left tree x:156 < pt->data:213,so x:156 insert pt->data:213's left tree the insert address is 006D2438,the data is 156the tree node address is 006D2438,insert data is 156the 10 insert is 423 x:423 < pt->data:500,so x:423 insert pt->data:500's left tree x:423 < pt->data:456,so x:423 insert pt->data:456's left tree x:423 > pt->data:213,so x:423 insert pt->data:213's right tree x:423 > pt->data:333,so x:423 insert pt->data:333's right tree the insert address is 006D2480,the data is 423the tree node address is 006D2480,insert data is 423the 11 insert is 856 x:856 > pt->data:500,so x:856 insert pt->data:500's right tree x:856 < pt->data:865,so x:856 insert pt->data:865's left tree x:856 > pt->data:666,so x:856 insert pt->data:666's right tree the insert address is 006D4FF8,the data is 856the tree node address is 006D4FF8,insert data is 856the 12 insert is 899 x:899 > pt->data:500,so x:899 insert pt->data:500's right tree x:899 > pt->data:865,so x:899 insert pt->data:865's right tree x:899 < pt->data:986,so x:899 insert pt->data:986's left tree the insert address is 006D5040,the data is 899the tree node address is 006D5040,insert data is 899the 13 insert is 966 x:966 > pt->data:500,so x:966 insert pt->data:500's right tree x:966 > pt->data:865,so x:966 insert pt->data:865's right tree x:966 < pt->data:986,so x:966 insert pt->data:986's left tree x:966 > pt->data:899,so x:966 insert pt->data:899's right tree the insert address is 006D5088,the data is 966the tree node address is 006D5088,insert data is 966the 14 insert is 776 x:776 > pt->data:500,so x:776 insert pt->data:500's right tree x:776 < pt->data:865,so x:776 insert pt->data:865's left tree x:776 > pt->data:666,so x:776 insert pt->data:666's right tree x:776 < pt->data:856,so x:776 insert pt->data:856's left tree the insert address is 006D50D0,the data is 776the tree node address is 006D50D0,insert data is 776the 15 insert is 772 x:772 > pt->data:500,so x:772 insert pt->data:500's right tree x:772 < pt->data:865,so x:772 insert pt->data:865's left tree x:772 > pt->data:666,so x:772 insert pt->data:666's right tree x:772 < pt->data:856,so x:772 insert pt->data:856's left tree x:772 < pt->data:776,so x:772 insert pt->data:776's left tree the insert address is 006D5118,the data is 772the tree node address is 006D5118,insert data is 772the 16 insert is 399 x:399 < pt->data:500,so x:399 insert pt->data:500's left tree x:399 < pt->data:456,so x:399 insert pt->data:456's left tree x:399 > pt->data:213,so x:399 insert pt->data:213's right tree x:399 > pt->data:333,so x:399 insert pt->data:333's right tree x:399 < pt->data:423,so x:399 insert pt->data:423's left tree the insert address is 006D5160,the data is 399the tree node address is 006D5160,insert data is 399the 17 insert is 469 x:469 < pt->data:500,so x:469 insert pt->data:500's left tree x:469 > pt->data:456,so x:469 insert pt->data:456's right tree the insert address is 006D51A8,the data is 469the tree node address is 006D51A8,insert data is 469the 18 insert is 586 x:586 > pt->data:500,so x:586 insert pt->data:500's right tree x:586 < pt->data:865,so x:586 insert pt->data:865's left tree x:586 < pt->data:666,so x:586 insert pt->data:666's left tree the insert address is 006D51F0,the data is 586the tree node address is 006D51F0,insert data is 586the 19 insert is 398 x:398 < pt->data:500,so x:398 insert pt->data:500's left tree x:398 < pt->data:456,so x:398 insert pt->data:456's left tree x:398 > pt->data:213,so x:398 insert pt->data:213's right tree x:398 > pt->data:333,so x:398 insert pt->data:333's right tree x:398 < pt->data:423,so x:398 insert pt->data:423's left tree x:398 < pt->data:399,so x:398 insert pt->data:399's left tree the insert address is 006D5238,the data is 398the tree node address is 006D5238,insert data is 398the 20 insert is 11 x:11 < pt->data:500,so x:11 insert pt->data:500's left tree x:11 < pt->data:456,so x:11 insert pt->data:456's left tree x:11 < pt->data:213,so x:11 insert pt->data:213's left tree x:11 < pt->data:156,so x:11 insert pt->data:156's left tree the insert address is 006D5280,the data is 11the tree node address is 006D5280,insert data is 11the min data is 11the max data is 986in the pre visit:the 1 data is 500the stack size is 1,push pt->right:006D4FB0 into stackthe 2 data is 456the stack size is 2,push pt->right:006D51A8 into stackthe 3 data is 213the stack size is 3,push pt->right:006D23A8 into stackthe 4 data is 156the 5 data is 11the 6 data is 333the stack size is 3,push pt->right:006D2480 into stackthe 7 data is 222the 8 data is 423the 9 data is 399the 10 data is 398the 11 data is 469the 12 data is 865the stack size is 1,push pt->right:006D22D0 into stackthe 13 data is 666the stack size is 2,push pt->right:006D4FF8 into stackthe 14 data is 586the 15 data is 856the 16 data is 776the 17 data is 772the 18 data is 986the 19 data is 899the stack size is 1,push pt->right:006D5088 into stackthe 20 data is 966in the mid visit:push the pt->data :500 into stack,stack size is 1push the pt->data :456 into stack,stack size is 2push the pt->data :213 into stack,stack size is 3push the pt->data :156 into stack,stack size is 4push the pt->data :11 into stack,stack size is 5the 1 data is 11the 2 data is 156the 3 data is 213push the pt->data :333 into stack,stack size is 3push the pt->data :222 into stack,stack size is 4the 4 data is 222the 5 data is 333push the pt->data :423 into stack,stack size is 3push the pt->data :399 into stack,stack size is 4push the pt->data :398 into stack,stack size is 5the 6 data is 398the 7 data is 399the 8 data is 423the 9 data is 456push the pt->data :469 into stack,stack size is 2the 10 data is 469the 11 data is 500push the pt->data :865 into stack,stack size is 1push the pt->data :666 into stack,stack size is 2push the pt->data :586 into stack,stack size is 3the 12 data is 586the 13 data is 666push the pt->data :856 into stack,stack size is 2push the pt->data :776 into stack,stack size is 3push the pt->data :772 into stack,stack size is 4the 14 data is 772the 15 data is 776the 16 data is 856the 17 data is 865push the pt->data :986 into stack,stack size is 1push the pt->data :899 into stack,stack size is 2the 18 data is 899push the pt->data :966 into stack,stack size is 2the 19 data is 966the 20 data is 986请按任意键继续. . .