Hi! I have a doubt about this resolution of this algorithm analysis, specifically referred to the return min(L[i:j+1]): why is it considered O(n)?: it always refers to a defined slice, with a limited possible dimension (j<=i+2)
Computational complexity and recursion - Is this analysis correct?
65 views Asked by Himan At
1
There are 1 answers
Related Questions in ALGORITHM
- MCNP 6 - Doubts about cells
- Given partially sorted array of type x<y => first apperance of x comes before first of y, sort in average O(n)
- What is the algorithm behind math.gcd and why it is faster Euclidean algorithm?
- Purpose of last 2 while loops in the merge algorithm of merge sort sorting technique
- Dots and Boxes with apha-beta pruning
- What is the average and worst-case time complexity of my string searching algorithm?
- Building a School Schedule Generator
- TC problem 5-2:how to calculate the probability of the indicator random variable?
- LCA of a binary tree implemented in Python
- Identify the checksum algorithm
- Algorithm for finding a subset of nodes in a weighted connected graph such that the distance between any pair nodes are under a postive number?
- Creating an efficent and time-saving algorithm to find difference between greater than and lesser than combination
- Algorithm to find neighbours of point by distance with no repeats
- Asking code suggestions about data structure and algorithm
- Heap sort with multithreading
Related Questions in RECURSION
- What is the problem in my "sumAtBis" code?
- Leetcode 1255-recursion and backtracking
- Unexpected Recursive Call
- Clang possibly skipping line(s) of code while compiling
- Return an arraylist without passing an argument
- Solving Maze using Backtracking C++
- I can't get the specific node of BST using recursion . i.e. every stack it erase
- Python Quadtree won't insert values
- Top View Of Binary Tree Depth First Search Using TreeMap
- Select/filter tree structure in postgres
- Python global variables in recursion get different result
- Trying to recursively find the area of a polygon
- *Dynamically* decorate a recursive function in Python
- What structure can be made to avoid having to use RefCell?
- Why is the output of the two given cout statements different in the given cpp code
Related Questions in TIME-COMPLEXITY
- C++ : Is there an objective universal way to compare the speed of iterative algorithms?
- Simplify complexity
- How to find big o of dependent loops and recursive functions?
- find number of unique durations given a list of durations and an upper bound
- What is the time complexity of doing two binary searches on an array?
- How to determine the time complexity of a recursive function that has a loop enclosed in it?
- Why is time complexity of Generate Parentheses O(4^n ( sqr root( n)))
- Find median in constant time O(1)
- Best Index - HackerEarth Solution, help me optimize the code
- Time complexity of Insertion Sort of an array of n numbers, with additional information
- How come checking for printable bytes is faster with the "in" operator rather than interval comparisons?
- Generate cuboids with integer sides and diagonals: how to improve the time complexity?
- What is the time complexity of this algorithm with two arrays?
- calculating number of operations in algorithm
- Time complexity of Rectangle Covering algorithm
Related Questions in COMPLEXITY-THEORY
- Given partially sorted array of type x<y => first apperance of x comes before first of y, sort in average O(n)
- What's the complexity of `+=` for a string in Python
- How to find big o of dependent loops and recursive functions?
- Understanding Unary PCP Reduction to a Matching Problem (UPCP)
- How to determine the time complexity of a recursive function that has a loop enclosed in it?
- Does the square root of an input lie in the middle of that input?
- Hash Table creation runtime complexity
- Optimization - Algorithm for finding load set combination that returns the maximum Von Mises stress
- Time complexity of a divide and conquer algorithm that searches for a value in an n x m table, rows and columns are sorted
- Big O notation of string permutation in Python
- finding the time complexity of the program
- how do i find the time complexity (big O) of this triple loop?
- determine the big o running time of the method
- Reduction from Hamiltonian path to Tripartite decision problem
- How to implement the Sosic and Gu linear algorithm for the n-queens problem
Related Questions in MASTER-THEOREM
- Does the multiplication of the recursive calls affect the master's theorem?
- Time complexity of mixedsort (a modification on bubblesort)
- Master Theorem - Solving Recurrence
- Is my application of master theorem correct?
- Recurrence Relation: Solve T(n) = 25T(n/5) + ((n log 5) / (log n))^2
- What exactly does epsilon represent in master theorem?
- Determining if case 2 applies of the Master Theorem when a=1, b=2, f(n) = logn
- Average-case time complexity of QuickSort algorithm
- Solve the recurrences, T(n)=3T(n - 1)+3
- Solving recurrence of divide and conquer using master theorem
- what would be the run time of this function using master's theorem
- Can T(n) = 2T(n/4)+ n^3 + n^2 be solved using Master Theorem?
- Computational complexity and recursion - Is this analysis correct?
- Time complexity of T(n) = 27T(n/3) + (n^3)log(n)
- Finding the recursive relation of an algorithm and then using to find the runtime complexity using the master theorem
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)

For simplicity, consider size of the list to be a power of 3.
Algorithm
The
ifstatement forms the base case. Time complexity of above statements isO(1). However, the if statement will be executedn/3times.Recursion Tree
It should be obvious from the recursion tree, that for an array of size
n,ifstatement will be executedn/3times. Hence, overall complexity ofifstatement isO(n).The reason
ifis executedn/3times and notnis that recursion ends when we encountered an sub-array of size 3. If the the recursion came to an end when we encountered an sub-array of size 1, then it would have been executed for n times.