Skip to content

COSC3020/cosc3020-spring2025-recurrence-analysis-recurrence-analysis-mystery

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Recurrence Analysis -- Mystery Function

Analyze the running time of the following recursive procedure as a function of $n$ and find a tight big $O$ bound on the runtime for the function. You may assume that each operation takes unit time. You do not need to provide a formal proof, but you should show your work: at a minimum, show the recurrence relation you derive for the runtime of the code, and then how you solved the recurrence relation.

function mystery(n) {
    if(n <= 1)
        return;
    else {
        mystery(n / 3);
        var count = 0;
        mystery(n / 3);
        for(var i = 0; i < n*n; i++) {
            for(var j = 0; j < n; j++) {
                for(var k = 0; k < n*n; k++) {
                    count = count + 1;
                }
            }
        }
        mystery(n / 3);
    }
}

Add your answer to this markdown file. This page might help with the notation for mathematical expressions.

About

cosc3020-spring2025-recurrence-analysis-recurrence-analysis-mystery created by GitHub Classroom

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published