C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 16th, 2003, 10:57 AM
kavi_s kavi_s is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 24 kavi_s User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Best algorithm to search through list of array of integers

hi all,

I have an algorithm that calls some function "generate" multilple times. The generate function returns a pointer to a LIST OF ARRAYS of integers. Each array of integers represents an encoding for a set. For eg, if the array has one integer=3, then this means that objects 0 and 1 are in the set (since 3 in binary corresponds to bits 0 and 1 being turned on). Therefore, there are a possible 2^32 combinations for ONE integer in the array. If the array has between 32 and 63 objects, then the size of the array will increase to 2., and so on.

The point of my algorithm is to go through EACH list returned from EACH run of generate and figure out how many times each encoding occurs, over all the lists. So this is where I need help. I am trying to figure out the best possible way to count the frequency of each set. Right now, I can only think of a linear search. Making some structure that can hold ALL possible combinations would require too much memory. If I had 64 objects, then I would have a 2-dim array, the first dim would be 2^32, and each of these indices in turn would have 2^32 combintaions too. For my system, there could more than 300 objects, so it would require lots of memory.

Does anyone have any ideas for making my search/sort faster than linear?
I CANNOT change the generate algorithm in any way, neither can I change the way each set is represented (ie, each integer corresponding to 2^32 combinations of objects). I would appreciate any input whatsoever!!

THank you very much!

Kavi

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Best algorithm to search through list of array of integers


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT