question archive please answer the question below
Subject:Computer SciencePrice:9.82 Bought3
please answer the question below.
(15) 2a. Devise an algorithm to compute x" where x is a real number not equal to 0 and n is an integer that can be positive, negative, or zero. b. What is the best O-notation for your algorithm? Why? (15) 3. Analyze the worst-case, best-case, and average-case number of comparisons of sequential search if exactly one-sixth of the time, the clement x to search for is not in the list and if x is in the list, it is equally likely to be in any position. a. Worst-case number of comparisons b. Best-case number of comparisons c. Average-case number of comparisons Show your work for part c here:
An algorithm is step by step procedure that is used to solve a problem especially by a computer, Big O notation is indeed a mathematics expression that represents a function's limiting behavior as the input approaches a specific number or infinitely.
Step-by-step explanation
2a)
[x]n Algorithm
where X>0
if n=4
then x = [x][x][x][x]
n = number of its square
2b) O(1). This is because it is not in either way affected as the data grow bigger and bigger
3
a. In the worst case scenario the algorithm will take a lot of time if X is not in the list and if it is in the list.
b. In the average case scenario the algorithm will take an average amount of time if X is not in the list and if it is in the list.
c. In the best case scenario the algorithm will take the least amount of time if X is not in the list and if it is in the list.
Please see attached file