Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The algorithm depicted below is the C implementation of an algorithm called Poles. Examine and analyze the algorithm's implementation code carefully then answer the
The algorithm depicted below is the C implementation of an algorithm called Poles. Examine and analyze the algorithm's implementation code carefully then answer the following questions. Show all detailed working. int Poles(int Hold[], int n, int p) } for(int i = 0; i < n; i++) { if(Hold[i] == p) { return i; } else 1 } } } return -1; a) What problem type does the algorithm's code appear to be addressing? [1 mark] b) What algorithmic category does the algorithm's code seem to be using? [1 mark] c) What is the Big O run time efficiency of the algorithm's code exactly as it is? [4 marks] d) Does the algorithm's implementation appear to be correct? If not, explain why and give the correct implementation without changing the algorithmic category, otherwise give back the correct code as is [2 marks] e) What is the Big O run time efficiency of the correct code given in d)? [4 marks] Show all your detailed diagrams and detailed workings in obtaining your answer. You can use a word processor, drawing program, etc to create and upload your answer here, or you can do your answer with pencil/pen and paper then take a picture of it and upload here. You can also type your answer in the text box.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started