Question: Using Python 1. Create two BSTs using the following two data orderings a. 2, 12, 14, 11, 9, 21, 24, 10, 4, 18 b. 18,
1. Create two BSTs using the following two data orderings a. 2, 12, 14, 11, 9, 21, 24, 10, 4, 18 b. 18, 4, 10, 24, 21, 9, 11,14, 12, 2 2. For the trees you constructed in question 1. perform a breadth first search (BFS) using a queue as described in lecture. For this problem, you must implement your queue in a manner similar to the End of Module 1 Assessment (i.e. your queue must be implemented in the form of a linked list). 3. Remove the node containing the value 12 from the trees you constructed in question 1. Perform a BFS on both of the edited trees. class lite definitel, a1, A2,3) sett. self.222 self as a self.ext one class Aseet definit__(self): self.free self.reare verste def length return (self size) def spyser) return selfs oef Engutuselt, az , ) self.121 templice (2,3) if(self.rearstone) self fronterest return self.rer.net self.rar de Deus if self. Ispty) return tenpelf.front self.front tot riset.fronto) self.rear None set.size 12-1 of peeksel) if(set.si) print("Queue is Empty") print("the front element of the gre 181) print("Attributet seit front.al.Attributes.front.. Attributes: front det printourself) if(self) print("The queue is Empty) se: print("queses) tepiseir front willeten): print("attributes ten. Attributes to 2 Attribute - p.60) Queue queue Queue Engecat", 60, 61,2,3) QURU.Ene 33.4.4.5.0 queue.queue "stake. 11.2.17.0,01) week) print("The length of Qurce is cute. Length> gue Deveur print the length of Qurve qurur. length)) print) SAMPLE OUTPUT: The front element of the queue 21 Attributes: Cat Attributes 60.5 Arte: 11. 2. * The length of Queen! The length of Queen? Attributexi Dog Attribute21 39.4 Attribute: 14, S. 5) Attributoit Share Attributed: 11.2 Attributes: 11, 8, 1. Create two BSTs using the following two data orderings a. 2, 12, 14, 11, 9, 21, 24, 10, 4, 18 b. 18, 4, 10, 24, 21, 9, 11,14, 12, 2 2. For the trees you constructed in question 1. perform a breadth first search (BFS) using a queue as described in lecture. For this problem, you must implement your queue in a manner similar to the End of Module 1 Assessment (i.e. your queue must be implemented in the form of a linked list). 3. Remove the node containing the value 12 from the trees you constructed in question 1. Perform a BFS on both of the edited trees. class lite definitel, a1, A2,3) sett. self.222 self as a self.ext one class Aseet definit__(self): self.free self.reare verste def length return (self size) def spyser) return selfs oef Engutuselt, az , ) self.121 templice (2,3) if(self.rearstone) self fronterest return self.rer.net self.rar de Deus if self. Ispty) return tenpelf.front self.front tot riset.fronto) self.rear None set.size 12-1 of peeksel) if(set.si) print("Queue is Empty") print("the front element of the gre 181) print("Attributet seit front.al.Attributes.front.. Attributes: front det printourself) if(self) print("The queue is Empty) se: print("queses) tepiseir front willeten): print("attributes ten. Attributes to 2 Attribute - p.60) Queue queue Queue Engecat", 60, 61,2,3) QURU.Ene 33.4.4.5.0 queue.queue "stake. 11.2.17.0,01) week) print("The length of Qurce is cute. Length> gue Deveur print the length of Qurve qurur. length)) print) SAMPLE OUTPUT: The front element of the queue 21 Attributes: Cat Attributes 60.5 Arte: 11. 2. * The length of Queen! The length of Queen? Attributexi Dog Attribute21 39.4 Attribute: 14, S. 5) Attributoit Share Attributed: 11.2 Attributes: 11, 8
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
