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
Which statement correctly explains why televisions became less bulky?
REY [17]

Answer:

The old cathode Ray tube technology was replaced by the less bulkier and more modern liquid crystal display and LED technology.

Explanation:

The old cathode ray tube uses the principle of electrical discharge in gas. Electrons moving through the gas, and deflected by magnetic fields, strike the screen, producing images and a small amount of X-rays. The tube required more space, and consumed more electricity, and was very bulky. The modern technologies are more compact and consume less power, and can been designed to be sleek and less bulky.

3 0
3 years ago
A startup is developing a new web browser with a focus on accessibility for visually impaired users. The startup founder is cons
gavmur [86]

Answer:

A license that allows developers to change and share the source

code of the licensed software

Explanation:

i learned this, btw brainly stop removing my answers

7 0
2 years ago
You are designing software for elderly people. Which two features can you
romanna [79]

give instructions in both text and audio formats

7 0
3 years ago
Which of the following statements is true? a. Predicate methods typically test a condition and modify the object on which they'r
egoroff_w [7]

Answer:

C

Explanation:

Predicate methods typically test a condition and do not modify the object on which they're called.

3 0
3 years ago
What are so good free movie apps or websites
noname [10]

Some free movie websites and apps are:



Crackle


Tube TV


Popcornflix


Viewster


Snagfilms


And Pluto TV


Hope I helped

8 0
3 years ago
Read 2 more answers
Other questions:
  • : how can you reduce file size so that files can be sent more efficiently across the internet
    5·1 answer
  • Compare the current in two lightbulbs wired in a series circuit
    11·1 answer
  • Complete the following conversions. You MUST show all of your work to receive full credit.
    13·1 answer
  • Create a do-while loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop shou
    5·1 answer
  • How can the use of new technology in industry benefit the us government
    8·2 answers
  • You're working in a table that has three columns and five rows. Since the first row will be a header row, you want it to span al
    6·1 answer
  • Copyright laws protect:This task contains the radio buttons and checkboxes for options. The shortcut keys to perform this task a
    6·1 answer
  • Help please i will give Brainliest
    7·1 answer
  • To manage OpenLDAP policies over Command Line Interface (CLI), a certain type of file is needed. What is this type of file calle
    7·1 answer
  • Explain why you would use the soft on/off jumper when working on ATX system
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!