Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3) Given n rectangular buildings in a 2-dimensional city, compute the skyline of these buildings, eliminating hidden lines. The main task is to view buildings

image text in transcribed

3) Given n rectangular buildings in a 2-dimensional city, compute the skyline of these buildings, eliminating hidden lines. The main task is to view buildings from a side and remove all sections that are not visible. All buildings share common bottom and every building is represented by triplet (left, height, right) 'left': is x coordinated of left side (or wall). 'right': is x coordinate of right side 'height': is height of building. 5 10 15 20 25 30 0 5 10 15 20 25 30 A skyline is a collection of rectangular strips. A rectangular strip is represented as a pair (left, height) where left is x coordinate of left side of strip and height is height of strip. Example: Input: Array of buildings {(1,11,5), (2,6,7), (3,13,9), (12,7,16), (14,3,25), (19,18,22), (23,13,29), (24,4,28) } Output: Skyline (an array of rectangular strips) A strip has x coordinate of left side and height (1, 11), (3, 13), (9,0), (12,7), (16,3), (19, 18), (22,3), (25,0) a) Design an algorithm using the recursive design method. Write a pseudo code for your algorithm and provide justifications for your method. b) Trace your algorithm on the above example and show the results. 3) Given n rectangular buildings in a 2-dimensional city, compute the skyline of these buildings, eliminating hidden lines. The main task is to view buildings from a side and remove all sections that are not visible. All buildings share common bottom and every building is represented by triplet (left, height, right) 'left': is x coordinated of left side (or wall). 'right': is x coordinate of right side 'height': is height of building. 5 10 15 20 25 30 0 5 10 15 20 25 30 A skyline is a collection of rectangular strips. A rectangular strip is represented as a pair (left, height) where left is x coordinate of left side of strip and height is height of strip. Example: Input: Array of buildings {(1,11,5), (2,6,7), (3,13,9), (12,7,16), (14,3,25), (19,18,22), (23,13,29), (24,4,28) } Output: Skyline (an array of rectangular strips) A strip has x coordinate of left side and height (1, 11), (3, 13), (9,0), (12,7), (16,3), (19, 18), (22,3), (25,0) a) Design an algorithm using the recursive design method. Write a pseudo code for your algorithm and provide justifications for your method. b) Trace your algorithm on the above example and show the results

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

L02 Review the main sources of genetic diversity.

Answered: 1 week ago

Question

Is conflict always unhealthy? Why or why not? (Objective 4)

Answered: 1 week ago