Answer:
Explanation:
We start from the bottom-most and rightmost internal node of min Heap and then heapify all internal modes in the bottom-up way to build the Max heap.
To build a heap, the following algorithm is implemented for any input array.
BUILD-HEAP(A)
heapsize := size(A)
for i := floor(heapsize/2) downto 1
do HEAPIFY(A, i)
end for
Convert the given array of elements into an almost complete binary tree.
Ensure that the tree is a max heap.
Check that every non-leaf node contains a greater or equal value element than its child nodes.
If there exists any node that does not satisfy the ordering property of max heap, swap the elements.
Start checking from a non-leaf node with the highest index (bottom to top and right to left).
Answer:
c) it will always return with an answer of 7 or fewer comparisons of data.
Explanation:
As maximum number of comparison in worst case for sorted binary search is log₂n, here n = 100, so maximum search is at least 6.6 which is approximately 7.
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
<span>A. Mechanical i think sorry if im wrong</span>
It is known as a directory path