438 views
2 votes
2 votes
Consider the following intervals on the real line: $A_1 = (13.3, 18.3) \: A_3 = (8.3, 23.3) − A_1 \cup A_2$ $A_2 = (10.8, 20.8) − A_1 \: A_4 = (5.8, 25.8) − A_1 \cup A_2 \cup A_3$ where $(a, b) = \{x : a < x < b\}$. Write pseudo-code that calculates (without using any comparison operation) which interval a given input $x \in (5.8, 25.8)$ belongs to, i.e., your pseudo-code should calculate $i \in \{1, 2, 3, 4\}$ such that $x \in A_i$.

Please log in or register to answer this question.

Related questions

10 votes
10 votes
2 answers
1
go_editor asked Jun 3, 2016
1,448 views
Give a strategy to sort four given distinct integers $a, b, c, d$ in increasing order that minimizes the number of pairwise comparisons needed to sort any permutation of ...
2 votes
2 votes
0 answers
2
go_editor asked Jun 3, 2016
352 views
Consider six distinct points in a plane. Let $m$ and $M$ denote the minimum and maximum distance between any pair of points. Show that $M/m \geq \sqrt{3}$.
2 votes
2 votes
1 answer
3
go_editor asked Jun 3, 2016
750 views
The numbers $1, 2, \dots , 10$ are arranged in a circle in some order. Show that it is always possible to find three adjacent numbers whose sum is at least $17$, irrespec...
1 votes
1 votes
0 answers
4