Quick Filter List

Everyone is familiar with this functionality. If you open up the the outlook address book and start typing a name, the list below the searchbox instantly filters to only contain items that match your query. .NET Reflector has a similar feature when you're browsing types ... you start typing, and regardless of how large the underlying assembly is that you're browsing, it's near instantaneous.

I've always kind of wondered what the secret sauce was here. How is it so fast? I imagine there are also different algorithms if the data is present in-memory, or if they need to be fetched from some external source (ie. DB, searching some file, etc.).

I'm not sure if this would be relevant, but if there are resources out there, I'm particularly interested how one might do this with WinForms ... but if you know of general resources, I'm interested in those as well :-)

Answers


What is the most common use of the trie data structure?

A Trie is basically a tree-structure for storing a large list of similar strings, which provides fast lookup of strings (like a hashtable) and allows you to iterate over them in alphabetical order.

Image from: http://en.wikipedia.org/wiki/Trie:

In this case, the Trie stores the strings: i in inn to tea ten

For any prefix that you enter (for example, 't', or 'te'), you can easily lookup all of the words that start with that prefix. More importantly, lookups are dependent on the length of the string, not on how many strings are stored in the Trie. Read the wikipedia article I referenced to learn more.


Need Your Help

Use alternative layout when there's not enough space

android android-layout

I have a RelativeLayout that has a number of controls in it. On some screens, there might not be enough room for this layout as well as the other screen elements. In this case, I'd like to use an

Identify jailbroken device from iOS application

iphone ios jailbreak identify

I am developing an iPhone application which is used for business purposes and it is storing many number of records in SQlite database. So my client don't want the app to run on the jailbroken devic...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.