The two Pointer algorithm is quite popular technique. Although the idea is straightforward, Its implementation is prone to bugs. Few such bugs includes:
- Index out of range error leading to SEGSEV
- Never ending while loops leading to SIGKILL
How to write in a way such that there is less chances of bugs?
This blog is a sister blog of Binary Search Elegant Implementation. Your thoughts and implementations are valuable to community, hence welcome.
Thanks. Have a great time ahead!