-2
prod=1;
Nfour= sqrt(n) * sqrt(n);
    For k=1 to Nfour do
        If K mod sqrt(n)=0 then
            for j=1 to k do
                if j mod sqrt(n)=0 then
                    for m=1 to j do
                        prod=prod *4

How can I calculate time complexity of this algorithm?

Keldorn
  • 1,980
  • 15
  • 25
Nidal
  • 1
  • 1

1 Answers1

0

By looking at the above code we have 3 nested for loops which will take n^3 complexity as they are nested and remaining operations take constant time.

This resource might be helpful - 1- http://bigocheatsheet.com/ 2- How to find time complexity of an algorithm

Ashish Shah
  • 1,047
  • 7
  • 17