1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
user100 [1]
3 years ago
8

Two boxes overlap if their interiors have at least one point in common. Give an O(n log n)-time algorithm that decides if there

is a pair of boxes in S that overlap and produces one such pair if it exists
Computers and Technology
1 answer:
GaryK [48]3 years ago
5 0

Answer:

// Program is written in C++ programming language

// The program checks if two boxes overlap and prints both boxes

// Comments are used for explanatory purpose

// Program starts here

#include<bits/stdc++.h>

#include <graphics.h>

#include <conio.h>

// Define x and y axis

struct axis { int x, y; };

bool checkRect(Axis l1, Axis r1, Axis l2, Axis r2)

{ // l1, l2, r1 and r2 represent the left and right coordinates of both rectangles

// Check one rectangle is on left side of other

if (l1.x > r2.x || l2.x > r1.x) {

return false; }

// Check if one rectangle is above other

if (l1.y < r2.y || l2.y < r1.y) {

return false; }

return true;

}

// Main Method begins here

int main()

{

// Declare integer variables to enter rectangle coordinates

// For rectangle 1

int left1, left2, right1, right2;

cout<<"Enter First rectangle coordinates: "<<"\n";

cout<<"Top Left: "<<"\n";

cin>>left1;

cout<<"Bottom Left: "<<"\n";

cin>>left2;

cout<<"Top Right: "<<"\n";

cin>>right1;

cout<<"Bottom Right: "<<"\n";

cin>>right2;

// For rectangle 2

int left3, left4, right3, right4;

cout<<"Enter Second rectangle coordinates: "<<"\n";

cout<<"Top Left: "<<"\n";

cin>>left3;

cout<<"Bottom Left: "<<"\n";

cin>>left4;

cout<<"Top Right: "<<"\n";

cin>>right3;

cout<<"Bottom Right: "<<"\n";

cin>>right4;

Axis l1 = {left1, left2}, r1 = {right1, right2};

Axis l2 = {left3, left4}, r2 = {right3, right4};

if (checkRect(l1, r1, l2, r2)) {

cout<<"The Rectangles Overlap"; }

else {

cout<<"Rectangles Don't Overlap";}

// Print Rectangle 1

rectangle (left1, right1, left2, right2);

// Print Rectangle 2

rectangle (left3, right3, left4, right4);

return 0;

}

You might be interested in
What tips or techniques should you keep in mind when shooting photographs on a rainy day?
SashulF [63]
Simple: Keep your camera protected from the rain

Here are some tips for photographing during rainy day: 1) Use image stabilization or tripod.
2) Choose a larger aperture.
3) Change the object on which you focus.
4) Have a well-defined center of interest.
5) Review all images.
6) Use exposure compensation.

7 0
3 years ago
Many of the special staff teams require leadership training, which is offered to staff with more than 1 year of service at Camp
Sveta_85 [38]

Answer:

The answer to this question can be defined as follows:

Explanation:

In the given question attachment file is missing so, following the code to this question:

using function IF:

=IF(Logical test, how to do it when testing is right, how to do it when testing is wrong)

In this scenario, a leader development Worker should pass 2 tests

In the First test may not finish his training

If yes-" satisfied"  

It is not true, it will go to 2nd test  

In the second test, If employee served a service period of even more than 1 year (to be performed in a first check if not correct)

If, It is yes=" yes"  else  not ="No"  

= IF(Leader Training = Yes, "Completed," IF(Service time> 1," Yes ","No")  

That's means,  

The sort IF(I2 = "Yes","Completed"),IF(D2>1," Yes","No") must be used in cell M2)

Copy Cell M2 Then the selected M3 over M30

8 0
3 years ago
The length of a pencil would most likely be measured in:
Nataliya [291]
The length of the pencil would most likely be measured in centimeters.
6 0
3 years ago
Read 2 more answers
Inattentional blindness occurs when individuals do not observe certain objects or events because they are focused on something e
PSYCHO15rus [73]
The answer is True have a good day
5 0
3 years ago
Read 2 more answers
How do you find the exterior angle measure of any regular polygon? (The degree in which to turn the turtle to draw a shape)
Diano4ka-milaya [45]

Answer:

360/number of sides

Explanation:

all the exterior angles add up to 360°

so to find each angle mesure, divide the 360 by the number of sides the figure has.

7 0
3 years ago
Other questions:
  • What is the other name of the horizontal column graph?
    6·2 answers
  • What is a break in the content that forces takes on to the next line
    10·2 answers
  • What happens if you move unencrypted files into an encrypted folder?
    5·1 answer
  • Is it possible to uninstall a program that's on your phone from computer?
    8·1 answer
  • On which of the following pointing devices can you control the pointer by sliding your fingertip?
    11·1 answer
  • Write a routine to interchange the mth and nth elements of a singly-linked list. You may assume that the ranks m and n are passe
    10·1 answer
  • In which client/server relationship can a computer act as both a client AND a server? Select one: a. X-Windows b. SSH c. Classic
    8·1 answer
  • Por que se dice que la tecnología ha tenido muchos aportes positivos para la sociedad pero también nos ha hecho dependientes de
    9·1 answer
  • True or False: Mapping annotations are exclusive - an annotated method will only be accessible to requests sent to a matching UR
    14·1 answer
  • Full meaning of CASE in system analysis
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!