Article View: es.comp.os.linux.programacion
Article #1569Re: Algoritmo para buscar numeros repetidos en un array?
From: gamo
Date: Tue, 01 Nov 2005 19:47
Date: Tue, 01 Nov 2005 19:47
36 lines
1899 bytes
1899 bytes
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--8323328-1551187800-1130874474=:7143
Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
On Tue, 1 Nov 2005, Manuel wrote:
> Hola.
>
> Alguien sabe de algun algoritmo en C, java, etc que me diga si hay numero=
s
> que estan repetidos en un array?
>
> Sds.
>
En Perl ser=EDa algo as=ED como
for $i (@array){
=09@elem =3D grep ($i, @array);
=09if (@elem > 1){
=09=09print "$i repetido\n";
=09}
}=20
# UNTESTED
Saludos,
--=20
http://www.telecable.es/personales/gamo/
S=F3lo hay 10 tipos de personas, las que saben binario y las que no
GED/GB d+ s+:+ a C++ U+++ P+++ L++ E---- W++ N++ o K+ w O+ M- V
PS++ PE++ Y PGP+ t 5-- X+ R-- tv-- b++ DI++ D+ G- e+++ h+ r-- z
perl -e 'print 111_111_111**2,"\n";'
--8323328-1551187800-1130874474=:7143--
Technical Details
Message-ID:
<Pine.LNX.4.64.0511012043080.7143@jvz.es>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!newsfeed.news2me.com!opentransit.net!newsfeed.telecable.es!cm-85-152-80-110.telecable.es!amoReferences:
<dk808n$rld$1@hefestos.uned.es>Show Full Headers
Complete Article Headers
X-Google-Thread: f86c8,2eef099f34b350f6 X-Google-Attributes: gidf86c8,public X-Google-Language: SPANISH,ASCII Newsgroups: es.comp.os.linux.programacion Date: Tue, 1 Nov 2005 20:47:54 +0100 From: gamo <gamo@telecable.es> X-X-Sender: amo@jvz.es Reply-To: gamo@telecable.es Subject: Re: Algoritmo para buscar numeros repetidos en un array? In-Reply-To: <dk808n$rld$1@hefestos.uned.es> Message-ID: <Pine.LNX.4.64.0511012043080.7143@jvz.es> References: <dk808n$rld$1@hefestos.uned.es> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1551187800-1130874474=:7143" NNTP-Posting-Host: 85.152.80.110 X-Trace: filemon1.isp.telecable.es 1130874381 85.152.80.110 (1 Nov 2005 20:46:21 +0100) Organization: TeleCable, S.A.U. Lines: 36 Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!newsfeed.news2me.com!opentransit.net!newsfeed.telecable.es!cm-85-152-80-110.telecable.es!amo