Given an array of size N in which every number is between 1
and N, determine if there are any duplicates in it. You are
allowed to destroy the array if you like.

Answer Posted / miraj

When its given you are allowed to destroy the array..do
think in that direction..


Read the first element go to that position, read that
position and mark it zero.. keep doing so...

If at any place we find zero.. that means array contains
duplicate.

Is This Answer Correct ?    19 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you relate the function with the structure? Explain with an appropriate example.

2925


3) Int Matrix of certain size was given, We had few valu= es in it like this. =97=97=97=97=97=97=97=97=97=97=97 1 = | 4 | | 5 | &= nbsp; | 45 =97=97=97=97=97=97=97=97=97=97=97 &n= bsp; | 3 | 3 | 5 | = | 4 =97=97=97=97=97=97=97=97=97=97=97 34 |&nbs= p; 3 | 3 | | 12 | &= nbsp; =97=97=97=97=97=97=97=97=97=97=97 3 | &nbs= p; | 3 | 4 | = | 3 =97=97=97=97=97=97=97=97=97=97=97 3 | = ; | | | = ; 3 | =97=97=97=97=97=97=97=97=97=97=97 &= nbsp; | | 4 | = ; | 4 | 3 We w= ere supposed to move back all the spaces in it at the end. Note: = If implemented this prog using recursion, would get higher preference.

3327


create a C-code that will display the total fare of a passenger of a taxi if the driver press enter,the timer will stop. Every 10 counts is 2 pesos. Initial value is 25.00

6319


What is data _null_? ,Explain with code when u need to use it in data step programming ?

2829


#include int main(void) { int a=4, b=2; a=b<>2 ; printf("%d",a); return 0; }

1080






how to test pierrot divisor

2264


Given a spherical surface, write bump-mapping procedure to generate the bumpy surface of an orange

2867


Sir... please give some important coding questions asked by product companies..

1805


Write a program to model an exploding firecracker in the xy plane using a particle system

3697


Design an implement of the inputs functions for event mode

2970


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

3036


Write a routine to implement the polymarker function

4388


could you please send the program code for multiplying sparse matrix in c????

3078


Develop a routine to reflect an object about an arbitrarily selected plane

3004


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

2342