CSCI 1200 Data Structures- Quad Trees and Tree Iteration

$20 Bonus + 25% OFF

Securing Higher Grades Costing Your Pocket?
Book Your Assignment at The Lowest Price
Now!

Students Who Viewed This Also Studied

CSCI 1200 Data Structures

Task

 Quad Trees & Tree Iteration

In this assignment you will build a custom data structure named QuadTree. The data structure you will build for this homework is similar to the classic quad tree, octree, &-d tree, and binary space partition data structures from computational geometry. These structures are used to improve the performance of applications that use large spatial data sets including: ray tracing in computer graphics. collision detection for simulation and gaming, motion planning for robotics, nearest neighbor calculation. image processing, and many, many others. Our QuadTree implementation will share some of the framework of the de_set implementation we have seen in lecture and lab. You are encouraged to carefully study that implementation as you work on this homework.

The diagrams below illustrate the incremental construction of the QuadTree data structure. In this example, we add the 21 two-dimensional points shown in the first image to the tree structure. We will add them in the alphabetical order of their labels. Each time a point is added we locate the rectangular region containing that point and subdivide that region into 4 smaller rectangles using the z,y coordinates of that point as the vertical and horizontal dividing lines.

Each 2D coordinate (2, y) is stored in the Point claas. In these plots (0.0) is in the upper left corer. The z axis runs horizontally, with increasing values to the right. The y axis runs vertically with increasing values in the downward direction.

Like an STL map and STL set. inserting a new Point into the QuadTree or querying (using find} whether a Point is already in the structure is fast. and can be completed in O(log n}. where n is the number of Points in the tree. However. unlike the set and map structures which are based on a binary tree, having two subtrees per node, the QuadTree has 4 children at each node!

The data in our QuadTree can be visualized using two different output routines, plot and print_sideways. You will also implement two different methods for iterating over the tree: depth-first (specifically pre-order} or breadth-first. To do this, you will write two belper classes Depth Iterator and BreadthIterator which will be typedef-ed within the QuadTree class.

Here is a diagram showing the relationships between the different classes you will implement for this assignment. Be sure to draw plenty of your own diagrams as you work, and be prepared to show these diagrams when you come to office hours or ALAC tutoring to ask for help on the assignment.

Note that the QuadTree is ternplated over two types, the number_type and the labeliype. In this example. the number type is int and the label type is char. This is the detailed internal memary representation after adding the first 3 points in the example on the previous page. We also show a sample DepthIterator object initially attached to the root node of this tree. You should follow this diagram exactly. using these specific class and member variable types and names and placeholder template type names. We do not present the details of the BreadthIterator class in this diagram. You may design the internal representation of that class to complete the specified functionality.

Implementation

Your task for this homework is to implement the structure diagrammed above. We recommend that you begin your implementation by following the structure of the de_set class we studied in lecture and lab. You will need to make a number of significant changes to the code. but the overall design: a “manager” class (QuadTree), the Hode class, and tree_iterator classes is similar. We provide the Point class and the implementation of the two QuadTree member functions for printing: plot and print_sideways. You will build the rest of your implementation around this starter code. Remember that because this is a templated class, you will not separate the implementation into .b and .cpp files. Keep all of your implementation in a single file named quad_tree.h, but make sure it is well-organized and appropriately commented.

The provided code in main.cpp illustrates the basic functionality of the QuadTree class including the QuadTree functions: size. insert. find. height, begin, end, bf_begin, and bf_end, and iterator functions: operator++ (both pre- and post- increment), operator* (dereference), getLabel, and getDepth. Study these examples carefully to deduce the expected argument and return types of the functions. As this is a class with dynamically-allocated memory, you will also need to implement, test. and debug the copy

constructor, assignment operator, and destructor. Submitty will compile and run quad tree with the instructor’s solution to test your implementation of these functions. It will test your code with Dr. Memory and your program must be memory error and memory leak free for full credit.

We encourage you to work through the test cases in the provided main. cpp step-by-step, uncommenting and debugging one test at a time. The provided test cases do not adequately test all corner cases, so as you work, add your own test cases to the student_tests function. Be sure to test your templated implementation with other number types (e.g., float, double) and other label /data types (e.g.. STL string. int, etc.). Note that the ASCII art plot function is intended only for debugging use on modest-sized examples with small non-negative integers and char labels. Furthermore. the plot function assumes that no two points have the same x coordinate or the same y coordinate.

Extra Credit: Tree Balancing

How does the point insertion order affect the shape of the resulting QuadTree object? What are specific examples of the worst case and best case? Discuss in your README.txt file. For extra credit, yon can implement a function named BalanceTree to re-order a point collection before inserting the data into the tree to improve the quality of the resulting tree. QuadTree quality can be defined with various metrics including: minima] tree height. more equal partitioning of data into the 4 subtrees (approximately the same oumber of elements in each child tree), and rectangular subregions that have approximately equal area or that have more equal ratio of height to width. Certainly for some input collections you cannot simultaneously satisfy all of these properties! You may define how to prioritize these metrics. Be sure to write challenging test cases that show off your implementation.

Performance

Assuming our tree holds n points that are well-distributed and have been inserted into the structure in a tandom order to produce a generally well balanced tree, what is the Big QO Notation for running time and the Big O Notation for memory usage of the different operations of the QuadTree?

CSCI 1200 Data Structures

Answer in Detail


Solved by qualified expert

Get Access to This Answer

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

32 More Pages to Come in This Document. Get access to the complete answer.

More CSCI 1200 CSCI 1200 Data Structures: Questions & Answers

Business Management

