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

When will axis bank announce the result of exam held on 20th june 2010 of western zone?

1610


which type of growth do you want?

1438


Difference between Windows Vista and Windows XP professional?

1941


is there any jobs for 15 year olds?

1649


How to set tracing level for PowerCenter Informatica. Do we need to give tracing level in each and every mapping or is there any option to change tracing level commonly for all mappings. ?

2293






How much amount we have to pay octroi Charges for food items in Hyderabad

2779


iam getting offers for back door process .form the comapanies medhasolutions,lanticsolutions,precessglobal.inc(banglore) cybate commitment 1 lakh salary 1.44per annum mind tech soft commitment 90000rs salary 1.44per annum profilent commitment 90000rs salary 1.80per annum config commitment 70000rs salary 1.20per annum v one infotech commitment 1 lakh salary 1.44per annum finch commitment 90000rs salary 1.44per annum bin soft tech commitment 1.20 lakh salary 2.40per annum impact commitment 1 lakh salary 2.44per annum jkl consol commitment 1 lakh salary 1.8 - 2.4per annum oligoi solutions commitment 1lakh 2.64 per annum plz tell me which one to beleve if any one know details plz send me msg @9885090595

2744


I am selected as DEO IN kerla cag anybody wants mutual transfer i want in northern india Like up delhi punjab etc Call me 7275639235 7275219235

1218


what is the intention of Central excise act for making diff betn production and manufacture?

1514


WHY DO YOU WANT TO JOIN AS CLERK IN BANK AFTER M.SC IN BIOTECHOLOGY

3785


What is the most difficult situation you have ever faced in your life?

2554


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

1871


why assay by HPLC as per USP is necessary in testing if assay by potentiometry as per EP is already analysed un stability study

1369


please tell me what type of question ask in back office interview.

5759


Tel me da fee structure of RACE?

2106