Skip to content

Commit

Permalink
Ex. 14.3-3 change
Browse files Browse the repository at this point in the history
Not sure about the answer given as what it `res` there and what is returned.
  • Loading branch information
artkpv authored Nov 21, 2017
1 parent 9a1b73a commit e8abbb5
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions C14-Augmenting-Data-Structures/14.3.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ Describe an efficient algorithm that, given an interval i, returns an interval o

### `Answer`

MIN-INTERVAL-SEARCH(T, i)
x <- root[T]
res <- INT_MAX
while x != nil[T]
if i overlap int[x]
res <- min(res, low[x])
do if left[x] != nil[T] and max[left[x]] >= low[i]
then x<-left[x]
else x<-right[x]
return x
MIN-INTERVAL-SEARCH(T,i):
x = T.root
while x != T.nil:
if x.left != T.nil and i.low <= x.left.max:
x = x.left
elif x.int overlaps i:
break
else
x = x.right
return x


### Exercises 14.3-4
***
Expand Down

0 comments on commit e8abbb5

Please sign in to comment.