bash-4.3$ date Mon Apr 3 13:04:48 EDT 2017 bash-4.3$ pwd /home/accts/sbs5/cs223/www/current/lectures bash-4.3$ cd code bash-4.3$ cat lp0403.c // logical problem // lp0403.c #include #include // using a declaration where a statement is required. int main(int argc, char *argv[]) { bool avl = true; if(avl) double x = 123; /* while(1) char y = 'z'; for(;;) long z = 369; */ return 0; } bash-4.3$ make lp0403 gcc -g3 -std=gnu99 -pedantic -Wall -lm lp0403.c -o lp0403 lp0403.c: In function ‘main’: lp0403.c:11:5: error: expected expression before ‘double’ double x = 123; ^~~~~~ : recipe for target 'lp0403' failed make: *** [lp0403] Error 1 bash-4.3$ ls AVLmain getLine lp0120.c lp0308.c queuetest.c AVLmain.c getLine.c lp0123 lp0327 queuetest.o AVLmain.h goodDoubler.c lp0123.c lp0327.c random AVLtree heap lp0125 lp0329 random.c AVLtree.c heap.c lp0125.c lp0329.c stacklist AVLtree.h heapsort lp0206 lp0403 stacklist.c AVLtree.o heapsort.c lp0206.c lp0403.c stacknotes AVLtree.output hi lp0208.c lp0403.c~ stack.py badDoubler.c hi.c lp0213 lp0405 struct btreeint hw6 lp0213.c lp0405.c struct2 btreeintargs lists lp0215 Makefile struct2.c btreeintargs.c lists2 lp0215.c mt struct3 btreeint.c lists2.c lp0220 mygetLine struct3.c examplehash lists.c lp0220.c mygetLine.c struct.c examplehash2 liststest lp0227 myString sumRange examplehash2.c liststest.c lp0227.c myString.c sumRange.c examplehash.c lookingAtPointers lp0301 myString.h tolower exhash lookingAtPointers.c lp0301.c printArgs tolower.c exhash2 lp0118 lp0306 printArgs.c exhash2.c lp0118.c lp0306.c __pycache__ exhash.c lp0120 lp0308 queuetest bash-4.3$ ./AVLmain Usage: ./AVLmain [keys]+ bash-4.3$ ./AVLtree INSERT element: 0 0 Height: 0 Size: 1 (0x25af420) --- INSERT element: 1 INSERT element: 1 0 Height: 1 Size: 2 (0x25af420) 1 Height: 0 Size: 1 (0x25af450) --- INSERT element: 2 INSERT element: 2 INSERT element: 2 0 Height: 0 Size: 1 (0x25af420) 1 Height: 1 Size: 3 (0x25af450) 2 Height: 0 Size: 1 (0x25af480) --- INSERT element: 3 INSERT element: 3 INSERT element: 3 0 Height: 0 Size: 1 (0x25af420) 1 Height: 2 Size: 4 (0x25af450) 2 Height: 1 Size: 2 (0x25af480) 3 Height: 0 Size: 1 (0x25af4b0) --- INSERT element: 4 INSERT element: 4 INSERT element: 4 INSERT element: 4 0 Height: 0 Size: 1 (0x25af420) 1 Height: 2 Size: 5 (0x25af450) 2 Height: 0 Size: 1 (0x25af480) 3 Height: 1 Size: 3 (0x25af4b0) 4 Height: 0 Size: 1 (0x25af4e0) --- INSERT element: 5 INSERT element: 5 INSERT element: 5 INSERT element: 5 0 Height: 0 Size: 1 (0x25af420) 1 Height: 1 Size: 3 (0x25af450) 2 Height: 0 Size: 1 (0x25af480) 3 Height: 2 Size: 6 (0x25af4b0) 4 Height: 1 Size: 2 (0x25af4e0) 5 Height: 0 Size: 1 (0x25af510) --- INSERT element: 6 INSERT element: 6 INSERT element: 6 INSERT element: 6 0 Height: 0 Size: 1 (0x25af420) 1 Height: 1 Size: 3 (0x25af450) 2 Height: 0 Size: 1 (0x25af480) 3 Height: 2 Size: 7 (0x25af4b0) 4 Height: 0 Size: 1 (0x25af4e0) 5 Height: 1 Size: 3 (0x25af510) 6 Height: 0 Size: 1 (0x25af540) --- INSERT element: 7 INSERT element: 7 INSERT element: 7 INSERT element: 7 0 Height: 0 Size: 1 (0x25af420) 1 Height: 1 Size: 3 (0x25af450) 2 Height: 0 Size: 1 (0x25af480) 3 Height: 3 Size: 8 (0x25af4b0) 4 Height: 0 Size: 1 (0x25af4e0) 5 Height: 2 Size: 4 (0x25af510) 6 Height: 1 Size: 2 (0x25af540) 7 Height: 0 Size: 1 (0x25af570) --- INSERT element: 8 INSERT element: 8 INSERT element: 8 INSERT element: 8 INSERT element: 8 0 Height: 0 Size: 1 (0x25af420) 1 Height: 1 Size: 3 (0x25af450) 2 Height: 0 Size: 1 (0x25af480) 3 Height: 3 Size: 9 (0x25af4b0) 4 Height: 0 Size: 1 (0x25af4e0) 5 Height: 2 Size: 5 (0x25af510) 6 Height: 0 Size: 1 (0x25af540) 7 Height: 1 Size: 3 (0x25af570) 8 Height: 0 Size: 1 (0x25af5a0) --- INSERT element: 9 INSERT element: 9 INSERT element: 9 INSERT element: 9 INSERT element: 9 0 Height: 0 Size: 1 (0x25af420) 1 Height: 1 Size: 3 (0x25af450) 2 Height: 0 Size: 1 (0x25af480) 3 Height: 3 Size: 10 (0x25af4b0) 4 Height: 0 Size: 1 (0x25af4e0) 5 Height: 1 Size: 3 (0x25af510) 6 Height: 0 Size: 1 (0x25af540) 7 Height: 2 Size: 6 (0x25af570) 8 Height: 1 Size: 2 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- 1 Height: 1 Size: 2 (0x25af450) 2 Height: 0 Size: 1 (0x25af480) 3 Height: 3 Size: 9 (0x25af4b0) 4 Height: 0 Size: 1 (0x25af4e0) 5 Height: 1 Size: 3 (0x25af510) 6 Height: 0 Size: 1 (0x25af540) 7 Height: 2 Size: 6 (0x25af570) 8 Height: 1 Size: 2 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- DELETE: root 2 Height: 0 Size: 1 (0x25af450) 3 Height: 1 Size: 3 (0x25af4b0) 4 Height: 0 Size: 1 (0x25af4e0) 5 Height: 3 Size: 8 (0x25af510) 6 Height: 0 Size: 1 (0x25af540) 7 Height: 2 Size: 4 (0x25af570) 8 Height: 1 Size: 2 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- 3 Height: 1 Size: 2 (0x25af4b0) 4 Height: 0 Size: 1 (0x25af4e0) 5 Height: 3 Size: 7 (0x25af510) 6 Height: 0 Size: 1 (0x25af540) 7 Height: 2 Size: 4 (0x25af570) 8 Height: 1 Size: 2 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- DELETE: root 4 Height: 0 Size: 1 (0x25af4b0) 5 Height: 1 Size: 3 (0x25af510) 6 Height: 0 Size: 1 (0x25af540) 7 Height: 2 Size: 6 (0x25af570) 8 Height: 1 Size: 2 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- 5 Height: 1 Size: 2 (0x25af510) 6 Height: 0 Size: 1 (0x25af540) 7 Height: 2 Size: 5 (0x25af570) 8 Height: 1 Size: 2 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- DELETE: root 6 Height: 0 Size: 1 (0x25af510) 7 Height: 2 Size: 4 (0x25af570) 8 Height: 1 Size: 2 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- 7 Height: 0 Size: 1 (0x25af570) 8 Height: 1 Size: 3 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- 8 Height: 1 Size: 2 (0x25af5a0) 9 Height: 0 Size: 1 (0x25af5d0) --- DELETE: root 9 Height: 0 Size: 1 (0x25af5a0) --- --- bash-4.3$ valgrind !! valgrind ./AVLtree ==30210== Memcheck, a memory error detector ==30210== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==30210== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==30210== Command: ./AVLtree ==30210== INSERT element: 0 0 Height: 0 Size: 1 (0x51fa480) --- INSERT element: 1 INSERT element: 1 0 Height: 1 Size: 2 (0x51fa480) 1 Height: 0 Size: 1 (0x51fa4e0) --- INSERT element: 2 INSERT element: 2 INSERT element: 2 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) --- INSERT element: 3 INSERT element: 3 INSERT element: 3 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 2 Size: 4 (0x51fa4e0) 2 Height: 1 Size: 2 (0x51fa540) 3 Height: 0 Size: 1 (0x51fa5a0) --- INSERT element: 4 INSERT element: 4 INSERT element: 4 INSERT element: 4 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 2 Size: 5 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 1 Size: 3 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) --- INSERT element: 5 INSERT element: 5 INSERT element: 5 INSERT element: 5 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 2 Size: 6 (0x51fa5a0) 4 Height: 1 Size: 2 (0x51fa600) 5 Height: 0 Size: 1 (0x51fa660) --- INSERT element: 6 INSERT element: 6 INSERT element: 6 INSERT element: 6 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 2 Size: 7 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 1 Size: 3 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) --- INSERT element: 7 INSERT element: 7 INSERT element: 7 INSERT element: 7 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 3 Size: 8 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 2 Size: 4 (0x51fa660) 6 Height: 1 Size: 2 (0x51fa6c0) 7 Height: 0 Size: 1 (0x51fa720) --- INSERT element: 8 INSERT element: 8 INSERT element: 8 INSERT element: 8 INSERT element: 8 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 3 Size: 9 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 2 Size: 5 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 1 Size: 3 (0x51fa720) 8 Height: 0 Size: 1 (0x51fa780) --- INSERT element: 9 INSERT element: 9 INSERT element: 9 INSERT element: 9 INSERT element: 9 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 3 Size: 10 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 1 Size: 3 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 6 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 1 Height: 1 Size: 2 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 3 Size: 9 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 1 Size: 3 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 6 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- DELETE: root 2 Height: 0 Size: 1 (0x51fa4e0) 3 Height: 1 Size: 3 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 3 Size: 8 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 4 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 3 Height: 1 Size: 2 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 3 Size: 7 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 4 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- DELETE: root 4 Height: 0 Size: 1 (0x51fa5a0) 5 Height: 1 Size: 3 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 6 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 5 Height: 1 Size: 2 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 5 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- DELETE: root 6 Height: 0 Size: 1 (0x51fa660) 7 Height: 2 Size: 4 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 7 Height: 0 Size: 1 (0x51fa720) 8 Height: 1 Size: 3 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- DELETE: root 9 Height: 0 Size: 1 (0x51fa780) --- --- ==30210== ==30210== HEAP SUMMARY: ==30210== in use at exit: 0 bytes in 0 blocks ==30210== total heap usage: 11 allocs, 11 frees, 1,344 bytes allocated ==30210== ==30210== All heap blocks were freed -- no leaks are possible ==30210== ==30210== For counts of detected and suppressed errors, rerun with: -v ==30210== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) bash-4.3$ bash-4.3$ date Mon Apr 3 13:26:34 EDT 2017 bash-4.3$ pwd /home/accts/sbs5/cs223/www/current/lectures bash-4.3$ cd code bash-4.3$ ./AVLtree INSERT element: 0 0 Height: 0 Size: 1 (0x1bf0420) --- INSERT element: 1 INSERT element: 1 0 Height: 1 Size: 2 (0x1bf0420) 1 Height: 0 Size: 1 (0x1bf0450) --- INSERT element: 2 INSERT element: 2 INSERT element: 2 0 Height: 0 Size: 1 (0x1bf0420) 1 Height: 1 Size: 3 (0x1bf0450) 2 Height: 0 Size: 1 (0x1bf0480) --- INSERT element: 3 INSERT element: 3 INSERT element: 3 0 Height: 0 Size: 1 (0x1bf0420) 1 Height: 2 Size: 4 (0x1bf0450) 2 Height: 1 Size: 2 (0x1bf0480) 3 Height: 0 Size: 1 (0x1bf04b0) --- INSERT element: 4 INSERT element: 4 INSERT element: 4 INSERT element: 4 0 Height: 0 Size: 1 (0x1bf0420) 1 Height: 2 Size: 5 (0x1bf0450) 2 Height: 0 Size: 1 (0x1bf0480) 3 Height: 1 Size: 3 (0x1bf04b0) 4 Height: 0 Size: 1 (0x1bf04e0) --- INSERT element: 5 INSERT element: 5 INSERT element: 5 INSERT element: 5 0 Height: 0 Size: 1 (0x1bf0420) 1 Height: 1 Size: 3 (0x1bf0450) 2 Height: 0 Size: 1 (0x1bf0480) 3 Height: 2 Size: 6 (0x1bf04b0) 4 Height: 1 Size: 2 (0x1bf04e0) 5 Height: 0 Size: 1 (0x1bf0510) --- INSERT element: 6 INSERT element: 6 INSERT element: 6 INSERT element: 6 0 Height: 0 Size: 1 (0x1bf0420) 1 Height: 1 Size: 3 (0x1bf0450) 2 Height: 0 Size: 1 (0x1bf0480) 3 Height: 2 Size: 7 (0x1bf04b0) 4 Height: 0 Size: 1 (0x1bf04e0) 5 Height: 1 Size: 3 (0x1bf0510) 6 Height: 0 Size: 1 (0x1bf0540) --- INSERT element: 7 INSERT element: 7 INSERT element: 7 INSERT element: 7 0 Height: 0 Size: 1 (0x1bf0420) 1 Height: 1 Size: 3 (0x1bf0450) 2 Height: 0 Size: 1 (0x1bf0480) 3 Height: 3 Size: 8 (0x1bf04b0) 4 Height: 0 Size: 1 (0x1bf04e0) 5 Height: 2 Size: 4 (0x1bf0510) 6 Height: 1 Size: 2 (0x1bf0540) 7 Height: 0 Size: 1 (0x1bf0570) --- INSERT element: 8 INSERT element: 8 INSERT element: 8 INSERT element: 8 INSERT element: 8 0 Height: 0 Size: 1 (0x1bf0420) 1 Height: 1 Size: 3 (0x1bf0450) 2 Height: 0 Size: 1 (0x1bf0480) 3 Height: 3 Size: 9 (0x1bf04b0) 4 Height: 0 Size: 1 (0x1bf04e0) 5 Height: 2 Size: 5 (0x1bf0510) 6 Height: 0 Size: 1 (0x1bf0540) 7 Height: 1 Size: 3 (0x1bf0570) 8 Height: 0 Size: 1 (0x1bf05a0) --- INSERT element: 9 INSERT element: 9 INSERT element: 9 INSERT element: 9 INSERT element: 9 0 Height: 0 Size: 1 (0x1bf0420) 1 Height: 1 Size: 3 (0x1bf0450) 2 Height: 0 Size: 1 (0x1bf0480) 3 Height: 3 Size: 10 (0x1bf04b0) 4 Height: 0 Size: 1 (0x1bf04e0) 5 Height: 1 Size: 3 (0x1bf0510) 6 Height: 0 Size: 1 (0x1bf0540) 7 Height: 2 Size: 6 (0x1bf0570) 8 Height: 1 Size: 2 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- 1 Height: 1 Size: 2 (0x1bf0450) 2 Height: 0 Size: 1 (0x1bf0480) 3 Height: 3 Size: 9 (0x1bf04b0) 4 Height: 0 Size: 1 (0x1bf04e0) 5 Height: 1 Size: 3 (0x1bf0510) 6 Height: 0 Size: 1 (0x1bf0540) 7 Height: 2 Size: 6 (0x1bf0570) 8 Height: 1 Size: 2 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- DELETE: root 2 Height: 0 Size: 1 (0x1bf0450) 3 Height: 1 Size: 3 (0x1bf04b0) 4 Height: 0 Size: 1 (0x1bf04e0) 5 Height: 3 Size: 8 (0x1bf0510) 6 Height: 0 Size: 1 (0x1bf0540) 7 Height: 2 Size: 4 (0x1bf0570) 8 Height: 1 Size: 2 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- 3 Height: 1 Size: 2 (0x1bf04b0) 4 Height: 0 Size: 1 (0x1bf04e0) 5 Height: 3 Size: 7 (0x1bf0510) 6 Height: 0 Size: 1 (0x1bf0540) 7 Height: 2 Size: 4 (0x1bf0570) 8 Height: 1 Size: 2 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- DELETE: root 4 Height: 0 Size: 1 (0x1bf04b0) 5 Height: 1 Size: 3 (0x1bf0510) 6 Height: 0 Size: 1 (0x1bf0540) 7 Height: 2 Size: 6 (0x1bf0570) 8 Height: 1 Size: 2 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- 5 Height: 1 Size: 2 (0x1bf0510) 6 Height: 0 Size: 1 (0x1bf0540) 7 Height: 2 Size: 5 (0x1bf0570) 8 Height: 1 Size: 2 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- DELETE: root 6 Height: 0 Size: 1 (0x1bf0510) 7 Height: 2 Size: 4 (0x1bf0570) 8 Height: 1 Size: 2 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- 7 Height: 0 Size: 1 (0x1bf0570) 8 Height: 1 Size: 3 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- 8 Height: 1 Size: 2 (0x1bf05a0) 9 Height: 0 Size: 1 (0x1bf05d0) --- DELETE: root 9 Height: 0 Size: 1 (0x1bf05a0) --- --- bash-4.3$ valgrind !! valgrind ./AVLtree ==31401== Memcheck, a memory error detector ==31401== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==31401== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==31401== Command: ./AVLtree ==31401== INSERT element: 0 0 Height: 0 Size: 1 (0x51fa480) --- INSERT element: 1 INSERT element: 1 0 Height: 1 Size: 2 (0x51fa480) 1 Height: 0 Size: 1 (0x51fa4e0) --- INSERT element: 2 INSERT element: 2 INSERT element: 2 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) --- INSERT element: 3 INSERT element: 3 INSERT element: 3 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 2 Size: 4 (0x51fa4e0) 2 Height: 1 Size: 2 (0x51fa540) 3 Height: 0 Size: 1 (0x51fa5a0) --- INSERT element: 4 INSERT element: 4 INSERT element: 4 INSERT element: 4 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 2 Size: 5 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 1 Size: 3 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) --- INSERT element: 5 INSERT element: 5 INSERT element: 5 INSERT element: 5 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 2 Size: 6 (0x51fa5a0) 4 Height: 1 Size: 2 (0x51fa600) 5 Height: 0 Size: 1 (0x51fa660) --- INSERT element: 6 INSERT element: 6 INSERT element: 6 INSERT element: 6 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 2 Size: 7 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 1 Size: 3 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) --- INSERT element: 7 INSERT element: 7 INSERT element: 7 INSERT element: 7 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 3 Size: 8 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 2 Size: 4 (0x51fa660) 6 Height: 1 Size: 2 (0x51fa6c0) 7 Height: 0 Size: 1 (0x51fa720) --- INSERT element: 8 INSERT element: 8 INSERT element: 8 INSERT element: 8 INSERT element: 8 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 3 Size: 9 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 2 Size: 5 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 1 Size: 3 (0x51fa720) 8 Height: 0 Size: 1 (0x51fa780) --- INSERT element: 9 INSERT element: 9 INSERT element: 9 INSERT element: 9 INSERT element: 9 0 Height: 0 Size: 1 (0x51fa480) 1 Height: 1 Size: 3 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 3 Size: 10 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 1 Size: 3 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 6 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 1 Height: 1 Size: 2 (0x51fa4e0) 2 Height: 0 Size: 1 (0x51fa540) 3 Height: 3 Size: 9 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 1 Size: 3 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 6 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- DELETE: root 2 Height: 0 Size: 1 (0x51fa4e0) 3 Height: 1 Size: 3 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 3 Size: 8 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 4 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 3 Height: 1 Size: 2 (0x51fa5a0) 4 Height: 0 Size: 1 (0x51fa600) 5 Height: 3 Size: 7 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 4 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- DELETE: root 4 Height: 0 Size: 1 (0x51fa5a0) 5 Height: 1 Size: 3 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 6 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 5 Height: 1 Size: 2 (0x51fa660) 6 Height: 0 Size: 1 (0x51fa6c0) 7 Height: 2 Size: 5 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- DELETE: root 6 Height: 0 Size: 1 (0x51fa660) 7 Height: 2 Size: 4 (0x51fa720) 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 7 Height: 0 Size: 1 (0x51fa720) 8 Height: 1 Size: 3 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- 8 Height: 1 Size: 2 (0x51fa780) 9 Height: 0 Size: 1 (0x51fa7e0) --- DELETE: root 9 Height: 0 Size: 1 (0x51fa780) --- --- ==31401== ==31401== HEAP SUMMARY: ==31401== in use at exit: 0 bytes in 0 blocks ==31401== total heap usage: 11 allocs, 11 frees, 1,344 bytes allocated ==31401== ==31401== All heap blocks were freed -- no leaks are possible ==31401== ==31401== For counts of detected and suppressed errors, rerun with: -v ==31401== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) bash-4.3$ ./AVLmain Usage: ./AVLmain [keys]+ bash-4.3$ !! a b c dd ee ff ./AVLmain a b c dd ee ff INSERT element: a strdup: 0x17e8450 a Height: 0 Size: 1 (0x17e8420) --- INSERT element: b INSERT element: b strdup: 0x17e84a0 a Height: 1 Size: 2 (0x17e8420) b Height: 0 Size: 1 (0x17e8470) --- INSERT element: c INSERT element: c INSERT element: c strdup: 0x17e84f0 a Height: 0 Size: 1 (0x17e8420) b Height: 1 Size: 3 (0x17e8470) c Height: 0 Size: 1 (0x17e84c0) --- INSERT element: dd INSERT element: dd INSERT element: dd strdup: 0x17e8540 a Height: 0 Size: 1 (0x17e8420) b Height: 2 Size: 4 (0x17e8470) c Height: 1 Size: 2 (0x17e84c0) dd Height: 0 Size: 1 (0x17e8510) --- INSERT element: ee INSERT element: ee INSERT element: ee INSERT element: ee strdup: 0x17e8590 a Height: 0 Size: 1 (0x17e8420) b Height: 2 Size: 5 (0x17e8470) c Height: 0 Size: 1 (0x17e84c0) dd Height: 1 Size: 3 (0x17e8510) ee Height: 0 Size: 1 (0x17e8560) --- INSERT element: ff INSERT element: ff INSERT element: ff INSERT element: ff strdup: 0x17e85e0 a Height: 0 Size: 1 (0x17e8420) b Height: 1 Size: 3 (0x17e8470) c Height: 0 Size: 1 (0x17e84c0) dd Height: 2 Size: 6 (0x17e8510) ee Height: 1 Size: 2 (0x17e8560) ff Height: 0 Size: 1 (0x17e85b0) --- ** check ranks treeRank(root, a) == 0 i == [1] treeUnrank(root, 0) == a argv[i] == [a] treeRank(root, b) == 1 i == [2] treeUnrank(root, 1) == b argv[i] == [b] treeRank(root, c) == 2 i == [3] treeUnrank(root, 2) == c argv[i] == [c] treeRank(root, dd) == 3 i == [4] treeUnrank(root, 3) == dd argv[i] == [dd] treeRank(root, ee) == 4 i == [5] treeUnrank(root, 4) == ee argv[i] == [ee] treeRank(root, ff) == 5 i == [6] treeUnrank(root, 5) == ff argv[i] == [ff] ** sanity check ** delete everyting b Height: 1 Size: 2 (0x17e8470) c Height: 0 Size: 1 (0x17e84c0) dd Height: 2 Size: 5 (0x17e8510) ee Height: 1 Size: 2 (0x17e8560) ff Height: 0 Size: 1 (0x17e85b0) --- DELETE: root c Height: 0 Size: 1 (0x17e8470) dd Height: 2 Size: 4 (0x17e8510) ee Height: 1 Size: 2 (0x17e8560) ff Height: 0 Size: 1 (0x17e85b0) --- dd Height: 0 Size: 1 (0x17e8510) ee Height: 1 Size: 3 (0x17e8560) ff Height: 0 Size: 1 (0x17e85b0) --- ee Height: 1 Size: 2 (0x17e8560) ff Height: 0 Size: 1 (0x17e85b0) --- DELETE: root ff Height: 0 Size: 1 (0x17e8560) --- --- ** sanity check ** destroy bash-4.3$ valgrind !! valgrind ./AVLmain a b c dd ee ff ==31405== Memcheck, a memory error detector ==31405== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==31405== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==31405== Command: ./AVLmain a b c dd ee ff ==31405== INSERT element: a strdup: 0x51fa4f0 a Height: 0 Size: 1 (0x51fa480) --- INSERT element: b INSERT element: b strdup: 0x51fa5b0 a Height: 1 Size: 2 (0x51fa480) b Height: 0 Size: 1 (0x51fa540) --- INSERT element: c INSERT element: c INSERT element: c strdup: 0x51fa670 a Height: 0 Size: 1 (0x51fa480) b Height: 1 Size: 3 (0x51fa540) c Height: 0 Size: 1 (0x51fa600) --- INSERT element: dd INSERT element: dd INSERT element: dd strdup: 0x51fa730 a Height: 0 Size: 1 (0x51fa480) b Height: 2 Size: 4 (0x51fa540) c Height: 1 Size: 2 (0x51fa600) dd Height: 0 Size: 1 (0x51fa6c0) --- INSERT element: ee INSERT element: ee INSERT element: ee INSERT element: ee strdup: 0x51fa7f0 a Height: 0 Size: 1 (0x51fa480) b Height: 2 Size: 5 (0x51fa540) c Height: 0 Size: 1 (0x51fa600) dd Height: 1 Size: 3 (0x51fa6c0) ee Height: 0 Size: 1 (0x51fa780) --- INSERT element: ff INSERT element: ff INSERT element: ff INSERT element: ff strdup: 0x51fa8b0 a Height: 0 Size: 1 (0x51fa480) b Height: 1 Size: 3 (0x51fa540) c Height: 0 Size: 1 (0x51fa600) dd Height: 2 Size: 6 (0x51fa6c0) ee Height: 1 Size: 2 (0x51fa780) ff Height: 0 Size: 1 (0x51fa840) --- ** check ranks treeRank(root, a) == 0 i == [1] treeUnrank(root, 0) == a argv[i] == [a] treeRank(root, b) == 1 i == [2] treeUnrank(root, 1) == b argv[i] == [b] treeRank(root, c) == 2 i == [3] treeUnrank(root, 2) == c argv[i] == [c] treeRank(root, dd) == 3 i == [4] treeUnrank(root, 3) == dd argv[i] == [dd] treeRank(root, ee) == 4 i == [5] treeUnrank(root, 4) == ee argv[i] == [ee] treeRank(root, ff) == 5 i == [6] treeUnrank(root, 5) == ff argv[i] == [ff] ** sanity check ** delete everyting b Height: 1 Size: 2 (0x51fa540) c Height: 0 Size: 1 (0x51fa600) dd Height: 2 Size: 5 (0x51fa6c0) ee Height: 1 Size: 2 (0x51fa780) ff Height: 0 Size: 1 (0x51fa840) --- DELETE: root c Height: 0 Size: 1 (0x51fa540) dd Height: 2 Size: 4 (0x51fa6c0) ee Height: 1 Size: 2 (0x51fa780) ff Height: 0 Size: 1 (0x51fa840) --- dd Height: 0 Size: 1 (0x51fa6c0) ee Height: 1 Size: 3 (0x51fa780) ff Height: 0 Size: 1 (0x51fa840) --- ee Height: 1 Size: 2 (0x51fa780) ff Height: 0 Size: 1 (0x51fa840) --- DELETE: root ff Height: 0 Size: 1 (0x51fa780) --- --- ** sanity check ** destroy ==31405== ==31405== HEAP SUMMARY: ==31405== in use at exit: 0 bytes in 0 blocks ==31405== total heap usage: 13 allocs, 13 frees, 1,279 bytes allocated ==31405== ==31405== All heap blocks were freed -- no leaks are possible ==31405== ==31405== For counts of detected and suppressed errors, rerun with: -v ==31405== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) bash-4.3$ ls AVLmain getLine lp0120.c lp0308.c queuetest.c AVLmain.c getLine.c lp0123 lp0327 queuetest.o AVLmain.h goodDoubler.c lp0123.c lp0327.c random AVLtree heap lp0125 lp0329 random.c AVLtree.c heap.c lp0125.c lp0329.c stacklist AVLtree.h heapsort lp0206 lp0403 stacklist.c AVLtree.o heapsort.c lp0206.c lp0403.c stacknotes AVLtree.output hi lp0208.c lp0403.c~ stack.py badDoubler.c hi.c lp0213 lp0405 struct btreeint hw6 lp0213.c lp0405.c struct2 btreeintargs lists lp0215 Makefile struct2.c btreeintargs.c lists2 lp0215.c mt struct3 btreeint.c lists2.c lp0220 mygetLine struct3.c examplehash lists.c lp0220.c mygetLine.c struct.c examplehash2 liststest lp0227 myString sumRange examplehash2.c liststest.c lp0227.c myString.c sumRange.c examplehash.c lookingAtPointers lp0301 myString.h tolower exhash lookingAtPointers.c lp0301.c printArgs tolower.c exhash2 lp0118 lp0306 printArgs.c exhash2.c lp0118.c lp0306.c __pycache__ exhash.c lp0120 lp0308 queuetest bash-4.3$ ./heap Usage: heap [numbers]+ bash-4.3$ ./heap 2 5 3 6 4 8 1 INSERT: 2, 4 HEAP: [1: 2/4] INSERT: 5, 25 HEAP: [1: 2/4] [2: 5/25] INSERT: 3, 9 HEAP: [1: 2/4] [2: 5/25] [3: 3/9] INSERT: 6, 36 HEAP: [1: 2/4] [2: 5/25] [3: 3/9] [4: 6/36] INSERT: 4, 16 Expanding heap size to 8 --HEAP: [1: 2/4] [2: 5/25] [3: 3/9] [4: 6/36] [5: 4/16] SWAP: 5 <=> 4 HEAP: [1: 2/4] [2: 4/16] [3: 3/9] [4: 6/36] [5: 5/25] INSERT: 8, 64 HEAP: [1: 2/4] [2: 4/16] [3: 3/9] [4: 6/36] [5: 5/25] [6: 8/64] INSERT: 1, 1 --HEAP: [1: 2/4] [2: 4/16] [3: 3/9] [4: 6/36] [5: 5/25] [6: 8/64] [7: 1/1] SWAP: 3 <=> 1 --HEAP: [1: 2/4] [2: 4/16] [3: 1/1] [4: 6/36] [5: 5/25] [6: 8/64] [7: 3/9] SWAP: 2 <=> 1 HEAP: [1: 1/1] [2: 4/16] [3: 2/4] [4: 6/36] [5: 5/25] [6: 8/64] [7: 3/9] bash-4.3$ valgrind !! valgrind ./heap 2 5 3 6 4 8 1 ==32510== Memcheck, a memory error detector ==32510== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==32510== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==32510== Command: ./heap 2 5 3 6 4 8 1 ==32510== INSERT: 2, 4 HEAP: [1: 2/4] INSERT: 5, 25 HEAP: [1: 2/4] [2: 5/25] INSERT: 3, 9 HEAP: [1: 2/4] [2: 5/25] [3: 3/9] ==32510== Invalid write of size 4 ==32510== at 0x400A68: insert (heap.c:74) ==32510== by 0x400D2E: main (heap.c:124) ==32510== Address 0x5503060 is 0 bytes after a block of size 32 alloc'd ==32510== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) ==32510== by 0x40092C: initheap (heap.c:48) ==32510== by 0x400CE2: main (heap.c:116) ==32510== ==32510== Invalid write of size 4 ==32510== at 0x400A81: insert (heap.c:75) ==32510== by 0x400D2E: main (heap.c:124) ==32510== Address 0x5503064 is 4 bytes after a block of size 32 alloc'd ==32510== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) ==32510== by 0x40092C: initheap (heap.c:48) ==32510== by 0x400CE2: main (heap.c:116) ==32510== ==32510== Invalid read of size 4 ==32510== at 0x400B36: insert (heap.c:77) ==32510== by 0x400D2E: main (heap.c:124) ==32510== Address 0x5503060 is 0 bytes after a block of size 32 alloc'd ==32510== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) ==32510== by 0x40092C: initheap (heap.c:48) ==32510== by 0x400CE2: main (heap.c:116) ==32510== ==32510== Invalid read of size 4 ==32510== at 0x400888: printHeap (heap.c:35) ==32510== by 0x400B49: insert (heap.c:85) ==32510== by 0x400D2E: main (heap.c:124) ==32510== Address 0x5503064 is 4 bytes after a block of size 32 alloc'd ==32510== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) ==32510== by 0x40092C: initheap (heap.c:48) ==32510== by 0x400CE2: main (heap.c:116) ==32510== ==32510== Invalid read of size 4 ==32510== at 0x40089F: printHeap (heap.c:35) ==32510== by 0x400B49: insert (heap.c:85) ==32510== by 0x400D2E: main (heap.c:124) ==32510== Address 0x5503060 is 0 bytes after a block of size 32 alloc'd ==32510== at 0x4C2BBAD: malloc (vg_replace_malloc.c:299) ==32510== by 0x40092C: initheap (heap.c:48) ==32510== by 0x400CE2: main (heap.c:116) ==32510== INSERT: 6, 36 HEAP: [1: 2/4] [2: 5/25] [3: 3/9] [4: 6/36] INSERT: 4, 16 Expanding heap size to 8 ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x518D3C7: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400AAD: insert (heap.c:79) ==32510== by 0x400D2E: main (heap.c:124) ==32510== ==32510== Use of uninitialised value of size 8 ==32510== at 0x5189CFB: _itoa_word (_itoa.c:179) ==32510== by 0x518E2E0: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400AAD: insert (heap.c:79) ==32510== by 0x400D2E: main (heap.c:124) ==32510== ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x5189D05: _itoa_word (_itoa.c:179) ==32510== by 0x518E2E0: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400AAD: insert (heap.c:79) ==32510== by 0x400D2E: main (heap.c:124) ==32510== ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x518E362: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400AAD: insert (heap.c:79) ==32510== by 0x400D2E: main (heap.c:124) ==32510== ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x518D494: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400AAD: insert (heap.c:79) ==32510== by 0x400D2E: main (heap.c:124) ==32510== ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x518D51E: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400AAD: insert (heap.c:79) ==32510== by 0x400D2E: main (heap.c:124) ==32510== --HEAP: [1: 2/4] [2: 5/25] [3: 3/9] [4: 0/0] [5: 4/16] SWAP: 5 <=> 4 ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x518D3C7: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400B49: insert (heap.c:85) ==32510== by 0x400D2E: main (heap.c:124) ==32510== ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x518E362: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400B49: insert (heap.c:85) ==32510== by 0x400D2E: main (heap.c:124) ==32510== ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x518D494: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400B49: insert (heap.c:85) ==32510== by 0x400D2E: main (heap.c:124) ==32510== ==32510== Conditional jump or move depends on uninitialised value(s) ==32510== at 0x518D51E: vfprintf (vfprintf.c:1631) ==32510== by 0x51949A8: printf (printf.c:33) ==32510== by 0x4008B4: printHeap (heap.c:35) ==32510== by 0x400B49: insert (heap.c:85) ==32510== by 0x400D2E: main (heap.c:124) ==32510== HEAP: [1: 2/4] [2: 4/16] [3: 3/9] [4: 0/0] [5: 5/25] INSERT: 8, 64 HEAP: [1: 2/4] [2: 4/16] [3: 3/9] [4: 0/0] [5: 5/25] [6: 8/64] INSERT: 1, 1 --HEAP: [1: 2/4] [2: 4/16] [3: 3/9] [4: 0/0] [5: 5/25] [6: 8/64] [7: 1/1] SWAP: 3 <=> 1 --HEAP: [1: 2/4] [2: 4/16] [3: 1/1] [4: 0/0] [5: 5/25] [6: 8/64] [7: 3/9] SWAP: 2 <=> 1 HEAP: [1: 1/1] [2: 4/16] [3: 2/4] [4: 0/0] [5: 5/25] [6: 8/64] [7: 3/9] ==32510== ==32510== HEAP SUMMARY: ==32510== in use at exit: 64 bytes in 1 blocks ==32510== total heap usage: 3 allocs, 2 frees, 1,120 bytes allocated ==32510== ==32510== LEAK SUMMARY: ==32510== definitely lost: 0 bytes in 0 blocks ==32510== indirectly lost: 0 bytes in 0 blocks ==32510== possibly lost: 0 bytes in 0 blocks ==32510== still reachable: 64 bytes in 1 blocks ==32510== suppressed: 0 bytes in 0 blocks ==32510== Rerun with --leak-check=full to see details of leaked memory ==32510== ==32510== For counts of detected and suppressed errors, rerun with: -v ==32510== Use --track-origins=yes to see where uninitialised values come from ==32510== ERROR SUMMARY: 77 errors from 15 contexts (suppressed: 0 from 0) bash-4.3$ ./heap 2 5 3 -4 -4 INSERT: 2, 4 HEAP: [1: 2/4] INSERT: 5, 25 HEAP: [1: 2/4] [2: 5/25] INSERT: 3, 9 HEAP: [1: 2/4] [2: 5/25] [3: 3/9] DELETEMIN: --HEAP: [1: 3/9] [2: 5/25] HEAP: [1: 3/9] [2: 5/25] DELETEMIN: HEAP: [1: 5/25] bash-4.3$ !! -5 -5 ./heap 2 5 3 -4 -4 -5 -5 INSERT: 2, 4 HEAP: [1: 2/4] INSERT: 5, 25 HEAP: [1: 2/4] [2: 5/25] INSERT: 3, 9 HEAP: [1: 2/4] [2: 5/25] [3: 3/9] DELETEMIN: --HEAP: [1: 3/9] [2: 5/25] HEAP: [1: 3/9] [2: 5/25] DELETEMIN: HEAP: [1: 5/25] DELETEMIN: HEAP: deletemin not allowed on empty heap DELETEMIN: bash-4.3$ valgrind !! valgrind ./heap 2 5 3 -4 -4 -5 -5 ==32565== Memcheck, a memory error detector ==32565== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==32565== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==32565== Command: ./heap 2 5 3 -4 -4 -5 -5 ==32565== INSERT: 2, 4 HEAP: [1: 2/4] INSERT: 5, 25 HEAP: [1: 2/4] [2: 5/25] INSERT: 3, 9 HEAP: [1: 2/4] [2: 5/25] [3: 3/9] DELETEMIN: --HEAP: [1: 3/9] [2: 5/25] HEAP: [1: 3/9] [2: 5/25] DELETEMIN: HEAP: [1: 5/25] DELETEMIN: HEAP: deletemin not allowed on empty heap DELETEMIN: ==32565== ==32565== HEAP SUMMARY: ==32565== in use at exit: 32 bytes in 1 blocks ==32565== total heap usage: 2 allocs, 1 frees, 1,056 bytes allocated ==32565== ==32565== LEAK SUMMARY: ==32565== definitely lost: 0 bytes in 0 blocks ==32565== indirectly lost: 0 bytes in 0 blocks ==32565== possibly lost: 0 bytes in 0 blocks ==32565== still reachable: 32 bytes in 1 blocks ==32565== suppressed: 0 bytes in 0 blocks ==32565== Rerun with --leak-check=full to see details of leaked memory ==32565== ==32565== For counts of detected and suppressed errors, rerun with: -v ==32565== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) bash-4.3$ exit Process shell exited abnormally with code 1