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
I know the ip address of a website(for example ip address of www.yahoo.com is 69.147.125.65). How can i use this ip address to open the website instead of typing the url www.yahoo.com in the browser.
can i attend the syndicate bank PO exam 2010 as my date of birth is 20th may 1980.
what will be the total salary for a newly recruited taluk social welfare officer in karnataka ( Gazetted Group B Officer)
What are the test cases for booking one ticket for same movie, for same time but many users.
Hi friends I was selected for SBI clerical interview and my interview is on may 7 I completed B.sc Computers wat are the questions to be asked regarding computers.....can u pls post the answer for me.........JO
What is F.O.R.
WHAT IS MENING OF FICR
Hi, I have passed the SBI SO written exam for the post Ass.Manager(Systems) . Could anyone help me with the interview type and questions? Thanks bjdas1987@gmail.com
How to set tracing level for PowerCenter Informatica. Do we need to give tracing level in each and every mapping or is there any option to change tracing level commonly for all mappings. ?
Out of the original and duplicate copy of form "C" received from the customer on interstate sale - which copy is to be submitted to the department ?
Hi friends I am sasi,Got selected for Syndicate Bank PO.I dont have any idea about Banking sector.I dont know how to prepare for the interview.Can anyone help me plz
How many pages are in 1 coil?
Cosmos bank is nationalised or Not..?
what is CTD format?
Can someone please give me contact details of Mr Chanchal Saxena. He has previously given advice on SAP as a career