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


Please Help Members By Posting Answers For Below Questions

i had an backlog in my engg finial year.so i am counted as 2008 or 2009 passout for applying to IT companies? so what should i keep it in my resume thanks in advance.

1455


is there any company in India where you can earn money from home by doing job online

1385


similarly boy propose girl but in this case girl propose boy?

1216


Brief me about plug and play technology?

1789


i m from engineering background and now i want to go banks....if the question will asked that why u prefer the bank job while u r from technical background?

1555






When Dena Bank po 2017 will be held????

1187


Can you tell me which coaching classes is best for banking in chennai?

1691


Why only sulphuric caid used in residue on ignition, not other acids.what is its special property

1569


Thyristor convertor type AVR(Automatic Voltage Regulator) is made of Thyristors(Silicon Controlled Rectifiers,SCRs). We know that output DC voltage from an SCR will not only depend upon the r.m.s. value of Input voltage applied, but also at the angle at which the input AC cycle is fired (using gate signal). If the firing angle is zero(in a simple circuit), then maximum DC output voltage will be obtained.If the firing angle is changed from 0 to 180,then maximum to minimum voltage is obtained. This property could be used to build an AVR. The firing angle proportional to Output voltage could be used to trigger the thyristor,in a closed loop manner and a nearly constant DC voltage(Average Value) can be obtained.An invertor circuitory could be utilised to get a regulated AC supply. Many other configurations can be build from thyristors to get a regulated AC supply.

6546


Who is the best football player in the world?

834


I want sylabs of cleark test of H A U HISAR

1670


What. Is. This sap mining

1720


sometimes when we touch other person's hand we feel a minor (current like) shock, why so?

1634


waht is your srength and weakness?

1773


what sort of trainings would benefit you in the next year? not just job skill but also your natural strength and personal passion

1022