Question: QUESTION 6 Correct Answer: 4 Marks Given an array arr, the code below implements Sparse Table for finding the minimum value in a range 1
QUESTION
Correct Answer: Marks
Given an array arr, the code below implements Sparse Table for finding the minimum value in a range in time. Which of the following statements is true about the Table array after the Sparse Table has been built?
Code
class SparseTable:
def init self arr:
self.
for i in range :
self.log self.log
self.table for in rangeselflog for in range
for in range :
self.tablei arri
for in range self.log :
for in range :
self.table self.table
def queryself I, :
self.log
return minselftable self.table
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
