Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please I have exam after 3 days in this course and I need a tutor to be ready with me how can I contact u
please I have exam after 3 days in this course and I need a tutor to be ready with me how can I contact u guys ? here I coukdnt find my answers always found a somthing similar which is unusefull
Question I - Bubble sort (20 pts] Show the steps of sorting the following array using the Bubble sorting algorithm (No Java Code). In each step you should draw the content of the array: 31 8 16192 15 13 Question II - recursive method [30 pts] Part-A: Given the following recursive method: public static int method(int a, int b){ if(a>b) {int r=a%b; if(r ==0) return b; else return method(b, r); a- Give the output of this method when a is 15 and b is 10. And also when a is 24 and b is 16. b- Based on your results in part a, conclude what does this method do. Part-B: Write a method that fills an array of n elements in a recursive manner Question III -Linear Search (30 pts] Consider the following array composed of 10 elements: 20 31 | 15 | 110 1815 14 35 15 Suppose that we are doing a linear search to return the index of 15 if it exists. Write in detail the steps needed. What is the complexity of such algorithm? Write a recursive method that linearly search an element in an array of size n and return the index of that element (if exist) and -1 otherwise. Search(int A[], int n, int element) Question IV - Time efficiency (20 pts] Find the complexity of the following program, Justify your answer: Void main() { Void mainot int x=0; for(i=n; i>0; i=i/2) int x=0.y=0); for(i=n; i>=1; i--) for(j=i-1; j>=0; i--) { x++; 1 for(j=n; j>0; j=j/2) { x++; 3Step 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