two plus operation per k
no of k =5
so 10 operations per i due to k
no of operations due to j =4 per i
So total 14 operation per i
no of i =3
total number of operation=14*3=42
Consider the following algorithm x 1 for E1, 2, 3} do for jE1, 2, 3, 4} do X x X for kE 1, 2, 3, 4, 5} do x X+ 1 LX x +...
Consider the following dictionary:T +3x, -1х, -1x2T 2 x3 11 4 -lx +lx -lx +1x +2x 3 6 0 Z Choose all of the correct choices for entering variables. d. Xд е. Xs С. Х, b.x а. х Consider the following dictionary:T +3x, -1х, -1x2T 2 x3 11 4 -lx +lx -lx +1x +2x 3 6 0 Z Choose all of the correct choices for entering variables. d. Xд е. Xs С. Х, b.x а. х
Answer B java Problem 2 For each problem given below, do the following: 1. Create an algorithm in pseudocode to solve the problem. 2.Identify the factors that would influence the running time of your algorithm. For example, if your algorithm is to search an array the factor that influences the running time is the array size. Assign names (such as n) to each factor. 3. Determine the number of operations in each step of the pseudocode. To do that, identify...
1.(3x)( Jx & Kx) 2. (x) (Jx Lx) / (3x)/(Lx & Kx) 1. (x)(5x *Tx) 2. (3x) (Sx & Ux) / (3x) (Ux &Tx) 4. 2. (x) (Nxo Mx) 3. Na /Oa 1.(3x)( Jx & Kx) 2. (x) (Jx Lx) / (3x)/(Lx & Kx) 1. (x)(5x *Tx) 2. (3x) (Sx & Ux) / (3x) (Ux &Tx) 4. 2. (x) (Nxo Mx) 3. Na /Oa
(2) Consider the following algorithm for the problem: for i = 1 to n do a binary search for -X[i] in Y[1 if found n] return true; return false; (a) (5 pts) What is the complexity of this algorithm? Briefly justify.
Copy of Consider the following algorithm: i+2 while (x mod i)=0 do iti+1 Now suppose x is an element from the set {n EN|2sn s50). What is the worst-case number of comparisons that this algorithm will perform? O O O O O O
Q4) [5 points] Consider the following two algorithms: ALGORITHM 1 Bin Rec(n) //Input: A positive decimal integer n llOutput: The number of binary digits in "'s binary representation if n1 return 1 else return BinRec(ln/2)) +1 ALGORITHM 2 Binary(n) tive decimal integer nt io 's binary representation //Output: The number of binary digits in i's binary representation count ←1 while n >1 do count ← count + 1 return count a. Analyze the two algorithms and find the efficiency for...
Consider the following virtual page reference sequence: page 1, 2, 3, 4, 2, 1, 5, 6, 2, 1, 2, 3. This indicates that these particular pages need to be accessed by the computer in the order shown. Consider each of the following 4 algorithm-frame combinations: LRU with 3 frames FIFO with 3 frames LRU with 4 frames FIFO with 4 frames . For each of the 4 combinations, below, move from left to right as the virtual page numbers are...
Exercise 1 Use Top-Down Design to “design” a set of instructions to write an algorithm for “travel arrangement”. For example, at a high level of abstraction, the algorithm for “travel arrangement” is: book a hotel buy a plane ticket rent a car Using the principle of stepwise refinement, write more detailed pseudocode for each of these three steps at a lower level of abstraction. Exercise 2 Asymptotic Complexity (3 pts) Determine the Big-O notation for the following growth functions: 1....
Given then following data pointsx(1) = (2, 8); x(2) = (2, 5); x(3) = (1, 2); x(4) = (5, 8)x(5) = (7, 3); x(6) = (6, 4); x(7) = (8, 4); x(8) = (4, 7)Compute 2 iterations of the K-Means algorithm by hand using the Forgy’s initialisation choosing x(3), x(4) and x(6). Calculate the loss function in each iteration.
Searching/sorting tasks and efficiency analysis - Big-oh For each problem given below, do the following: 1. Create an algorithm in pseudocode to solve the problem. 2. Identify the factors that would influence the running time of your algorithm. For example, if your algorithm is to search an array the factor that influences the running time is the array size. Assign names (such as n) to each factor. 3. Count the operations performed by the algorithm. Express the count as a...