In the delete_ith method of the LinkedList<T> implementation, there are two logic errors:
Bounds check allows index == length
if self.length < index {
panic!("Index out of bounds");
}
This only panics when index > length, but permits index == length. The valid index range is 0..length, so any index >= length should panic.
Tail-deletion condition is off by one
if self.length == index {
return self.delete_tail();
}
To delete the last element, the correct condition is index == length - 1, not index == length.