How to find the position of minimum and maximum value in an array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find the position of minimum and maximum value in an array

If anyone knows to find about the position of an array..say me friends..

20th Sep 2018, 11:31 AM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
24 Answers
+ 1
Bebida Roja You have to read answers because its all writed... Futhermore when someone ask for code without post some try its very probable that he/she want make own assignements from othets... Luckly Dhiviya Thirumavalavan have admitted this and i trying to come to solution step by step (for make he leatn something) but all its unuseful if someone make his assignemer for he
20th Sep 2018, 2:46 PM
KrOW
KrOW - avatar
0
in algorithm header, std::find and std::find_if
20th Sep 2018, 11:38 AM
Bebida Roja
Bebida Roja - avatar
0
Calviղ I need in C language
20th Sep 2018, 11:47 AM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
0
Bebida Roja I can"t get your point friend
20th Sep 2018, 11:47 AM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
0
loop on array comparing items with current then return it for item in array if item is first or item its less than currmin currmin = item return currmin
20th Sep 2018, 12:54 PM
KrOW
KrOW - avatar
0
If you don"t mine can you say me elaborately
20th Sep 2018, 1:12 PM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
20th Sep 2018, 1:17 PM
KrOW
KrOW - avatar
0
KrOW I mean I am asking the C code to find position
20th Sep 2018, 1:23 PM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
0
Here a code I wrote some time ago that does exactly this. But its C++. https://code.sololearn.com/c9g908Z1Hh9K/?ref=app
20th Sep 2018, 1:25 PM
Bebida Roja
Bebida Roja - avatar
0
Dhiviya Thirumavalavan Sorry but i dont post code if user dont post his code.... I dont know you case but in general dont make other users assignements
20th Sep 2018, 1:35 PM
KrOW
KrOW - avatar
0
KrOW ok ok
20th Sep 2018, 1:41 PM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
0
Dhiviya Thirumavalavan This make me think that your is an assignement, right?
20th Sep 2018, 1:44 PM
KrOW
KrOW - avatar
0
KrOW yaa its kk.. I need to think on own.. There is nothing problem in it
20th Sep 2018, 1:47 PM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
0
Dhiviya Thirumavalavan Try always to find a solution yourself, in this way you will learn while dont happen if someone make it for you.... Try to simplify your problem... At example, can you give me a solution to find a min/max from 2 values?
20th Sep 2018, 2:11 PM
KrOW
KrOW - avatar
0
Here another code ive just made. It could easily be edited to create a Min class. https://code.sololearn.com/ccbO2j9ePEF0/?ref=app
20th Sep 2018, 2:15 PM
Bebida Roja
Bebida Roja - avatar
0
Bebida Roja You have understanded that his is an assignement? You know that this assignement is made for understand basic loop comprension? You have understanded that he need code it in C? P.S. Wow, create 3 template classes only for get max from some numbers... Practically really unuseful but good for experiment with template
20th Sep 2018, 2:27 PM
KrOW
KrOW - avatar
0
Useful in performance critical code as this gets calculated at compile time. And I dont think the teacher will accept this as a solution to the asignment. I wouldnt if he doesnt know what he is doing. And I didnt know it was needed in C :S
20th Sep 2018, 2:29 PM
Bebida Roja
Bebida Roja - avatar
0
Bebida Roja Then why you post these codes if he cannot understand they?
20th Sep 2018, 2:31 PM
KrOW
KrOW - avatar
0
It does what he asked, and fast.
20th Sep 2018, 2:31 PM
Bebida Roja
Bebida Roja - avatar
0
Also, the last specialization is not needed. It is just there because consistence, to be able to get the maximum of one number, but it is trivial.
20th Sep 2018, 2:35 PM
Bebida Roja
Bebida Roja - avatar