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
Hi, I Have have completed my Post graduation in Msc(Comp Science) I want to apply for research in india or abroad How to apply? When to Apply? Even i am preparing for GRE exam. Please provide me with your valuable guidance to shape up career... Thanks :)
how to prepare for exam for the post of DIPLOMA TRAINEE at HAL and also i want previous question papers.please send me.
being a science how can u help a bank if we give u a job in a bank
how to select a topic for project in final year?
Under which situation you need to create abstract method.
I have been selected for clerical interview of SBI..my interview is scheduled on 3rd may 2010...if anybody have attented before that plz tell me which type of questions they r asking..
Can you send me some general information about rain forests (or climate change, pollution, food, etc.) for my information?
how to prepare for upcoming group-1 exams.what is the material is best suit for preparation of group-1.
what is capital,finance in accountancy??????????
hi i have been salected for interview of sbi clerk plz send me some questions that often asked in interview hall
please do tell me who the editor-in-chief of the Asian Age is as of 2011-12
why did you leave your previous job?
Which is the World’s Warmest Sea?
i m from engineering background and now i want to go banks....if the question will asked that why u prefer the bank job while u r from technical background?
i have tested one module at the i found one defect for it. it is fixed by developer but i want to know the impact of these defect on other module which has dependency on defect found module. Other than regression how we will use best practice for to find any impact on other module as it's near to deadline for testing