Learning objectives as covered up to week 9, with an emphasis on topics of weeks 6 through 9.  On successful completion of this assignment you should have demonstrated that you are able to:  ï‚· Write a program consisting of multiple objects which interact with each other …

View Answer

Business Management

Along with your code, you will need to provide a report which includes the following sections:1. Game design – How did you come up with a solution to meet the brief? 1. What did you need to do to work out how to get the horses to stop/turn at the relevant points on the track? 2. How did you design t …

View Answer

CIS 493 Big Data Processing

Task:
One of the most common machine generated Big data format is JSON format. Create a database for the given Yelp Business data by converting the data in a Semi-Structured JSON format to a structured file format (CSV, TSV) so that the converted files can be directly created as database tables in …

View Answer

PROG24310 Programming Languages

Task:
Problem N1 You have the following context-free gramma:S -> ABB -> bAaAB | aA -> Ab |Using the grammar above and a right-most derivation, is it possible to obtain a string “babbabbabba” ?If so, please provide the derivation process and build the abstract syntax tree. Is this grammar ambi …

View Answer

Content Removal Request

If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the
content removal request.

Choose Our Best Expert to Help You

Brody Cox

I have acquired my PhD in Economics from Cardiff University.

1200 – Completed Orders

Hire Me

Ayanna Buckley

I did my Ph.D. in Accounting and Finance from the University of Bristol

350 – Completed Orders

Hire Me

Still in Two Minds? The Proof is in Numbers!

33845 Genuine Reviews With a Rating of 4.9/5.

Mechanical Engineering

Home Work: 1 Page, Deadline:
23 hours

The assignment is good and i have submitted it. and i got good marks. I appreciate your good work.

User ID: 7***11 Canada

Management

Assignment: 1 Page, Deadline:
7 days

Just want to say thank you, better than I expected, came out with a B+, would recommend, and I would use again.

User ID: 6***05 Borehamwood, Great Britain

Management

Essay: 28 Pages, Deadline:
16 days

nice work, the expert has followed the instruction properly, the marks have still pending grading.

User ID: 6***66 Kelowna, Canada

Finance

Assignment: 5 Pages, Deadline:
13 days

Thank you so much! It was a well-written and organized paper. Great job Thank you so much! It was a well-written and organized paper. Great job,,

User ID: 6***98 United States

Project Management

Assignment: 2.6 Pages, Deadline:
21 hours

Very quick delivery and great assignment. They worked as instructed and was prompt in their responses.

User ID: 4***61 Australia

Management

Assignment: 5 Pages, Deadline:
5 days

good Expert he do all the requirements as mentioned, I appreciate your efforts and I am so happy to do the assignment for me

User ID: 6***84 Saudi Arabia

Assignment

Assignment: 10 Pages, Deadline:
4 days

The research essay was prepared based on all the requirements provided. All the references were well placed.

User ID: 4***87 Australia

Assignment

Essay: 5.2 Pages, Deadline:
6 days

Learning Portfolio was well written and to the point/precise. It was updated based on my review. Prompt responses from the experts and the team

User ID: 4***87 Australia

Healthcare

Assignment: 8 Pages, Deadline:
5 days

All the requirements are well covered. There are good amount of articles referenced in the work. Thks

User ID: 8***91 Singapore

Assignment

Essay: 1.6 Pages, Deadline:
3 days

very high grade, good assignment, very quick service , easy to ready, professional

User ID: 5***21 Blanchardstown, Ireland

Mechanical Engineering

Home Work: 1 Page, Deadline:
23 hours

The assignment is good and i have submitted it. and i got good marks. I appreciate your good work.

User ID: 7***11 Canada

Management

Assignment: 1 Page, Deadline:
7 days

Just want to say thank you, better than I expected, came out with a B+, would recommend, and I would use again.

User ID: 6***05 Borehamwood, Great Britain

Management

Essay: 28 Pages, Deadline:
16 days

nice work, the expert has followed the instruction properly, the marks have still pending grading.

User ID: 6***66 Kelowna, Canada

Finance

Assignment: 5 Pages, Deadline:
13 days

Thank you so much! It was a well-written and organized paper. Great job Thank you so much! It was a well-written and organized paper. Great job,,

User ID: 6***98 United States

Project Management

Assignment: 2.6 Pages, Deadline:
21 hours

Very quick delivery and great assignment. They worked as instructed and was prompt in their responses.

User ID: 4***61 Australia

Management

Assignment: 5 Pages, Deadline:
5 days

good Expert he do all the requirements as mentioned, I appreciate your efforts and I am so happy to do the assignment for me

User ID: 6***84 Saudi Arabia

Assignment

Assignment: 10 Pages, Deadline:
4 days

The research essay was prepared based on all the requirements provided. All the references were well placed.

User ID: 4***87 Australia

Assignment

Essay: 5.2 Pages, Deadline:
6 days

Learning Portfolio was well written and to the point/precise. It was updated based on my review. Prompt responses from the experts and the team

User ID: 4***87 Australia

Healthcare

Assignment: 8 Pages, Deadline:
5 days

All the requirements are well covered. There are good amount of articles referenced in the work. Thks

User ID: 8***91 Singapore

Assignment

Essay: 1.6 Pages, Deadline:
3 days

very high grade, good assignment, very quick service , easy to ready, professional

User ID: 5***21 Blanchardstown, Ireland

Have any Query?

GET HELP WITH YOUR HOMEWORK PAPERS @ 25% OFF

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

Write My Paper Button

WeCreativez WhatsApp Support
We are here to answer your questions. Ask us anything!
👋 Hi, how can I help?
Scroll to Top