Min-Max

Write an algorithm that finds both the smallest and largest
numbers in a list of n numbers and calculate its complexity
T(n).

Answer Posted / lolo

# include<oistream.h>

Is This Answer Correct ?    6 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a program using 2 D that searches a number and display the number of items 12 inputs values input 15,20, 13, 30, 38, 40,16, 18, 20 ,18 ,20 enter no. to search : 20

3355


Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.

4566


Code for Easily Using Hash Table?

2379


Code for Two Classes for Doing Gzip in Memory?

2801


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!!!)

3255






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

3182


Code for Small C++ Class to Transform Any Static Control into a Hyperlink Control?

2549


write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150

3255


Definition of priority queue was given. We have to implement the priority queue using array of pointers with the priorities given in the range 1..n. The array could be accessed using the variable top. The list corresponding to the array elements contains the items having the priority as the array index. Adding an item would require changing the value of top if it has higher priority than top. Extracting an item would require deleting the first element from the corresponding queue. The following class was given: class PriorityQueue { int *Data[100]; int top; public: void put(int item, int priority); // inserts the item with the given priority. int get(int priority); // extract the element with the given priority. int count(); // returns the total elements in the priority queue. int isEmpty(); // check whether the priority queue is empty or not. }; We had to implement all these class functions.

4386


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

2828


write a program to perform generic sort in arrays?

2610


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

2058


write a program that prompt the user to enter his height and weight,then calculate the body mass index and show the algorithm used

4294


what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }

2055


How can I Draw an ellipse in 3d space and color it by using graph3d?

2122