Coders Packet

Minimum or Maximum value in a range of an array efficiently using C++

By Shaik Jafar

User inputs an array and this can give the minimum or maximum value in the range L to R of the array according to the queries given by the user, using C++ programming language.

In this project, the length and the values of the array on which the queries would be processed are given by the user.

Then the user should give the number of queries he/she wants to process followed by the queries.

 

Each query should be of the form L R TYPE

where,

L = Left boundary of the query range.

R = Right boundary of the query range.

TYPE = Type of the query, it can be of "MIN" or "MAX".

L R MAX illustrates that the user wants the Maximum value in the range L to R and

L R MIN illustrates that the user wants the Minimum value in the range L to R. )

 

Note: It will intimate the user if he/she inputs an invalid query i.e. Range is out of bounds of the array, TYPE is neither "MAX" nor "MIN".

The user can interact as follows:

Download Complete Code

Comments

No comments yet