interview-corner
interview-corner copied to clipboard
One Dimensional Array -> First Missing Integer : Add C++ optimisation; and fix some bugs
Hello @Abhijit2505 ! I am Samrendra, a Participant of SWOC'21. I have found a few issues on the page - First Missing Integer in the section One Dimensional Array and would like to work on them. Link to the page - https://abhijit2505.github.io/Algorithmic-Treasure-Site/Pages/Array/firstMissingInt.html
Following are the issues:
1. The current C++ code sorts the vector using stl::sort(); this has an amortized time complexity of O(nlogn), but the given algorithm is wrongly marked as an O(n) time complexity. This needs to be corrected.
2. The current C++ code can be further optimised to reach the required O(n) time and O(1) space complexity by using swapping of elements. I would like to provide that code too.
3. There is no explanation of test cases provided. I would like to provide explained sample input and sample output.
Please assign this issue to me, would like to work on them.
@SamrendraS please get started
@Abhijit2505 Please accept PR 71 https://github.com/Abhijit2505/Algorithmic-Treasure-Original/pull/71