Since implementation of bootstrap needs a sorting routine, I wrote a rough and ready f90 code for mergesort (this uses a bubble sort for small subarrays of length less than magic). As you know, Mergesort has complexity O(n log n). A code for checking whether a list is sorted has complexity O(n). This version of the code uses an external routine for swapping two elements of the array; inlining this does not change execution times appreciably.
© Sourendu Gupta. Last modified on 19 Oct, 2017 Code linked from this page is supplied without warranty under the GNU General Public License.