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
how to eject cd/dvd through command?????
How The Resume Will Be....?
hii,anybody got joining letter in dfo(gd) 2013.PLZZ mail me at rahuldikshit7@gmail.com
I am having the inbuilt Webcam in my Laptop, I want to sent the pictures using webcam to others. Please tell me the steps?
How we use ABC analysis at store for inventory control
Mahatma Budhy got enlightment under the Banyan tree (Bat briksha) then why there are peepal tree in Bodh Gaya
Is there any institution for giving graduate degree in one year?
HELLO FRIENDS,I AM ABHAY KUMAR IM HISTORY HON AND I HAVE QUALIFIED IBPS PO EXAM .CAN U SUGGEST ME WHAT KIND OF QUESTION CAN ASK IN INTERVIEW ??
breif about your sefl?
HI,Please Give me the suggestion to join in Sristek,Hyderabad to work on SAS?Please tell me how is this company? and how the career in this company????
what is insurance what is insurance?
as i have two rejections on my passport is this affect my approval for visa and whether they will ask me any questions related to past interview done plz inform me soon as my interview is on 20 july
sir/madam, i would like to know the work for fresh engineering electrical graduates in psu,ies etc.,
what are the environmental problems associated with the match industry?
my parents resides in us and i have no reason to say why i will come back plz tell me what answer i will give as my interview is on 20 july