Answer:
the first option is obviously the correct answer
Answer:
The diameter of T is 2k+1.
See explaination for the details
Explanation:
We can compute the diameter of the tree T by a pruning procedure, starting at the leaves (external nodes).
Remove all leaves of T. Let the remaining tree be T1.
Remove all leaves of T1. Let the remaining tree be T2.
Repeat the "remove" operation as follows: Remove all leaves of Ti. Let remaining tree be Ti+1.
When the remaining tree has only one node or two nodes, stop! Suppose now the remaining tree is Tk.
If Tk has only one node, that is the center of T. The diameter of T is 2k.
If Tk has two nodes, either can be the center of T. The diameter of T is 2k+1.
Repost with the answer choices buddy
Answer:
userInput = input("Please enter a string of words ")
userInput.split ()
for item in userInput.split ():
if item =="darn":
print("Censored")
break
else:
print(userInput)
Explanation:
Using Python programming language, the input function is used to receive the users input and save in a variable userInput
Then the .split method is used to convert the words into a list of words.
Using a for loop, the code checks for the word darn and prints censored if it exists else it prints the userInput