About 2,340,000 results
Open links in new tab
  1. Find the Largest Element in an Array (Brute Force & Optimal …

    May 8, 2025 · Learn how to find the largest element in an array with both brute force and optimal solutions. Includes step-by-step images, code, and complexity analysis.

  2. Finding maximum element in an array - Stack Overflow

    Jun 25, 2015 · Finding the maximum element in an unsorted array will require the brute-force approach. There are ways of minimizing the complexity of this operation by using data …

  3. 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 …

  4. Min and Max element in array - OpenGenus IQ

    Approach-1: Using Brute force; Approach-2: Using Divide and Conquer; Conclusion; Let's understand the Problem. Given an array a[] of size 'n', we need to find the minimum and …

  5. 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[] …

  6. Finding the Largest Element in an Array: Brute Force vs

    Feb 1, 2024 · The brute-force approach involves sorting the array and then accessing the last element, as it will be the largest one. Here’s a simple implementation in Python: def...

  7. Brute Force Algorithms: The Art of Trying Everything

    Finding the maximum element in an array can be done by checking each element one by one. It’s like searching for the biggest slice of cake at a party! function findMax(arr) { let max = arr[0]; …

  8. Example: Finding the Maximum and Minimum Element in an array a. What does this algorithm compute? b. Considering the basic operation as ―A[i] < minval and A[i] > maxval‖ , find out …

  9. 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 …

  10. Kth Largest Element in an Array - Leetcode Solution

    Why the Brute-Force Solution is Inefficient. The brute-force solution sorts the entire array, leading to: Time Complexity: O(n log n), where n is the length of the array, due to the sorting …

  11. Some results have been removed