12 lines
947 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/
2021-07-30 17:03:26 +00:00
package mergesort ;func MergeSort (array []float64 )[]float64 {if len (array )<=1{_a :=make ([]float64 ,len (array ));copy (_a ,array );return _a ;};_f :=len (array )/2;_bb :=MergeSort (array [:_f ]);_bbf :=MergeSort (array [_f :]);_fe :=make ([]float64 ,len (array ));_d :=0;_e :=0;_dd :=0;for _e < len (_bb )&&_dd < len (_bbf ){if _bb [_e ]<=_bbf [_dd ]{_fe [_d ]=_bb [_e ];_e ++;}else {_fe [_d ]=_bbf [_dd ];_dd ++;};_d ++;};for _e < len (_bb ){_fe [_d ]=_bb [_e ];_e ++;_d ++;};for _dd < len (_bbf ){_fe [_d ]=_bbf [_dd ];_dd ++;_d ++;};return _fe ;};