There are n points and each point enclose with x and y axis
form a rectangle and find the point using a program which
forms the smallest rectangle?



There are n points and each point enclose with x and y axis form a rectangle and find the point usi..

Answer / Arun Tiwari

To find the point that forms the smallest rectangle among a set of given points, you can use the following steps:

1. Sort the points based on their x-coordinates and then tie breaks based on y-coordinates. This ensures that the points are arranged in ascending order of their x-coordinates and within each group, they are ordered according to their y-coordinates.

2. Initialize a variable `minArea` to store the minimum area rectangle formed so far. Initially set it to an extremely large number.

3. For each group of points with identical x-coordinate, iterate over the points within that group and find the pair of points that form the smallest rectangle. The formula for the area of a rectangle is `area = |(x2 - x1) * (y2 - y1)|`. Update `minArea` if the calculated area is smaller than the current minimum.

4. After iterating through all groups, return the point that forms the smallest rectangle with the minimum area.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Engineering AllOther Interview Questions

why not overloading -,=,_,\ operator

1 Answers  


Why DG Set manufacturers do not give options for alternative fuels. They even do not allow to change at the cost of custmers.

1 Answers  


Anyone have thesis paper about "Electrical Load Forecasting" . Or the web addresses where people usually upload their thesis paper except IEEE.

1 Answers  


what is far pointer?

1 Answers  


sir, i am khalidh iam preparing for the examinations of Hpcl information systems officers for that iam having a guidence for the written exam.So provide me a test apptitude papers and subject related questions.

0 Answers  


if a customer's blackberry stopped syncing their calendar wirelessly what would you do?if a customber deleted mail from his blackberry but it did delete from his mailbox how would ypu resolve this

1 Answers  


how to reuse an outdated laptop?

1 Answers  


What is CRC? the material will be used in electrical stampings.

1 Answers  


how the aeroplane protected from the lightening?

1 Answers   HEG,


The old welding machine use electro- -magnetic winding to step up the current for welding rods,what is new principle inside the welding

1 Answers  


I m doing btech with computerscience branch.For every campus placement eligibilty criteriais is 60%.I have 65% in highschool and b.tech till now but secured 59.6% in intermediate. So would this percentage b considered as 60% or i wont b able to sit in exams?kindly post your views?

2 Answers   TCS,


What is Symbian.?

1 Answers  


Categories
  • Civil Engineering Interview Questions Civil Engineering (5086)
  • Mechanical Engineering Interview Questions Mechanical Engineering (4453)
  • Electrical Engineering Interview Questions Electrical Engineering (16638)
  • Electronics Communications Interview Questions Electronics Communications (3918)
  • Chemical Engineering Interview Questions Chemical Engineering (1095)
  • Aeronautical Engineering Interview Questions Aeronautical Engineering (239)
  • Bio Engineering Interview Questions Bio Engineering (96)
  • Metallurgy Interview Questions Metallurgy (361)
  • Industrial Engineering Interview Questions Industrial Engineering (259)
  • Instrumentation Interview Questions Instrumentation (3014)
  • Automobile Engineering Interview Questions Automobile Engineering (332)
  • Mechatronics Engineering Interview Questions Mechatronics Engineering (97)
  • Marine Engineering Interview Questions Marine Engineering (124)
  • Power Plant Engineering Interview Questions Power Plant Engineering (172)
  • Textile Engineering Interview Questions Textile Engineering (575)
  • Production Engineering Interview Questions Production Engineering (25)
  • Satellite Systems Engineering Interview Questions Satellite Systems Engineering (106)
  • Engineering AllOther Interview Questions Engineering AllOther (1379)