Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Min Max Functions in Array #33

Closed
wants to merge 2 commits into from
Closed

Conversation

Aditi-Anil-P
Copy link
Contributor

Summary

  • I have added the Min Max Functions for an Array in C++, Java and Python.
  • As per the suggestion the functions return the corresponding indexes of the minimum and maximum elements in the array.
  • The function returns the indexes in a vector/ list/ ArrayList format covering the edge case of multiple maximum and minimum values in the array.

Complexity
Time Complexity - 0(N)
Space Complexity-0(N) (in worst case scenario if all the elements of the array are equal)

The following issue can be solved in O(1) time complexity if a single index has to be returned.

@imsuraj675
Copy link
Owner

Don't return a vector. Just return the first index of the maximum/minimum element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants