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
when ct ratio 50/5, 100/5,400/5 and 800/5 va:15,class:1 ilv:3 kv/-50hz sf<5 how to calculate kwh
My PC auto restart some times goes shutdown..is PSU 12V is responsible for it becoz its not ok as seen bios Hardware
I am a b.tech(IT) graduate.What are the b.tech subject topics i have to prepare for sbi clerk interview as i was told that q's will be there in our specialised subjects
Hi i have been selected in federal bank Po exam can somebody throw some light on what type of interview questions are expected??
The primary purpose of an operating system is....
I have a question, I'd like to know what does "roc" means? E.g. in Beyonce's song : Roc. She is singing: You are my roc, I love to roc with you and it's not a rock. Help me...
Dear All, If employee completed his/her probation period for 6 month and still continued, we can terminated him because he was misbehave with Director of the company or employee registered the complaint in labor court for compensation? Shazia Muzaffar
i am B.E Civil engineer 2 year exp in construction i want to job in singapore so pls tell me any best and trust oversea consultancy in chennai plzs help me
did anyone attended java 2+ exp interview in dec-2010?
i got job from icici bank as an PO and as a clerk in canara bank. which one is best to choose..
name the sikkim state bird?
what is the main difference between direct & indirect marketing?
which type of growth do you want?
what is hi... meaning
Sir I m doing US based CFA. and I m MBA Finance from Gujarat University. I have 3 years of accounting cum Audit experience in India and Dubai. How this can help me to have US Visa. Means what is more required to apply for the employment Visa. Please reply me. Means which type of Employment Visa can I have good support.. Please reply me. What is still needed for my eligibility. for the same.