c语言 一维数组折半查找法
Problem statement: Write a C program to find two smallest elements in a one dimensional array.
问题陈述:编写一个C程序以在一维数组中找到两个最小的元素。
Example: Type1: (all the elements are not same & no of element is more than two)
示例:Type1 :(所有元素都不相同且元素不超过两个)
Array size: 4
Elements: 32 54 -6 43
Output: -6 32
Example: Type2: (second minimum doesn’t exist as size of array < 2)
示例:Type2 :(由于数组的大小<2,第二个最小值不存在)
Array size : 1
Elements: 4
Output: 4
Example: Type3: (all elements are same, thus only one smallest element)
示例:Type3 :(所有元素都相同,因此只有一个最小元素)