Answer:
It balances a tree when a long path exist in the left subtree of the left of the root.
Explanation:
Rotation is an operation which is performed on the binary tree which changes the structure of the binary tree but it does not interfere with the order of elements.
A single right rotation strategy is basically for re balancing the tree.When there is along path which exists in the left subtree of the left of the root.
Answer:
b. 16
Explanation:
The given PHP code segment consists of 2 statements.
$str="The quick brown fox jumps over the lazy dog";
This defines a variable $str and assigns the given text to it.
echo strpos($str,'fox');
This statement prints the location of 'fox' in the text associated with the variable $str.
Upon execution it will print the value 16 which corresponds to the position of 'fox' in the given sentence.
Answer:
#here is code in Python.
#read the value n from user
n=int(input("enter the value of n:"))
#variable to store the total sum
sum_n=0
for i in range(1,n+1):
# find the sum of series
sum_n=sum_n+1/i
#print the sum
print("sum of the series is: ",sum_n)
Explanation:
Read the value of n from user. Create and initialize a variable sum_n with 0. Run a for loop to calculate sum.Initially sum_n is 0, then for value of i=1 1/i will be added to the sum_n.Then in next iteration for i=1, 1/2 added to sum_n. Similarly loop will run util i equals to n.Then sum_n will store the sum of the
series.
Output:
enter the value of n:5
sum of the series is: 2.283333333333333
The answer is option C: Use ground-fault circuit interrupters, and inspect extensions cords and portable tools.
Inspecting the extension cords needs to be done constantly, or there can be abrasions or cuts that won't be noticed. Option B remains one of the most important ways to be safe around electricity. Always wear non-conductive safety equipment, such as safety goggles or rubber gloves. You should also avoid touching exposed metal. Option C indicates one of the two ways that do not help you stay safe around electricity. A ground fault interrupter only works if there is a short circuit or a huge amount of energy going through that point and thus, will not effectively protect you from possible incidents with electricity.