Two points & array de-weight
<script type= "Text/javascript" >var arr = [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 5, 5, 6, 7, 8, 9, 0, 0, 3, 4, 5];//create arrays Func tion Findinarr (arr,n) {//judgment array loops through each item, if each item of this array is equal to each item of r[I] returns true, otherwise returns falsefor (var i = 0; i < arr.length; i++) {if ( Arr[i] = = N) return true; return false;} function Removedup (arr, S, e) {//First judge the starting number greater than the number at the end, if the starting number is greater than the end of the number return Flaseif (S > E) {return false;} else if (s = = e) {//If two numbers are equal, return this array to return [Arr[s]];} var C = Math.floor ((s + e)/2);//Take out the middle number for two cents var L = removedup (arr, S, c);//Start position to the middle of the previous section var r = Removedup (arr, C + 1, e);//from which The second paragraph to the end number for (var i = 0; i < r.length; i++) {if (!findinarr (L,r[i])) {L.push (r[i]);}} return l;} Console.log (Removedup (arr, 0, arr.length-1));</script>
Dichotomy & min value
<script type= "Text/javascript" >var arr = [12,24,2455,5645,993,18,355,325,4478,221,3652,3,55,15,54];// Create Number group function Findmin (arr,s,e) {if (S > E) {return false;} else if (s = = e) {return arr[s];} var C = Math.floor ((s + e)/2), var L = findmin (arr, S, c), var r = findmin (arr, C + 1, e); if (L < r) {return L;} Else{return R;}} Console.log (Findmin (arr, 0,arr.length-1));</script>
The array de-weight and find the minimum value of the dichotomy method