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 / argho
function desc
begin
Ineger i;
Array a[n];
x=1;
y=n;
1. for k=1 , loop from x to y while array[n] / 2;
temp[a]= a[n]/2
if temp[a] < i
call step 1 with argument x=1 y=n/2
else if temp[a] > i
call step 1 with argument x=(n/2)+1 y=n
else
return position
end
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
What problems do you faced at work? ( apply for condominium admin staff post )
hi, i've cleared union bank of india's clerical cadre written exam. and called for interview on 18th of this month. I dont have the copy of fee payment challan and print out of online application. whether these things are very important or not?
sir, i completed my diploma at 2009,den i joined in a degree course but i didnt completed my btech due to some problem.so now 2012, dat means three years gap.i want a job in it sector.but in most companies,they want btech candidate.so wat type of problem'll come if i produce fake btech critificate???? they'll varify my qualification? and wat'll happen if they found my critificate's r false after getting job?
Why Amartya sen got Nobel prize? how his theory proved useful for developing nations?
My D.O.B is 13/06/1990. How to write date of birth in christian era?
sir, when will start the new batch for group2 coaching... pls kindly inform me.......
which is the best engineering college in vijayawada
I heard about online data entry job and is this job safe, legal to do at home. How I will find a good online job to do at home ?
what is CRR?
Q.1)IM A UK BORN PERSON. NOW IM MARRIED AND HAVE TWO KIDS THAT HOLD PAKISTANI NATIONALITY.NOW I WANT TO APPLY FOR UK VISIT VISA.WHAT ARE THE REUIREMENTS THAT ARE NEEDED TO BE FULFILLED FOR THE VISA?
hi im studing in MCA final yr. Now i need to do project. im more intrested on web... can any one suggest me which will be better 1 n more easy to do. As i dont know wht is the meaning of project atleast... n im very teens... so plz help me out....
hi friends hey i need a help. i m doin my 6thsem(B.E) i need to do a project on opengl(graphics). so can u please suggest me some good topics for my project.M NOT GETTIN ANY IDEA OF WAT TO DO. PLEASE INFORM ME as soon as possible. it shud be simple and innovative.
hi friends, i completed MCA and searching for software jobs. but i cleared SBI clerical written and called for interview. at this time what is better? joining as clerk in SBI or to wait for some time and getting a job as a s/w engg ? please suggest me. will there be career growth in SBI?
HI ANYONE GET OFFER LETTER WHO ATTEND THE IBM GURGAON INTERVIEW ON 22ND AUG 2010 ON ORACLE DBA
what is the type of supply((AC or DC) used to HT motors?