Re: Searching algorithm
- To: mathgroup at smc.vnet.net
- Subject: [mg48278] Re: Searching algorithm
- From: "Amir" <z64043 at netscape.net>
- Date: Thu, 20 May 2004 04:03:59 -0400 (EDT)
- References: <c8f95v$ffk$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi DrBob, Thanks a lot for your bright solution! I appreciate it very much. This elegant solution demonstrates the power of functional programming. I've been trying to find this algorithm for a long time in order to apply it on a two dimensional matrix. Thanks again, it works great. Amir "DrBob" <drbob at bigfoot.com> wrote in message news:c8f95v$ffk$1 at smc.vnet.net... > That's not a 2x2; maybe it's an nx6. If the sublists aren't too large, the > following works: > > <<DiscreteMath`Combinatorica` > <<Statistics`DataManipulation` > > a={{1,8,9,4,6,3},{1,7,9,11,8,54},{73,2,1,61,8,9}}; > > Last@Last@Sort@Frequencies@Flatten[KSubsets[#,3]&/@a,1] > > {1,8,9} > > DrBob > > www.eclecticdreams.net > > > -----Original Message----- > From: Amir [mailto:z64043 at netscape.net] To: mathgroup at smc.vnet.net > Subject: [mg48278] Searching algorithm > > Hello, > > A = 2x2 matrix {{1,8,9,4,6,3},{1,7,9,11,8,54},{73,2,1,61,8,9},...} > > Is there any algorithm which can find the most frequent subset of three > numbers ( like {1,8,9} ) that appears in A ? > > Thanks, > > Amir > > > > > >