Handling 5000 different functionalities - Optimised way in C

W

Walter Roberson

If you know the exact range of possible inputs and they are dense, then
use an array of function pointers.
If you do not know them, or they are sparse, then use a hash table to
locate your function pointer.

As the case labels are known ahead of time, a "perfect hash" could
be used, which in linear time would allow you to calculate an array
offset of the function pointer (or, of a structure that contains
the information needed to construct the function call.).
 
S

santosh

karthikbg said:
Hi,
Thx for directing me to comp.lang.c which had enough info for me for
this particular discussion. Got some good links via this comp.lang.c :
<snip>

You _are_ in comp.lang.c. In future please quote relevant portions of
the article to which you're replying, since, traditional users of
Usenet may not always have access to articles upthread.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top