ani03sha / Algorithms

This repository contains implementations of common data structures and algorithms
Apache License 2.0
2 stars 1 forks source link

CLL remove edge case #46

Closed vaibhav26sharma closed 3 years ago

vaibhav26sharma commented 3 years ago

The method remove() in CLL https://github.com/ani03sha/Algorithms/blob/develop/src/main/java/org/redquark/algorithms/datastructures/lists/CircularLinkedList.java#L112 , doesn't handle the edge case where the element to be removed is the tail itself.

In that case there needs to be an additional check and the tail reference needs to be updated to the last second element.