Solve the following time complexities
a) T (n)= n∑ n∑ 1
i=1 j=1
b) T(n) = n-1 ∑ n∑ c
i= 0 j= i+1
c) T(n) = n ∑ 1
i= 1
Implement Binary Search Tree class with insertion, deletion, preorder, postorder, and inorder traversal functions.
Analyze the time complexity of the following segments
Program:
sum1=0;
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
sum1++
sum2=0;
for(i=1;i<=n;i++)
for(j=1;j<=i;j++)
sum2++
Write down the Boolean Table AND the Boolean Expression that models
the circuit that engineers two light switches A and B at the two EXITS
of a huge conference center. The specifications are as follows:
(a)Both light switches operate the one common light in the room.
(b) The light is off when both switches A and B are OFF. That would
mean that A = B = 0 implies the light is OFF = 0.
(c) Flipping either switch will turn the light ON = 1.
(d) Following (c) flipping either switch will turn the light OFF = 0.
(e) We can go back and forth between (c) and (d). Flipping either
switch A or B will turn the light OFF = 0 if it is ON = 1 and ON = 1
if it is OFF = 0
Find an optimal solution for the knapsack instance n (number of objects) =7 and
W ( totalweight) =15. Profits and weights of each object are shown below:
(p1, p2………..p7) = (10, 5, 15, 7, 6, 18, 3)
(w1, w2………w7) = (2, 3, 5, 7, 6, 4, 1)
Show all the steps.
Consider Following list of elements, Show arrangement of elements until four numbers of iterations
while applying Selection, Insertion, and Bubble Sort Algorithms.
2, 6, 1, 8, 9, 7, 10, 24
Solve the following time complexity
T(n) = ∑ ∑ 1
𝑖
𝑗=0
𝑛−1
𝑖=1
b. Write an algorithm/pseudocode for a movie rental company that wants to screen their customers from 18years and above. The system should be able to deny access to customers that appear below 18. (8pts)
c. Draw a Flowchart to illustrate the above program.
b. Write an algorithm to determine the average of any six (5) numbers and display the below after: The sum, the product and the average.
c. Describe what is a variable and how is it used in a program.