linux2% gcc -Wall -c -g bst.c linux2% gcc -Wall -c -g demo8b.c linux2% gcc demo8b.o bst.o linux2% linux2% ./a.out ### Testing bst_insert() ### ------------------------------------------------------------------- 4 [1] 91 [2] 112 [8] 152 [2] 153 [1] 166 [5] 193 [2] 202 [1] 231 [9] 339 [23] 400 [1] 416 [2] 434 [5] 520 [1] 532 [2] 605 [13] 639 [1] 674 [2] 695 [3] 719 [6] 731 [1] 750 [2] 751 [7] 765 [32] 772 [4] 852 [3] 914 [2] 930 [1] 938 [8] 941 [2] 976 [1] 984 [3] ------------------------------------------------------------------- ### Testing bst_find() ### Found 719 Did not find 256 ### Testing bst_remove() ### Found 605 ------------------------------------------------------------------- 4 [1] 91 [2] 112 [8] 152 [2] 153 [1] 166 [5] 193 [2] 202 [1] 231 [9] 339 [22] 400 [1] 416 [2] 434 [4] 520 [1] 532 [12] 639 [1] 674 [2] 695 [3] 719 [6] 731 [1] 750 [2] 751 [7] 765 [31] 772 [4] 852 [3] 914 [2] 930 [1] 938 [8] 941 [2] 976 [1] 984 [3] ------------------------------------------------------------------- Did not find 333 ------------------------------------------------------------------- 4 [1] 91 [2] 112 [8] 152 [2] 153 [1] 166 [5] 193 [2] 202 [1] 231 [9] 339 [22] 400 [1] 416 [2] 434 [4] 520 [1] 532 [12] 639 [1] 674 [2] 695 [3] 719 [6] 731 [1] 750 [2] 751 [7] 765 [31] 772 [4] 852 [3] 914 [2] 930 [1] 938 [8] 941 [2] 976 [1] 984 [3] ------------------------------------------------------------------- Found 765 ------------------------------------------------------------------- 4 [1] 91 [2] 112 [8] 152 [2] 153 [1] 166 [5] 193 [2] 202 [1] 231 [9] 339 [21] 400 [1] 416 [2] 434 [4] 520 [1] 532 [11] 639 [1] 674 [2] 695 [3] 719 [6] 731 [1] 750 [2] 751 [30] 772 [4] 852 [3] 914 [2] 930 [1] 938 [8] 941 [2] 976 [1] 984 [3] ------------------------------------------------------------------- linux2% linux2% valgrind. a.out ==2636== Memcheck, a memory error detector ==2636== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. ==2636== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info ==2636== Command: a.out ==2636== ### Testing bst_insert() ### ------------------------------------------------------------------- 4 [1] 91 [2] 112 [8] 152 [2] 153 [1] 166 [5] 193 [2] 202 [1] 231 [9] 339 [23] 400 [1] 416 [2] 434 [5] 520 [1] 532 [2] 605 [13] 639 [1] 674 [2] 695 [3] 719 [6] 731 [1] 750 [2] 751 [7] 765 [32] 772 [4] 852 [3] 914 [2] 930 [1] 938 [8] 941 [2] 976 [1] 984 [3] ------------------------------------------------------------------- ### Testing bst_find() ### Found 719 Did not find 256 ### Testing bst_remove() ### Found 605 ------------------------------------------------------------------- 4 [1] 91 [2] 112 [8] 152 [2] 153 [1] 166 [5] 193 [2] 202 [1] 231 [9] 339 [22] 400 [1] 416 [2] 434 [4] 520 [1] 532 [12] 639 [1] 674 [2] 695 [3] 719 [6] 731 [1] 750 [2] 751 [7] 765 [31] 772 [4] 852 [3] 914 [2] 930 [1] 938 [8] 941 [2] 976 [1] 984 [3] ------------------------------------------------------------------- Did not find 333 ------------------------------------------------------------------- 4 [1] 91 [2] 112 [8] 152 [2] 153 [1] 166 [5] 193 [2] 202 [1] 231 [9] 339 [22] 400 [1] 416 [2] 434 [4] 520 [1] 532 [12] 639 [1] 674 [2] 695 [3] 719 [6] 731 [1] 750 [2] 751 [7] 765 [31] 772 [4] 852 [3] 914 [2] 930 [1] 938 [8] 941 [2] 976 [1] 984 [3] ------------------------------------------------------------------- Found 765 ------------------------------------------------------------------- 4 [1] 91 [2] 112 [8] 152 [2] 153 [1] 166 [5] 193 [2] 202 [1] 231 [9] 339 [21] 400 [1] 416 [2] 434 [4] 520 [1] 532 [11] 639 [1] 674 [2] 695 [3] 719 [6] 731 [1] 750 [2] 751 [30] 772 [4] 852 [3] 914 [2] 930 [1] 938 [8] 941 [2] 976 [1] 984 [3] ------------------------------------------------------------------- ==2636== ==2636== HEAP SUMMARY: ==2636== in use at exit: 0 bytes in 0 blocks ==2636== total heap usage: 32 allocs, 32 frees, 512 bytes allocated ==2636== ==2636== All heap blocks were freed -- no leaks are possible ==2636== ==2636== For counts of detected and suppressed errors, rerun with: -v ==2636== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 12 from 8) linux2% exit