CSCI 230 | Data Structures and Algorithms | Fall 1998 |
Solution Files:
buffer.cpp
buffer.h
main.cpp
sorted_buffer.cpp
sorted_buffer.h
test_sorted.cpp
There are two bugs in the sorted_buffer implementation code. The sorted_buffer::decrement function needs to be pass by reference (we are emphasizing this particular bug so much because it is a very common error in the projects), and the sorted_buffer::add function has a tricky bug in the following line:
if (buf[i] < x)should be:
if (buf[j] < x)