Fixed: corrected a wrong code and also added a new code for prevSmallerElement
The code inside the file "NextSmallerElement.java" inside stacks folder is wrong. The code which is currently written in it is for finding the previous smaller element that is smaller element at left instead of smaller element at right which is wrong as we have to find the next smaller element , so I corrected the code to actually find the next smaller element.
Also I added a correct code to find the previous smaller element of the current element in the array that is smaller element on the left of the current element.
- [x] I have read CONTRIBUTING.md.
- [x] This pull request is all my own work -- I have not plagiarized it.
- [x] All filenames are in PascalCase.
- [x] All functions and variable names follow Java naming conventions.
- [x] All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
@BamaCharanChhandogi @debasishbsws please check
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution!
Please reopen this pull request once you have made the required changes. If you need help, feel free to ask in our Discord server or ping one of the maintainers here. Thank you for your contribution!