A
A
Andrey Kubishenko2019-06-02 08:27:03
Algorithms
Andrey Kubishenko, 2019-06-02 08:27:03

Which sorting algorithm sorts an array with O(n * (N)) time complexity?

Recently I came across a task (on js). The bottom line is that you need to create a sort() function , with a time complexity of O(n * (N)) . Since I am far from algorithmic structures and other things related to algorithms, this put me in a stupor. So I ask you to explain the algorithm for solving this problem. And also I ask you to throw off some materials where you can learn about the time complexity of the algorithms, I myself did not find normal ones.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Luke LikeSkywalker, 2019-06-02
@simply-web

bubble sort. Any algorithm of complexity O(n^2)
Read the book Grokkay Algorithms. There is about Big(O) time complexity

T
tsarevfs, 2019-06-02
@tsarevfs

Judging by the different letters n and N, counting sort is meant. Its running time depends on the size of the array n and the number of possible values ​​in the array N. So, for example, if we want to sort an array consisting of numbers from 1 to 10, then we can do it in linear time.
Kormen "Algorithms: construction and analysis" is suitable as a reference.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question