Description
In the Stack folder, there is a program named "nextSmaller.java" but actually the code written inside it is of previous smaller element . To find the next smaller element, we need to find the first element smaller than the current element present at its right but the code actually was finding the previous smaller element as it is looking for smaller element on the left .
so that's why the name of the file is wrong and it should be "prevSmaller.java".
So I am correcting this bug
also I am pulling a request for adding a new code in the Stack folder for finding next smaller element of the current element in an array, that is the first element greater than the current element present at its right.
Steps to reproduce
- Go to src Folder
- Go to [main/java/com/thealgorithms]
- Go to Stacks Folder
- The title of file "NextSmallerElement.java" is wrong as the code inside it is for finding previous smaller element
Excepted behavior
correct name of the file should be "prevSmaller.java"
Screenshots
No response
Additional context
No response