Ask Question
30 August, 11:36

In class, we discussed an algorithm which allows us to query an interval i in a search tree S, and we receive an interval in S which overlaps with i if one exists. Using the algorithm discussed in class as a sub procedure, give an algorithm which returns every interval in S which overlaps with i. Suppose there are k such intervals. What is the worst case running time of your algorithm in terms of k and n

+1
Answers (1)
  1. 30 August, 12:37
    0
    The algorithm is expressed as S:

    Count = array of k + 1 zero

    For s in input do

    count {key (s) } + = 1

    total = 0

    For i in 0, 1, ... k do

    count (i), total = total, count (i) + total

    Output = array of the sum length input for s in input do

    Output {count (key (s) } = s

    count {key (s) } + = 1

    return output

    b) The total space usage of the algorithm can be an impediment for maximum key values that are significantly smaller.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “In class, we discussed an algorithm which allows us to query an interval i in a search tree S, and we receive an interval in S which ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers