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
What is the difference between Tinanium Debit card and Platinuim Debit card?
what are the important points to consider in scrutiny of trial balance?
what is the meaning of AKALIYAT ?
IS ANYONE GOT OFFER LETTER WHO ATTENDED THE IBM (CMR COLLEGE) HYDERABAD INTERVIEW ON APR 12 & 13, 2012
what is diffrence windows 98 and 2000
what may be the reasons for the degrawth of a market ? How to graw an week market
what will be the best answer for why do you want to change?
hi has anybody faced SBI associates PO GDPI? mine is on 29th. please share
which state is the leading producer of apples in india..?
what is your responsibilities of your job?
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.
Wich is the best study centare for sap fico module in hydarabad? .......urget. Plzz give me u r opinion...
What is the difference between subjective and objective career?
i need sponsor for my family in USA
Tell me about your school