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 GIVE BRAINLIEST TO WHO ANSWERS FIRIST AND CORRECT
forsale [732]

Answer:

Act like search engines

Explanation:

They will give you intel on about basically anything and they have their own opinion on it aswell‍♀️

4 0
3 years ago
Read 2 more answers
In java, c or c++ code, when a number begins with a leading 0, what do you know about that number: (example: int zzz = 012;) in
Katarina [22]
A leading 0 denotes octal notation, so the digits 8 and 9 are not used.
In normal decimal notation 12 means 1*10+2, in octal, it means 1*8+2.

The leading 0x denotes hexadecimal notation, here the digits are extended with 6 letters, a through f. 0x12 means 1*16+2.

Without any prefix, we have normal decimal notation.
5 0
4 years ago
Pierre received an urgent email appearing to come from his boss asking him to respond quickly to the email with the company cred
Wewaii [24]

Answer:

This is a Phishing email

Explanation:

Pierre has received a phishing email from a certain scammer. These kinds of emails are an attempt from the scammer to fool the receivers like in this case Pierre and get the personal and financial information that they can use to steal the money from their account. It's hence, a fraudulent attempt to steal the money from the account of a certain person like here it is Pierre.

4 0
3 years ago
The leading membranophone in "Kan andi ghazal" is the ________. (If you can not access the audio file here, please go to modules
ICE Princess25 [194]

Answer:

Tabl Baladi

Explanation:

The Tabl Baladi is a large drum with wood frame and heavy skin on both sides. It is hung by a belt around the player's shoulder is and played with two sticks: the thick one is for the dum sound played with the dominant hand, and the thin stick is for the tak sound played with the other hand.

It is mostly used in classical Arab (Middle Eastern) music. Kan Andi Ghazal is a song by the Lebanese musician Wael Jassar.

5 0
4 years ago
A(n) ________ is the portion of virus code that is unique to a particular computer virus. A) virus signature B) encryptio
tino4ka555 [31]

Answer:

A) virus signature

Explanation:

Antivirus databases contain what are called signatures, a virus signature is a continuous sequence of bytes that is common for a certain malware sample.

--

Encryption is a way of scrambling data so that only authorized parties can understand the information.

7 0
2 years ago
Other questions:
  • Charts are inserted into an excel spreadsheet using the commands in the charts group on the ____ tab on the ribbon.
    13·1 answer
  • During college jesse spent four semesters studying abroad in other parts of the world how could jesses time abroad benefit his e
    5·2 answers
  • Titus would like to make his products stand out a little more in his Excel spreadsheet. What actions would help to distinguish o
    15·1 answer
  • You can enter _____ in a cell to display tomorrow’s date
    12·1 answer
  • The online underground is used _____. Select 3 options. by law-abiding citizens only on Black Friday for networking by criminal
    11·1 answer
  • Which picture should i put as my profile picture.
    15·2 answers
  • Write a qbasic program to supply first , middle and last name of a person and print the output as given below :
    9·1 answer
  • Six security issues and six descriptions are shown below.
    11·1 answer
  • Hey, My paperclips just stoped producing, does anyone have any idea how to start them up again?
    5·1 answer
  • How do I text lauraasher811 on brainly?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!