12 lines
948 B
Go
Raw Normal View History

2020-08-23 14:15:53 +00:00
//
// Copyright 2020 FoxyUtils ehf. All rights reserved.
//
// This is a commercial product and requires a license to operate.
// A trial license can be obtained at https://unidoc.io
//
// DO NOT EDIT: generated by unitwist Go source code obfuscator.
//
// Use of this source code is governed by the UniDoc End User License Agreement
// terms that can be accessed at https://unidoc.io/eula/
2020-12-17 22:07:08 +00:00
package mergesort ;func MergeSort (array []float64 )[]float64 {if len (array )<=1{_f :=make ([]float64 ,len (array ));copy (_f ,array );return _f ;};_gc :=len (array )/2;_c :=MergeSort (array [:_gc ]);_cc :=MergeSort (array [_gc :]);_d :=make ([]float64 ,len (array ));_dd :=0;_fg :=0;_fb :=0;for _fg < len (_c )&&_fb < len (_cc ){if _c [_fg ]<=_cc [_fb ]{_d [_dd ]=_c [_fg ];_fg ++;}else {_d [_dd ]=_cc [_fb ];_fb ++;};_dd ++;};for _fg < len (_c ){_d [_dd ]=_c [_fg ];_fg ++;_dd ++;};for _fb < len (_cc ){_d [_dd ]=_cc [_fb ];_fb ++;_dd ++;};return _d ;};