Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this homework assignment you will be designing an algorithm that takes a tax

ID: 3554420 • Letter: F

Question

For this homework assignment you will be designing an algorithm that takes a taxonomy tree as its input and returns a string that contains the type of "item" (animal, plant, etc) that was found after traversing the tree. The tree will be inputted as a fixed size array of strings, you will have an additional parameter of type size_t called size.

Your algorithm will read the string that is contained in the array and print it to the screen as a question. You will then accept input from the user in the form of yes or no (you can decide what representation to use, but inform the user what to type for yes and no). If the user answers yes, you will go to the left child, if they answer no you will go to the right child. Once a leaf is reached you know that you have your result.

remember that an algorithm is pseudocode.

Also, I would like you to list the time complexity for your algorithm.

Explanation / Answer

Algorithm:

start

declare string[size]

enter values into the tree

loop from 0 to size

    display string

    read y/n

    if 'n'

          traverse right-node

          if leaf reached

                display leaf

else

          traverse left-node

          if leaf reached

                display leaf

end loop

stop

Time complexity:

O(log N)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote