Finally, we come to the concrete description of the module you must write. Write a module containing a single class TST that implements a trisection search tree that you can build, insert points into, search (find the node of a point if present), and query using the methods specified below. Save it in a file pointtree. py. Class TST instance attributes • key , a Point2 object or None child, a list of length three. Its items are either None or TST objects. • parent , a TST object or None method init_ Arguments: • key , a Point2 object or None , With default value None Behavior: • Stores key in the attribute of the same name • Initializes attribute child to be [None, None, None] • Initializes attribtue parent to be None Return value: • None method _str. Arguments: • None Return value: • A string in this exact format: TST (key=(1, 3), children=[00. ]) Here, after key= it shows the x and y coordinates of the Point2 object, in parentheses, separated by a comma. If key is None then key-None would be shown instead. In the square brackets after children= it shows three characters that indicate the types of objects in list child, with None represented by . and any TST object represented by @. This provides a visual indicator of whether the node has children, and if so, which ones. The example string indicates that the node has a child 0 and a child 1, but does not have a child 2.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Finally, we come to the concrete description of the module you must write.
Write a module containing a single class TST that implements a trisection search tree that you can
build, insert points into, search (find the node of a point if present), and query using the methods
specified below. Save it in a file pointtree. py.
Class TST
instance attributes
key , a Point2 object or None
child, a list of length three. Its items are either None or TST objects.
parent , a TST object or None
method _init_
Arguments:
key , a Point2 object or None , with default value None
Behavior:
• Stores key in the attribute of the same name
• Initializes attribute child to be [None, None, None]
• Initializes attribtue parent to be None
Return value:
• None
method
str.
Arguments:
• None
Return value:
• A string in this exact format: TST (key=(1, 3), children=[00. ]) Here, after key- it shows the x
and y coordinates of the Point2 object, in parentheses, separated by a comma. If key is None
then key-None would be shown instead. In the square brackets after children= it shows three
characters that indicate the types of objects in list child, with None represented by . and any
TST object represented by @. This provides a visual indicator of whether the node has
children, and if so, which ones. The example string indicates that the node has a child 0 and a
child 1, but does not have a child 2.
Transcribed Image Text:Finally, we come to the concrete description of the module you must write. Write a module containing a single class TST that implements a trisection search tree that you can build, insert points into, search (find the node of a point if present), and query using the methods specified below. Save it in a file pointtree. py. Class TST instance attributes key , a Point2 object or None child, a list of length three. Its items are either None or TST objects. parent , a TST object or None method _init_ Arguments: key , a Point2 object or None , with default value None Behavior: • Stores key in the attribute of the same name • Initializes attribute child to be [None, None, None] • Initializes attribtue parent to be None Return value: • None method str. Arguments: • None Return value: • A string in this exact format: TST (key=(1, 3), children=[00. ]) Here, after key- it shows the x and y coordinates of the Point2 object, in parentheses, separated by a comma. If key is None then key-None would be shown instead. In the square brackets after children= it shows three characters that indicate the types of objects in list child, with None represented by . and any TST object represented by @. This provides a visual indicator of whether the node has children, and if so, which ones. The example string indicates that the node has a child 0 and a child 1, but does not have a child 2.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY