AI using FSMs

Can someone please help me, i am designing a fsm and need some help on the concepts. I am using state(node) and an event(arc) classes to create ai behaviours. I store all the states and events in a transition table. Whats the most effiecnet way to check what event occured? (events are in the transition table) At the moment i loop through all the events in the transition table and check if it is positive(active).
I think this algorythm is called O(n). Its not very effiecent if i had 1000 events. i know, i know, 1000 is too much but its just an example.
O(log2n) is a really effiecent algorythm but i got no idea how to actually use it in the code… (did that make sense?)
Can some one give me an example of O(log2n)??

diagram
http://www.brainstorm-studios.net/Bruk/fsm.jpg

Hey, here is the basic design of it. Some things i did not include like some encryption functions(cant have people figuring that out :wink: )

code has been taken down

Hey Blender_owl none of your graphic come thru on any of your post.

sorry shaba, but i figured out the question to my problem :D, i will see if i can get the picture working.

What´s fsm?

an fsm stands for finite state machine. Its a way to make AI. google finite state machine AI for more info.