- 主題
- 数千万オーダーの文字列集合(およびマップ)を如何にサイズ効率良く表現するか、の話
- 諸事情で集合をメモリ上に保持したいことがあるが、サイズは節約したい
- 実際にはサイズのみを追求するのではなく、諸々のトレードオフを加味しつつバランスを取る
- 今回はそれを実現するための方法の一つである 簡潔データ構造 について説明する:
-- written by Florian Bender, 2015 | |
-- based on work by Michael Wyszomierski <https://wysz.com/wyszdom/2009/06/simple-sleep-timer-with-applescript/> | |
-- license: Public Domain / CC0 <http://creativecommons.org/publicdomain/zero/1.0/> | |
tell application "System Events" | |
set volumeSettings to get volume settings | |
set volumeValue to (output volume of volumeSettings) | |
set fadeTime to 10 -- time in seconds for fade change | |
set fadeChange to (volumeValue div fadeTime) | |
-- display alert "Volume: " & volumeValue & ", Delta: " & fadeChange | |
display dialog "Sleep time (min):" default answer "25" |
#!/usr/bin/python3 | |
# By Steve Hanov, 2011. Released to the public domain. | |
# Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article. | |
# | |
# Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata." | |
# Computational linguistics 26.1 (2000): 3-16. | |
# | |
# Updated 2014 to use DAWG as a mapping; see | |
# Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies", | |
# Software-Practice and Experience 1993 |
package uk.ac.ucl.cs.GI15.timNancyKawal { | |
class Trie[V](key: Option[Char]) { | |
def this() { | |
this(None); | |
} | |
import scala.collection.Seq | |
import scala.collection.immutable.TreeMap | |
import scala.collection.immutable.WrappedString |