Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me to write this exercise in python. mplement binary search tree for integers. There is a file VSTUP.TXT containing lines with commands. Every

Please help me to write this exercise in python.

image text in transcribed

image text in transcribed

image text in transcribed

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 ommands 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: IIIIPDP1020152010 Sample output: Sample input: IIIIPDP1020152010 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

Students also viewed these Databases questions

Question

Identify cultural barriers to communication.

Answered: 1 week ago