Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me to write this program in python, which take the input and return output like above mplement binary search tree for integers. There

image text in transcribed

image text in transcribed

please help me to write this program in python, which take the input and return output like above

mplement binary search tree for integers. There is a file "VSTUP.TXT" containing lines with commands. Every command s on separate line. Read command must be copied to standard output. The commands are: - P - Print the structure; every level of the tree is indented by two spaces in comparison to the level above, initial indentation is 0 ; the subtree with lower values is printed first, than with the higher ones. Each item is printed on a separate line. - I- Insert item; behind the instruction (letter I) is a space and then the value to be inserted; after insertion it should be reported on a separate line "Prvek vlozen" (if the insertion was successfull), or "Prvek uz ve strome byl" (if the item has been in the tree before). - D - Delete the item; behind the instruction (letter D) is a space and then the value to be deleted; after deletion it should be on a separate line reported "Prvek vypusten" (when really deleted), or "Prvek ve strome nebyl" (when the item has not been in the structure). When deleting an item having two ancestors it should be used the smallest from the bigger ones. Program prints on standard output. Sample input: Sample input: I 10 I 20 I 15 I 20 P D 10 P Sample output

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

Database Management System MCQs Multiple Choice Questions And Answers

Authors: Arshad Iqbal

1st Edition

1073328554, 978-1073328550

More Books

Students also viewed these Databases questions

Question

How can respondent selection problems be controlled?

Answered: 1 week ago

Question

What is a NAT firewall and how does it work?

Answered: 1 week ago