C program to find second smallest element in a one dimensional array
Write a C program to find the second smallest element in a one dimensional array.
Example: Type1: (all the elements are not same & no of element is more than two)
Input:
Array size: 4
Elements: 32 54 -6 -15
Output:
-6
Example: Type2: (second minimum doesn’t exist as size of array < 2)
Input:
Array size : 1
Elements: 4
Output:
no second minimum
Example: Type3: (all elements are same, thus only one minimum element)
Input:
Array size : 4
Elements: 3 3 3 3
Output:
no second minimum
Algorithm:
Only one minimum value exists, print "No second minimum value exists"
Else
Print sec_min
C implementation to to find second smallest element in a one dimensional array
Output
need an explanation for this answer? contact us directly to get an explanation for this answer