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



Min-Max Write an algorithm that finds both the smallest and largest numbers in a list of n numb..

Answer / lolo

# include<oistream.h>

Is This Answer Correct ?    6 Yes 6 No

Post New Answer

More C++ Code Interview Questions

Code for Two Classes for Doing Gzip in Memory?

0 Answers  


An array of size 5X5 is given to us. The elements from 1 to 25 are to be inserted in the array, such that starting from a particular position for an element i, the next element i+1can be inserted only at the mentioned positions (u,v), and if these all positions are occupied then it returns giving a count of how many positions have been occupied in the array: (u,v) = (x+/-3 , y) (u,v) = (x , y+/-3) (u,v) = (x+/-2 , y+/-2). Example: if the starting element is 1 with the given positions (1,2), then next element 2 can be placed at any one of the positions marked with *. _ _ _ _ _ 1 _ _ _ * _ _ _ _ _ _ _ * _ _ * _ _ _ _

0 Answers   Nagarro,


write a program in c++ to scramble a bmp image file using a scramble key 0x7c and an XOR logic. print out the original image, the scrambled image and the program. Note: the first 24bytes of a bmp file contain the header information of the file.

1 Answers  


Write a simple encryption program using string function which apply the substitution method.

0 Answers  


Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.

0 Answers  






1.program to add any two objects using operator overloading 2.program to add any two objects using constructors 3.program to add any two objects using binary operator 4.program to add any two objects using unary operator

2 Answers   IBM,


What output does the following code generate? Why? What output does it generate if you make A::Foo() a pure virtual function? class A { A() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; class B : public A { B() { this->Foo(); } virtual void Foo() { cout << "A::Foo()" << endl; } }; int main(int, char**) { A objectA; B objectB; return 0; }

0 Answers  


write a program to perform generic sort in arrays?

0 Answers  


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

0 Answers  


Write A C++ Program To Input A Number Between 20 To 99 And Display Its Numbername?

3 Answers   TCS,


Show by induction that 2n > n2, for all n > 4.

2 Answers   Karvy, Qatar University,


Given 1 to n distinct random number of which n+1th element was duplicated. How do find the duplicate element and explain the time complexity of the algorithm.

0 Answers   Microsoft, NetApp,


Categories