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


Please Help Members By Posting Answers For Below Questions

What is the difference between Tinanium Debit card and Platinuim Debit card?

1632


what are the important points to consider in scrutiny of trial balance?

2506


what is the meaning of AKALIYAT ?

3290


IS ANYONE GOT OFFER LETTER WHO ATTENDED THE IBM (CMR COLLEGE) HYDERABAD INTERVIEW ON APR 12 & 13, 2012

2283


what is diffrence windows 98 and 2000

1815






what may be the reasons for the degrawth of a market ?     How to graw an week market 

1749


what will be the best answer for why do you want to change?

1506


hi has anybody faced SBI associates PO GDPI? mine is on 29th. please share

1934


which state is the leading producer of apples in india..?

1695


what is your responsibilities of your job?

1590


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.

2029


Wich is the best study centare for sap fico module in hydarabad? .......urget. Plzz give me u r opinion...

1561


What is the difference between subjective and objective career?

1613


i need sponsor for my family in USA

1496


Tell me about your school

1061