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 should you do if a headset plugged into your computer is not working properly?
Alex777 [14]

If a headset plugged into computer is not working properly than one can go for updating the device driver. The correct option is B.

<h3>What is a device driver?</h3>

A device driver is a type of software application that allows one hardware device (such as a computer) to communicate with another hardware device (such as a printer). A device driver is indeed referred to as a software driver.

A driver, also known as a device driver, is a collection of files that instructs a piece of hardware on how to operate by communicating with a computer's operating system.

Every piece of hardware, from internal computer components like your graphics card to external peripherals like a printer, requires a driver.

If a headset plugged into a computer is not working properly, the device driver can be updated.

Thus, the correct option is B.

For more details regarding device driver, visit:

brainly.com/question/14054807

#SPJ12

8 0
11 months ago
Read 2 more answers
Which type of image would require you to obtain permission from the author to use the image and possibly pay a royalty to the au
ASHA 777 [7]

Answer:

Copyrighted.

Explanation:

Patent can be defined as the exclusive or sole right granted to an inventor by a sovereign authority such as a government, which enables him or her to manufacture, use, or sell an invention for a specific period of time.

Generally, patents are used on innovation for products that are manufactured through the application of various technologies.

Basically, the three (3) main ways to protect an intellectual property is to employ the use of

I. Trademarks.

II. Patents.

III. Copyright.

Copyright law can be defined as a set of formal rules granted by a government to protect an intellectual property by giving the owner an exclusive right to use while preventing any unauthorized access, use or duplication by others.

Hence, a copyrighted image would require you to obtain permission from the author to use the image and possibly pay a royalty to the author for its use.

7 0
2 years ago
Construct a SQL query that displays a list of colleges, their sity/state, the accrediting agency, and whether or not the school
Alex787 [66]

Answer:

SELECT college, city_state, accre_agency, distance LIMIT 10

Explanation:

Given

Table name: College

See attachment for table

Required

Retrieve top 10 college, state, agency and school distance from the table

To retrieve from a table, we make use of the SELECT query

The select statement is then followed by the columns to be selected (separated by comma (,))

So, we have:

SELECT college, city_state, accre_agency, distance

From the question, we are to select only first 10 records.

This is achieved using the LIMIT clause

i.e. LIMIT 10 for first 10

So, the complete query is:

SELECT college, city_state, accre_agency, distance LIMIT 10

6 0
3 years ago
When did the silent movie era end?<br> A.1919<br> B.1929<br> C.1939<br> D.1949
11111nata11111 [884]

Answer:

The answer is 1929.

5 0
3 years ago
Read 2 more answers
What is the value stored at x, given the statements:
iren [92.7K]

Answer:

0.

Explanation:

Given

int x;

x=3/(int)(4.5+6.4)

Required

What is x?

The first line of the code segment declares x as integer. This means that, it will only hold non decimal numbers.

With the above explanation, options (a), (c) and (d) can not be true.

Solving further:

x=3/(int)(4.5+6.4)

The computer evaluates the denominator as:

x=3/(int)(10.9)

The denominator is then converted to an integer. So, we have:

x = 3/10;

3/10 = 0.3 but

Recall that: <em>x will only hold non decimal numbers.</em>

So:

x = 0;

5 0
2 years ago
Other questions:
  • How can you tell that you're driving in the right direction?
    14·1 answer
  • Assume you are a network consultant for a company that is designing a private WAN to communicate between five locations spread t
    10·1 answer
  • What is a benefit of the Name Manager feature?​
    12·2 answers
  • A power supply unit for a computer converts:
    6·1 answer
  • You insert a comment in a worksheet by using a command on the ____ tab on the Ribbon.
    13·1 answer
  • You want to substitute one word with another throughout your document. What tool(s) should you use?
    9·1 answer
  • Write a procedure ConvertToBinary that takes an input as a number from 0 to 16 (including 0 but not 16) and converts it to a bin
    11·1 answer
  • What is the value of numX when this program is executed? if 3 &lt; 5 and 8 != 3: numX = 3 else: numX = 7
    13·2 answers
  • When data can flow across a cable in both directions, this is known as___Communicating?
    15·1 answer
  • Prokaryotes are __________________ and include ________________________.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!