Description
I would like to contribute implementation of a program that finds the second minimum and second maximum elements in an array. This feature can be valuable for users who need to quickly identify these elements in a dataset.
Proposed Solution
I plan to create a Java program within the math folder that includes methods to find the second minimum and second maximum elements in an array. These methods will be designed to handle various data types and edge cases efficiently.
Issue details
Algorithms( Providing example for 2nd Minimum Element )
More Efficient
- Iterate each element
- Find the minimum element , by updating the second minimum element
- Also checking the 2nd minimum element when it occurs after the minimum element
Hoping this is the most optimal solution to find the 2nd minimum element as it finds in O(n) time complexity also with constant space
Efficient
- Find the most minimum element in the array
- Iterating another time to get the second minimum element
Less Efficient
- Sorting and returning the 1nd index for 2nd minimum element
Additional Information
- This contribution aligns with the project's goal of providing essential data structures and algorithms in Java.
- I will follow the project's coding conventions and style guidelines during implementation.
- If this proposal is approved, I will create a branch and submit a pull request to incorporate this functionality into the project.
Environment:
- Java version : open-jdk version 19.0.2
- IDE : NVIM v0.9.0-dev
Description
I would like to contribute implementation of a program that finds the second minimum and second maximum elements in an array. This feature can be valuable for users who need to quickly identify these elements in a dataset.
Proposed Solution
I plan to create a Java program within the math folder that includes methods to find the second minimum and second maximum elements in an array. These methods will be designed to handle various data types and edge cases efficiently.
Issue details
Algorithms( Providing example for 2nd Minimum Element )
More Efficient
Hoping this is the most optimal solution to find the 2nd minimum element as it finds in O(n) time complexity also with constant space
Efficient
Less Efficient
Additional Information
Environment: