edited by
591 views
1 votes
1 votes
What is the time complexity to divide an array of elements N into $Log N$  parts ? plz explain ?
edited by

2 Answers

0 votes
0 votes
The answer would be nloglogn

As we have seen when array of size N is divided into k arrays having size n then time complexity becomes O(nklogk)

Now we can replace values according to our given question which will results to O(NloglogN)
0 votes
0 votes

Each division will take O(1) time. In first stage there is only 1 division, next stage there are 2 divisions, then 4 then 8 and so on. In last stage we need loglogN divisions.

We can write each division size of last stage N/logN = N/(2loglogN).

So we get series like 1+21+22+23+24+....+loglogN ( loglogN = 2logloglogN ) . Now by solving the G.P series we get O(loglogN).

Related questions


Deprecated: Implicit conversion from float-string "1709778812.845" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1709778812.845" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1709778812.845" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1709778812.845" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1535002151.770" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1535002151.770" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1535002151.770" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1535002151.770" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1533180628.297" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1533180628.297" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1533180628.297" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1533180628.297" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803
157
views
1 answers
0 votes
Mrityudoot asked Mar 7
157 views
For flag based approach in Bubble sort we can check first by a flag if the list is sorted or not in O(n), and if it is sorted, then no need to sort and the operation ends...
648
views
2 answers
0 votes
_Madhuri asked Oct 9, 2021
648 views
The complexity of comparison based sorting algorithm is (nlogn) .How?
531
views
0 answers
0 votes
852
views
2 answers
1 votes
Ravi Dubey asked Aug 2, 2018
852 views
Could a binary search tree be built using o(n lg n) comparisons in the comparisonmodel? Explain why or why not.
Total PHP MySQL Other RAM
Time (ms) % Time (ms) % File count Time (ms) % Query count Time (ms) % Amount %
Setup 4.4 6% 3.0 4% 72 1.6 2% 2 0.0 0% 569k 47%
Control 14.2 19% 2.0 2% 5 12.7 17% 12 0.0 0% 222k 18%
View 1.7 2% 1.7 2% 12 0.0 0% 0 0.0 0% 114k 9%
Theme 46.1 63% 4.7 6% 15 41.4 57% 3 0.0 0% 280k 23%
Stats 6.3 8% 0.1 0% 0 6.3 8% 1 0.0 0% 0k 0%
Total 72.7 100% 11.4 15% 104 62.1 85% 18 0.0 0% 1188k 100%