Given two segments a and b that are comparable at x, show how to determine in O(1)

Question:

Given two segments a and b that are comparable at x, show how to determine in O(1) time which of a ≼ x b or b ≼ x a holds( Assume that neither segment is vertical. If a and b do not intersect, you can just use cross products. If a and b intersect-which you can of course determine using only cross products you can still use only addition, subtraction, and multiplication, avoiding division. Of course, in the application of the ≼ x relation used here, if a and b intersect, we can just stop and declare that we have found an intersection.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Introduction to Algorithms

ISBN: 978-0262033848

3rd edition

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

Question Posted: