U have an array of +ve integers arranged in the descending
order . Write a functionb thast take an integer & an integer
array as an integer and returns the position of the given
integer in the array , if the integer is not present in the
array it should return -1 . the serching technique that u
use should be very efficient both in terms of time & memory.
Answer Posted / sonu
int array[]={13,232,234,12,34,56,73,21,230,240};
int max ;
max = 230;
for (int i=1;i<array.length;i++){
if (array[i]==max ){
System.out.println
("Position of no"+max +"in array is "+i);
}else {
System.out.println("-1");
}
}
| Is This Answer Correct ? | 2 Yes | 12 No |
Post New Answer View All Answers
who is the cricter to score century in odi is the don bradman or other then this
iwant to join testing in mind q.is there any new batch will start for testing? i heard that nageswarao is not in mindq he started another institute which one is better? i also want to know the fee deails & duration of the course.
What is Micro-kernel? What are the benefits of Micro-kernel?
ph is 4.01,6.86,9.18 mv value 184.7,19.0,-110.7 how to calculate slope manually
can any one help me ,i'm appearing syndicate bank clerical exam on 27-6-10
i had an backlog in my engg finial year.so i am counted as 2008 or 2009 passout for applying to IT companies? so what should i keep it in my resume thanks in advance.
what is the shortkey of print preview in M.S. EXCEL?
why you want to leave your existing company & join our company?
What types of challenges have you faced in the past two years and how did you overcome them?
Hi, i have been selected for abhyudaya clerk interview but dont have the application print out. Will i be allowed for interview?
what are points to be kept in mind while purchasing consumers for CSD?
international resume format
do any one faced sbi interview. If yes please share ur experience
I m doing a job in a psu as distribution engineer. Now I m looking for a job in an electrical manufacturing company where I can boost up my professional knowledge.i dont have such experience for getting such a job . Pls suggest me how to shift from distribution to manufacturing.
Sir me s.I ke bare me janna chahta hoo.s.I banne ke liye kya kya common chahiye .mene is sal isc diya.