-
In a low-level language like C, we can use pointers to
create a circular data structure directly.
- Pros: searching for the next suicide costs
Ο(m); deleting a suicide costs Ο(1).
- Cons: danger of seg faults.
-
The same pointer manipulation can be done more safely in a
higher level language like Lisp via (rplacd ...) or
(setf (cdr ...) ..).
- Pros: Ο(m) search; Ο(1) deletion.
- Cons: no seg faults, but tricky pointer manipulation.
-
In any language, we can use arrays and modular arithmetic.
- Pros: no pointer manipulation.
- Cons: search cost is higher, due either to the need to
shift rebels to close gaps, or the need to mark dead
rebels and skip over them.
-
Best solution: use an existing, debugged circular data
structure module!