Skip to content Skip to sidebar Skip to footer

Better Search Algorithm To Increase The Performance?

I have list of students displaying in a page and I am storing the student information as object with id and name. I want to add search box to search students if I got a scroll bar

Solution 1:

You can build a sorted index and use binary search. Multiple indices if you need to search by multiple criteria, e.g. name or ID. Simpler to implement than a tree.


Solution 2:

You want to look for a trie-datastructure or a radix-trie or a crit-bit trie where empty nodes are compressed. You want to look for a kart-trie a special version of the radix-trie where there is only 2 edges in a node. In general a trie is good for text search algorithm, for example a dictionary. I have done an implementation of the kart-trie in php at phpclasses.org ( kart-trie ). You are welcome to download and play with it.


Post a Comment for "Better Search Algorithm To Increase The Performance?"