There you go. This is probably the most trivial example of a function that runs in O(n!)
time (where n
is the argument to the function):
void nFacRuntimeFunc(int n) {
for(int i=0; i<n; i++) {
nFacRuntimeFunc(n-1);
}
}
More Related Contents:
- Fast algorithm to calculate n! / (q!)^r
- Deciding a Big-O notation for an algorithm
- O(3^n) exponential time complexity [closed]
- How to merge two sorted arrays into a sorted array? [closed]
- Stack with find-min/find-max more efficient than O(n)?
- What is the complexity of this simple piece of code?
- StackOverflowError computing factorial of a BigInteger?
- why i multiply many number make a mistake when i division?
- Random Number Algorithm – Implementation in Java
- Graph theory puzzle about connectivity?
- 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]
- Algorithm to divide a given number in two proportions by one of the component of that number
- Java – class, get new array of objects
- Constant Amortized Time
- Permutation of array
- What’s the best way to build a string of delimited items in Java?
- implementing debounce in Java
- All possible combinations of an array
- How to find all permutations of a given word in a given text?
- What is a non recursive solution for Fibonacci-like sequence in Java?
- best way to pick a random subset from a collection?
- Algorithm for 2D Raytracer
- Efficiently finding the intersection of a variable number of sets of strings
- Why do we ignore co-efficients in Big O notation?
- How to acquire a lock by a key
- Prove that binary heap build max comparsion is (2N-2)
- How to implement a Median-heap
- How does this Google Maps zoom level calculation work?
- (a * b) / c MulDiv and dealing with overflow from intermediate multiplication