Min-Max

Write an algorithm that finds both the smallest and
largest numbers in a list of n numbers and with complexity
T(n) is at most about (1.5)n comparisons.

Answer Posted / rajashree

3n/2-2

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

7331


How to swap two ASCII numbers?

2442


how to take time as input in the format (12:02:13) from user so that controls remains between these columns?

1813


find level of following tree (state, parent) " J,D I,D H,C E,B F,B G,C B,A D,A C,A A,& K,E L,E L,F M,F N,G O,H P,I P,H Q,I R,J S,K U,P T,L

2002


Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?

2908






output for printf("printf");

1977


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

3266


How to Split Strings with Regex in Managed C++ Applications?

3120


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

3186


write a program that reverses the input number of n.Formulate an equation to come up with the answer.

7028


write a program using virtual function to find the transposing of a square matrix?

2837


can you please write a program for deadlock that can detect deadlock and to prevent deadlock.

2736


write a program that reads a series of strings and prints only those strings begging with letter "b"

2668


write a program to calculate the amount of investment after a period n years if the principal investors was p and interest is calculated using compound interest,formular=a=p(1+r)^n

2364


write a program to convert temperature from fa height into celcius and vise versa,use modular programming

2434