At the beginning of the week, I had a somewhat shaky implementation of the desired algorithm. It compiled, ran, and ultimately
did what it was supposed to, but it was highly inefficient, not clean, and generally cobbled together with whatever would make it work.
The implementation begins with a circularly linked list. Each node in the list is numbered.
For example, if the list contained one element with a value of "10", the list would appear
as 0->10->0, with 0 being the base. If an insertion occurs before the 10, there is plenty of
space and the node will be placed in the center. Thus, the list would appear 0->5->10->0. However,
when no space is available between nodes, a sublist will be renumbered to make room. For example, if we have the list
0->5->6->10->, there is no space for an insertion between 5 and 6. Thus, the list, starting with 5, will need to be renumbered. Ultimately,
we want a distance of at least 10 units between each tag, so the list would become 0->5->15->25->0. Alternately, if the list had been 0->5->6->100->0, only the 6 would need to be renumbered.
The list would then appear as 0->5->47->100->0.
I experienced some problems with handling elements inserted at the very end of the list and some problems occurred with the assigned numbers.
It was great having the other people in the lab at this point. I had some unforeseen bugs in my code, and I was getting rather frustrated with the
algorithm and with my implementation. I met with my mentor in a group once a week, where we talked about our progress. It was sometimes difficult to schedule
one-on-one time, though, and ultimately, I was a little uncertain about whether or not my implementation was correct. A couple of the other students were
experiencing similar concerns, and we would bounce ideas off each other in the lab and over lunch.
|