One Pager Cheat Sheet
- We will learn to find the
maximum
andminimum
values in an array usingbuilt-in methods
,linear search
,divide and conquer
and asingle-loop trick
in various languages. - Using the
built-in methods
ofPython
,JavaScript
, andJava
, we can easily determine the minimum and maximum value in an array. - Python has two built-in functions,
min()
andmax()
, to find the minimum and maximum value in an array, respectively. - The Linear Search Method traverses an array from the second element to find the
maximum
andminimum
values, which can be implemented using the Pseudocode provided and other languages to obtain the desired result. - The
Linear Search
algorithm's maximum and minimum values must be initialized to the first element of the array, as it traverses through the array from the beginning to find the maximum and minimum values. - The Divide and Conquer method can be used to find the minimum and maximum value of an array by recursively splitting it into two parts and comparing their results.
- The Divide and Conquer method
divides
the array into two parts of varying sizes, eventually resulting in the determination of the overallminimum
andmaximum
values. - We can find the minimum and maximum values of an array using the Comparison in Pairs method which involves initializing the
minimum
andmaximum
values based on the size of the array and then traversing the array in pairs within a single loop. - The maximum and minimum value of the array is
initialized
toinput[0]
, thefirst element
, when the array size is odd. - We concluded the tutorial by learning the
Built-in
,Linear Search
,Divide and Conquer
, andComparison in Pairs
methods for finding minimum and maximum values in an array and implementing these methods inPython
,JavaScript
andJava
.