For the smallest number of rotated arrays, enter a rotation of an incrementally sorted array, output its smallest element # include <stdio.h> #include <string.h>int find_min (int arr[],int Len) {int i = 0;for (i = 1; i < Len; i++) {if (Arr[i] < arr[0]) return arr[i];} return arr[0];} int main () {int I;int arr1[] = {1, 2, 3, 4, 5};int arr2[] = {2, 2, 3, 4, 5};int arr3[] = {4, 5, 1, 2, 3}; printf ("arr1 minimum element is \ n", Find_min (arr1,sizeof (arr1)/sizeof (arr1[0])); printf ("arr2 minimum element is \ n", Find_min (arr2,sizeof (ARR2)/sizeof (arr2[0])); printf ("ARR3 minimum element is \ n", Find_min (arr3,sizeof (ARR3)/sizeof (arr3[0])); return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The "C language" asks for the smallest number of rotated arrays, enters a rotation of an incrementally sorted array, and outputs its smallest element