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
I WILL STAR YOU AND THANKS YOU!!!!!!!!!!!!!!!!
lord [1]
The answer seems to be polymerization.
 
8 0
3 years ago
When an interviewer asks “Tell me about yourself”, you should tell them about your childhood past.
Butoxors [25]

Answer: Nooo! Dont!

Explanation:That is a bad idea!

4 0
3 years ago
Read 2 more answers
A question to determine your ability to use the reference materials effectively. Your boss has determined that you will be using
Ymorist [56]

Answer:

The answer is "implement on group 2 and group 3".

Explanation:

In the given scenario, When technology workers are using in the project teams. People like to be stable, and we can't allow wireless network transmission to maintain their security and privacy. When we considering category 1 being the only ones who have links to a higher authority, that's why Group 2 and Group 3 were needing to be implemented.

3 0
3 years ago
Help!!!!!!<br>please<br>Who will give the answer I'll mark him/her as brainlist..​
damaskus [11]
17, 12.5, 6, and 10. HOPE THIS HELPS
4 0
3 years ago
Two floating point numbers, A and B, are passed to a recursive subroutine.
Mnenie [13.5K]
The answer is (c) infinite loop
6 0
4 years ago
Other questions:
  • Translate each of these statements into logical expressions using predicates, quantifiers, and logical connectives. a) Something
    7·1 answer
  • What is the simplest way to convert a decimal number in a binar one in c++?
    8·1 answer
  • When activating windows, which type of volume activation is used to activate multiple windows systems, but must be individually
    12·1 answer
  • Which of the following software program provides for email communication
    13·2 answers
  • This is in government
    15·1 answer
  •  How does critically analyzing technology add value to interactions with people in personal and professional contexts?
    7·2 answers
  • Security Definition updates for windows defender are performed through the ——— function in windows server 2016
    7·2 answers
  • Please help ASAP !!!
    15·1 answer
  • NEED HELP ASAP!!!
    10·1 answer
  • A cookie is stored on your device's memory or disk in what file format? 1.)video file
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!