recategorized by
521 views
1 votes
1 votes

Write C Program using Recursive Funtions for the Problem Described below and Analyse the Complexity Of the Code

Problem

Given an unordered array  arr[]  which contains n distincct numbers .  Propose a method which output the number which is neither maximum nor minimum . The algorithm / code  you propose should take minimum running time only. (Writte the code in C language)

[ hint : Do not spent time in sorting the array . Go for a direct method using Recursive Functions  ]

recategorized by

2 Answers

0 votes
0 votes
time complexity will be o(1) because we have to check only first three or any random three numbers present in array. thus the problem is independent of n.

Related questions

0 votes
0 votes
2 answers
1
radha gogia asked Jul 7, 2018
1,544 views
foo(int n) { for(int i=0 ; i<n ;i++) for(int j=i ; j<=i*i ;j++) if(j%i==0) { for(int k=0;k<j;k++) printf("hii"); } } How to proceed here for analyzing the time complexity...
0 votes
0 votes
1 answer
2
aka 53 asked Nov 22, 2017
268 views
i = n;While(i 0){ i= i/2;}
1 votes
1 votes
1 answer
3
Archies09 asked Apr 23, 2017
3,179 views
What will be the output of the program?#include<stdio.h int addmult(int ii, int jj) { int kk, ll; kk = ii + jj; ll = ii * jj; return (kk, ll); } int main() { int i=3, j=4...
0 votes
0 votes
1 answer
4