12 lines
935 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-11-09 01:00:18 +00:00
package mergesort ;func MergeSort (array []float64 )[]float64 {if len (array )<=1{_d :=make ([]float64 ,len (array ));copy (_d ,array );return _d ;};_g :=len (array )/2;_ge :=MergeSort (array [:_g ]);_e :=MergeSort (array [_g :]);_gb :=make ([]float64 ,len (array ));_c :=0;_f :=0;_cb :=0;for _f < len (_ge )&&_cb < len (_e ){if _ge [_f ]<=_e [_cb ]{_gb [_c ]=_ge [_f ];_f ++;}else {_gb [_c ]=_e [_cb ];_cb ++;};_c ++;};for _f < len (_ge ){_gb [_c ]=_ge [_f ];_f ++;_c ++;};for _cb < len (_e ){_gb [_c ]=_e [_cb ];_cb ++;_c ++;};return _gb ;};