Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++, the inputs and outputs must be same as sample, use of data structures if possible will upvote if correct Simple Quadtree As we all

C++, the inputs and outputs must be same as sample, use of data structures if possible will upvote if correct
image text in transcribed
Simple Quadtree As we all know, images consist of many tiny pixels. Have you ever considered how we can efficiently store the picture in computers? There is a simple data structure called "Quadtree", which has appeared in the first lecture notes. A quadtree is a representation format used to encode images. The fundamental idea behind the quadtree is that any image can be split into four quadrants. Each quadrant may again be split into four sub quadrants, etc. In the quadtree, the image is represented by a parent node, while the four quadrants are represented by four child nodes, in a predetermined order. Of course, if the whole image only contains a single color, it definitely can be represented by a quadtree consisting of a single node. In general, a quadrant needs only to be subdivided if it consists of pixels of different colors. As a result, the quadtree need not be of uniform depth. In this question, given a picture containing only black and white pixels, please find out the number of nodes (including the root) in the corresponding quadtree of the picture. It is not necessary to implement the data structure of quadtree. 8 by 8 4 by 4 NW SW SE) NE 2 by 2 1 by 1 Input The input contains multiple cases. Each test case begins with one integer k, indicating the size (n n) of image, where n= 2k and OSS 10. The following n lines give the information of the pixels, where the i-th line contains a binary string (containing '0(white) and '1'(black) of n characters, indicating the pixel information in the i-th row Output For each test case print the number of nodes in the corresponding quadtree ina separate line

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

Advances In Databases And Information Systems Uropean Conference Adbis 2020 Lyon France August 25 27 2020 Proceedings Lncs 12245

Authors: Jerome Darmont ,Boris Novikov ,Robert Wrembel

1st Edition

3030548317, 978-3030548315

More Books

Students also viewed these Databases questions

Question

=+2 Why are so many countries bothered by their brain drains?

Answered: 1 week ago