The body of the inner loop is executed n
times.
The body of the outer loop is executed for all powers of 2 from 1 to n and there are about log2(n) of them, hence the global complexity
O(n.log(n))
More Related Contents:
- What is the fastest search algorithm for a list with names and numbers
- O(3^n) exponential time complexity [closed]
- Java lambdas 20 times slower than anonymous classes
- What would be the fastest method to test for primality in Java?
- What is the time complexity of HashMap.containsKey() in java?
- Hash Set and Array List performances
- Time complexity of System.arraycopy(…)?
- Random Number Algorithm – Implementation in Java
- Write a program that takes an array/arraylist of integer and finds longest sub array/arraylist whose entries are equal [closed]
- How to check if an integer is in a set of given ranges? [closed]
- What is Difference between Static Variable and Static method and Static Class? [duplicate]
- Permutation of array
- Generate all combinations from multiple lists
- Efficient swapping of elements of an array in Java
- Take n random elements from a List?
- Why is adding an OnClickListener inside onBindViewHolder of a RecyclerView.Adapter considered bad practice?
- Time complexity of Java’s substring()
- java indexof(String str) method complexity [duplicate]
- A better algorithm to find the next palindrome of a number string
- Anagram algorithm in java
- Most efficient way of converting String to Integer in java
- Java thread creation overhead
- How to speed up Java VM (JVM) startup time?
- implementing debounce in Java
- How do I get the intersection between two arrays as a new array?
- How to find the only number in an array that doesn’t occur twice [duplicate]
- ‘MergeSort Algorithm’ – What’s the better implementation in JAVA? [closed]
- What GC parameters is a JVM running with?
- Finding the shortest path nodes with breadth first search
- Mergesort in java