<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Hash table support</title>
		<link>http://forums.leaflabs.com/topic.php?id=837</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:27:00 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=837" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "Hash table support"</title>
			<link>http://forums.leaflabs.com/topic.php?id=837#post-5035</link>
			<pubDate>Tue, 07 Jun 2011 08:06:19 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">5035@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;gregorius - there are a few different ways you might go about this. Could you give a few more requirements?&#60;/p&#62;
&#60;p&#62;Are you interested in a highly optimised solution, or will something simple be preferable?&#60;/p&#62;
&#60;p&#62;Does the program need to be relatively fast, i.e. does it need to do, say, more than 1,000 lookups/second?&#60;br /&#62;
Will the program add to the data, i.e. add new numbers and names, while it is being used?&#60;br /&#62;
Are updates frequent, i.e. several/second, or rare, i.e. one/day.&#60;br /&#62;
Will the program need to remove names and numbers while it's being used (unusual to do this, but maybe)?&#60;br /&#62;
Are deletions frequent or rare?&#60;br /&#62;
Is there any information about 'hit' patterns, i.e. is a small number of caller-IDs likely to be the majority of lookups?&#60;br /&#62;
Does the program need to store a relatively short name, like older mobiles which might only have 12-14 characters, or does it need to store a name no matter how long it is?&#60;/p&#62;
&#60;p&#62;If it is fixed data, all known ahead of time, and it must be extremely quick at lookup, you could use a perfect hash:&#60;br /&#62;
&#60;a href=&#34;http://en.wikipedia.org/wiki/Perfect_hash_function&#34; rel=&#34;nofollow&#34;&#62;http://en.wikipedia.org/wiki/Perfect_hash_function&#60;/a&#62;&#60;br /&#62;
Make it even easier by using a fixed size for names. Run the algorithm to generate the perfect hash on a host PC. To decouple the code from the data, load the data and hash terms into serial flash (with a little program), and the lookup program might read the hash terms when it starts.&#60;/p&#62;
&#60;p&#62;For a more traditional solution, almost any algorithm book will give plenty of solutions. Look for something which is suitable for disk access. If the names are fixed length, or you are willing to allocate multiples of a fixed length, you can treat the actual storage as an array of entries which makes storage management easier.&#60;/p&#62;
&#60;p&#62;If it can afford a few seconds start up time, the program can scan the entire flash, and come up with in-RAM structures to help with access.&#60;/p&#62;
&#60;p&#62;If additions are rare, and could be handled as a 'batch', you could hash with an overflow, and do a linear search on the overflow, then reorganise periodically.&#60;/p&#62;
&#60;p&#62;If simplicity dominates over speed, just keep a big array of entries in flash and do a binary search. The memory is 4MByres, so about 200,000 entries. With a binary search, that is only 18 'probes' into the flash memory.&#60;/p&#62;
&#60;p&#62;Anyway, please tells us whatever requirements you feel comfortable share, and we might be able to help.&#60;/p&#62;
&#60;p&#62;(full disclosure: I am not a member of LeafLabs staff)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gregorius on "Hash table support"</title>
			<link>http://forums.leaflabs.com/topic.php?id=837#post-5012</link>
			<pubDate>Mon, 06 Jun 2011 22:37:53 +0000</pubDate>
			<dc:creator>gregorius</dc:creator>
			<guid isPermaLink="false">5012@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;Let's say I want to write a Caller-ID that links phone numbers to a caller's name and I wanted to include many many numbers from a file that is formated as such&#60;/p&#62;
&#60;p&#62;&#34;&#60;br /&#62;
555-2718 Joe Shmoe&#60;br /&#62;
555-1618 Jane Doe&#60;br /&#62;
555-3145 John Smith ... &#34;&#60;/p&#62;
&#60;p&#62;I would like to store the name data as char[] data in an external serial flash chip (I'm using &#60;a href=&#34;http://parts.digikey.com/1/parts/1904100-ic-flash-ser-32m-80mhz-spi-8soic-sst25vf032b-80-4i-s2af.html&#34; rel=&#34;nofollow&#34;&#62;http://parts.digikey.com/1/parts/1904100-ic-flash-ser-32m-80mhz-spi-8soic-sst25vf032b-80-4i-s2af.html&#60;/a&#62; - which seems to be reading/writing fine).  Would I use a hash table to link phone numbers to memory indices/Is there a hash table implementation?  How would I program the flash chip with all the data beforehand?&#60;/p&#62;
&#60;p&#62;Sorry if these are obvious questions, while I've done a fair amount of C/C++, embedded programming is pretty new to me.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
