Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Given an array of length N containing integers between 1
and N, determine if it contains any duplicates.

Answer Posted / sid

duplicate = False;
for (i =1; i <= N; i++)
{
a[a[i] % N] += N;
}

for (i =1; i <= N; i++)
{
if (a[i] / N >= 2)
{
duplicate = True;
}
}
return duplicate;

Is This Answer Correct ?    14 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between mpi and openmp?

1217


What is modifier & how many types of modifiers available in c?

983


What is data structure in c and its types?

1018


Explain what does a function declared as pascal do differently?

1212


‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .

2839


what is the height of tree if leaf node is at level 3. please explain

2088


what are # pragma staments?

2000


Why c is called a middle level language?

1052


Which header file is used for clrscr?

999


What are the types of pointers in c?

972


Give me the code of in-order recursive and non-recursive.

1320


Using which language Test cases are added in .ptu file of RTRT unit testing???

4217


What is #include conio h?

945


Can we add pointers together?

999


What is a null pointer assignment error? What are bus errors, memory faults, and core dumps?

1378