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
Brian needs to assign a macro to a button on the ribbon. Where should he go to achieve this goal?
8_murik_8 [283]

Answer: A. Record Macro dialog box.

Explanation:

3 0
3 years ago
Read 2 more answers
Which of the following statements is correct? A. The columns will be listed in the results in the same order they are stored in
Mrac [35]

Hello! The answer to your question would be as followed:

C. The columns will be listed in the results in the same order they are listed in the SELECT clause of the SELECT statement.

5 0
3 years ago
Suppose data is available for an on-line music distributor. This data includes: song title, artist performing the song, date son
garri49 [273]

Answer:

The answer is "Option a".

Explanation:

In this question, the only choice "a" is correct because in the question it is declared that it includes: your track title, the performance artist, the date their track is bought, the fee for the track. Its number of music purchased by a given artist on a particular date is based only on details available on the distributor's song title, performing, date purchased, the sum paid.

5 0
3 years ago
How might the design be changed so that additional copies of print statements would not be needed?
bogdanovich [222]

A design be altered so that additional copies of print statements would not be needed by changing the format spring.

<h3>What is the aim of a print statement?</h3>

The PRINT statement is known to be often sent data so that it is taken to the display terminal or to another kind of print unit.

Note that A design be altered so that additional copies of print statements would not be needed by changing the format spring.

Learn more about design from

brainly.com/question/1020696

#SPJ1

5 0
1 year ago
Consider a file system that uses inodes to represent files. Disk blocks are 8KB in size, and a pointer to a disk block requires
insens350 [35]

Answer:

64 terabytes

Explanation:

Given data:

Size of the disk block = 8 KB

Size required by the pointer to a disk block = 4 bytes

Now,

Size required by 12 direct disk blocks = 12 × 8

Size required by single disk block = 2048 × 8 KB

Size required by double disk block = 2048 × 2048 × 8 KB

size  required by triple disk block = 2048 × 2048 × 2048 × 8 KB

Now,

the maximum size of the file that can be stored in the this file system = 12 × 8  + 2048 × 8 KB  +  2048 × 2048 × 8 KB + 2048 × 2048 × 2048 × 8 KB  = 64 terabytes

5 0
3 years ago
Other questions:
  • 3. If B3=6 and D5=8, what would the following function return? IF(B3&gt;D5, "Closed", D5-B3) *
    10·2 answers
  • The chart shows an example of a study-time survey. Students can use the formula shown in the survey to figure out ways to track
    14·1 answer
  • What types of scientific claims should be verified
    5·1 answer
  • The type of database that is connected by a company's local area networks is a(n:
    11·1 answer
  • Simple geometry can compute the height of an object from the the object's shadow length and shadow angle using the formula: tan(
    8·1 answer
  • True / False<br> An instruction’s opcode generally indicates the number and type of its operands.
    5·1 answer
  • In cell I8, enter a nested logical function to display Need to Remodel if the apartment is unoccupied (No) AND was last remodele
    9·1 answer
  • 1.Discuss why this class is important (or not) to a soon-to-be security practitioner. 2.Discuss one of more subjects you have le
    7·1 answer
  • How to you compute for the total room sales​
    10·1 answer
  • The pinky finger on the right hand types _____.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!