sorting - Some questions about data structures and sort algorithm -


I am learning about data structures and sort algorithms and I have questions that I want to ask:

  1. When we select the array and when we select the linked list for the sort algorithm
  2. what type of algorithm should we use for small data and for larger data what should be done? I know that depending on the situation, we should select the available algorithms, but I can not understand the features.

    linked list array array is more general option .

    Most of the linked lists are used when your data is already in a linked list, or you need it in the linked list for your application.

    It is not that I have actually seen the proper reason for using one on each other (except that most sorting algorithms are centered around the array). Both can be sorted in (n log n), with the least comparison-based sorting algorithm.

    Who to use

    Comparison-based sorting, usually & lt; ~ 10-20 element, because it has less stable factors, even if it's time to run O (NA2). For more elements, or (both are running in O log (N log)) or some derivatives are either generally fast (although other O (n log n) are sorted algorithms).

    The insertion sort also does well ( O (n) ) on almost sorted data.

    For non-comparison-based sorting, it really depends on your data. Radix sort, bucket sort and count sort are all well-known examples, and each has their respective uses. You should take a good look at your running time and you should take good care of when they should be used. Sorting, for example, is good if solving the range of values ​​is really small.

    You can look for a list of sorting algorithms.

    Keep in mind that sorting will be faster with any of these sorting algorithms compared to less than 10,000 elements - unless you absolutely need the best performance, whatever you really want You can choose.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -