
Largest element in an Array - GeeksforGeeks
Dec 27, 2024 · Given an array arr. The task is to find the largest element in the given array. Examples: Explanation: Among 10, 20 and 4, 20 is the largest. The approach to solve this …
Finding the first n largest elements in an array
Jan 19, 2017 · Find the kth biggest element, using selection algorithm. Next, iterate the array and find all elements which are larger/equal it. complexity: O (n) for selection and O (n) for …
Find Maximum and Minimum Element in an Array
Given an array X[] of size n, we need to find the maximum and minimum elements present in the array. Our algorithm should make the minimum number of comparisons. Examples. Input: X[] …
C Exercises: Find the maximum and minimum element in an array
Mar 18, 2025 · The task involves writing a C program to find and display the maximum and minimum elements in an array. The program will take a specified number of integer inputs, …
Recursive Programs to find Minimum and Maximum elements of array
Sep 19, 2023 · Given an array A[] of N integers and two integers X and Y (X ≤ Y), the task is to find the maximum possible value of the minimum element in an array A[] of N integers by …
Max-Min Problem - CodeCrucks
Sep 30, 2021 · Max-Min problem is to find a maximum and minimum element from the given array. We can effectively solve it using divide and conquer approach. In the traditional …
Write an algorithm to find minimum and maximum value using …
Maximum and Minimum: Let us consider simple problem that can be solved by the divide-and conquer technique. The problem is to find the maximum and minimum value in a set of ‘n’ …
C program to find maximum and minimum elements in array
Apr 15, 2016 · Before writing our main logic, let us first define a recursive function to find maximum element in an array. int maximum(int array[], int index, int N); For this recursive …
algorithm - What is the best way to get the minimum or maximum …
Jan 8, 2009 · If you are building the array once and want to find the maximum just once, iterating is the best you can do. When you want to modify the array and occasionally want to know the …
Maximum and minimum of an array using minimum number of comparisons
Sep 14, 2024 · Given an array of size N. The task is to find the maximum and the minimum element of the array using the minimum number of comparisons. Examples: Input: arr[] = {3, 5, …