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 1f in c?

2674


Write a program of prime number using recursion.

1102


What is difference between structure and union?

1144


What is wrong with this declaration?

1119


Is it possible to execute code even after the program exits the main() function?

1352


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

1258


What is "Hungarian Notation"?

1124


Find MAXIMUM of three distinct integers using a single C statement

1081


What is the importance of c in your views?

1181


Why do we use static in c?

1141


What is the meaning of && in c?

1030


Is null a keyword in c?

1202


What is the difference between the = symbol and == symbol?

1133


What is #define used for in c?

1072


What are variables and it what way is it different from constants?

1251