Home > Software engineering >  How can I improve this sorting algorithm?
How can I improve this sorting algorithm?

Time:01-13

What I need:

I often need to rearrange multidimensional arrays, especially with timestamps. For that I need a routine, that results in a permanent sort order. Since the data can be huge, it has to be performant as possible.

I would like to have some feedback to my current efforts. I'm trying to understand sorting arrays practical. I'm not a programmer, if possible be patient. :)

I'll appreciate every help/tips! I'm going to learn some new things maybe.

What my efforts are so far:

For the beginning I took the bubble sort algorithm. It does what is needed, BUT its performance is very low. It needs more than 20 seconds for sorting a column within 582 rows and 114 columns.

The code works with single- and multi-column-arrays. I use regular expressions, so keep in mind the little function a the end of the code.

I've commented my code step by step, I hope its still readable.

I know QuickSort would be much faster, but I haven't understand to make this algorithm permanent/stable yet. I've found this solution enter image description here

As you see, you can check the "Data" ribbon, "Filter&Sort" choice, and off you go.

  •  Tags:  
  • Related