1 #ifndef _FREQUENT_H 2 #define _FREQUENT_H 3 4 #include <stdint.h> 5 6 typedef struct _FREQUENT FREQUENT; 7 8 // size is the precision/return size: it will find at most >size elements (i.e. all, if there) with frequency > 1/(size+1) 9 FREQUENT *frequent_new(int size); // - just free() it 10 11 void frequent_add(FREQUENT *freq,intptr_t key); 12 13 // might return INTPTR_MIN, if not populated 14 // this is only an approximation! 15 intptr_t frequent_get(FREQUENT *freq,int pos); // 0 is "most frequent" 16 17 #endif 18