Enviar búsqueda
Cargar
purely functional data structures chapter5_2
•
0 recomendaciones
•
557 vistas
Shigekazu Takei
Seguir
Tecnología
Economía y finanzas
Denunciar
Compartir
Denunciar
Compartir
1 de 10
Descargar ahora
Descargar para leer sin conexión
Recomendados
碩一新生0809
碩一新生0809
whosdoor
Humanistas 7 electromagn
Humanistas 7 electromagn
Marauxi Mendoza
White paper financialmanagementfornpo
White paper financialmanagementfornpo
1aquibshaikh
Market Seminar Invite
Market Seminar Invite
Linda Twining
NMI 2008 foils
NMI 2008 foils
David Tester
IEEE SOCC 2011 paper
IEEE SOCC 2011 paper
David Tester
Market monitor template 032814
Market monitor template 032814
Linda Twining
Scala(finagle)@SmartNews_English
Scala(finagle)@SmartNews_English
Shigekazu Takei
Recomendados
碩一新生0809
碩一新生0809
whosdoor
Humanistas 7 electromagn
Humanistas 7 electromagn
Marauxi Mendoza
White paper financialmanagementfornpo
White paper financialmanagementfornpo
1aquibshaikh
Market Seminar Invite
Market Seminar Invite
Linda Twining
NMI 2008 foils
NMI 2008 foils
David Tester
IEEE SOCC 2011 paper
IEEE SOCC 2011 paper
David Tester
Market monitor template 032814
Market monitor template 032814
Linda Twining
Scala(finagle)@SmartNews_English
Scala(finagle)@SmartNews_English
Shigekazu Takei
Scala@SmartNews_20150221
Scala@SmartNews_20150221
Shigekazu Takei
Startprintf_2013May18
Startprintf_2013May18
Shigekazu Takei
Pfds 9 2_2
Pfds 9 2_2
Shigekazu Takei
Pfds 5 2+6_4_2
Pfds 5 2+6_4_2
Shigekazu Takei
Ids ips
Ids ips
Shigekazu Takei
Stanford ml neuralnetwork
Stanford ml neuralnetwork
Shigekazu Takei
Pfds ex3 9
Pfds ex3 9
Shigekazu Takei
Más contenido relacionado
Más de Shigekazu Takei
Scala@SmartNews_20150221
Scala@SmartNews_20150221
Shigekazu Takei
Startprintf_2013May18
Startprintf_2013May18
Shigekazu Takei
Pfds 9 2_2
Pfds 9 2_2
Shigekazu Takei
Pfds 5 2+6_4_2
Pfds 5 2+6_4_2
Shigekazu Takei
Ids ips
Ids ips
Shigekazu Takei
Stanford ml neuralnetwork
Stanford ml neuralnetwork
Shigekazu Takei
Pfds ex3 9
Pfds ex3 9
Shigekazu Takei
Más de Shigekazu Takei
(7)
Scala@SmartNews_20150221
Scala@SmartNews_20150221
Startprintf_2013May18
Startprintf_2013May18
Pfds 9 2_2
Pfds 9 2_2
Pfds 5 2+6_4_2
Pfds 5 2+6_4_2
Ids ips
Ids ips
Stanford ml neuralnetwork
Stanford ml neuralnetwork
Pfds ex3 9
Pfds ex3 9
purely functional data structures chapter5_2
1.
PFDS §5.2 Queues
@shtaag 2012年3月4日日曜日
2.
First...
http://www.kmonos.net/pub/Presen/PFDS.pdf 2012年3月4日日曜日
3.
FIFO Queue
type foo Queue = foo list x foo list fun head (x :: f, r) = x O(1) fun tail (x :: f, r) = (f, r) O(1) fun snoc ((f, r), x) = (f, x :: r) O(1) リスト終端への挿入にconsを用いるため、 リスト後半をreverseして保持 2012年3月4日日曜日
4.
FIFO Queue
invariant to maintain fはrが[ ]の時のみ[ ] これがないとf = [ ]時にheadがr終端からの取り出 しになりheadがO(n)かかる 2012年3月4日日曜日
5.
FIFO Queue
to maintain invariant... fun checkf ([ ], r) = (rev r, [ ]) | checkf q = q fun snoc ((f, r), x) = checkf (f, x :: r) fun tail (x :: f, r) = checkf (f, r) 2012年3月4日日曜日
6.
Banker’s method
snoc = 1 step + 1 credit tail (w/o reverse) = 1 step tail (w/ reverse) = (m+1) steps - m credits tail . tail . tail . snoc 3 . snoc 2 . snoc 1 2012年3月4日日曜日
7.
real
amortized snoc 1 -> [] [1] -> [1] [] 2 2 checkf w/ 1 step snoc 2 -> [1] [2] 1 2 +1 snoc 3 -> [1] [3,2] 1 2 +1 tail -> [] [3,2] -> [2,3] [] 3 1 -2 checkf w/ 2 step tail -> [3] [] 1 1 tail -> [] [] 1 1 9 9 2012年3月4日日曜日
8.
real
amortized snoc 1 -> [] [1] -> [1] [] 2 2 snoc 2 -> [1] [2] 1 2 +1 snoc 3 -> [1] [3,2] 1 2 +1 tail -> [] [3,2] -> [2,3] [] 3 1 -2 tail -> [3] [] 1 1 積み立てておいたcreditを消費 tail -> [] [] 1 1 9 9 2012年3月4日日曜日
9.
Physicist’s method
Φ = length of the rear list snoc = 1 step + 1 potential (for 1 elem) tail (w/o reverse) = 1 step tail (w/ reverse) = (m+1) steps - m potentials 2012年3月4日日曜日
10.
real
amortized snoc 1 -> [] [1] -> [1] [] 2 2 snoc 2 -> [1] [2] 1 2 +1 snoc 3 -> [1] [3,2] 1 2 +1 tail -> [] [3,2] -> [2,3] [] 3 1 -2 tail -> [3] [] 1 1 tail -> [] [] 1 1 9 9 2012年3月4日日曜日
Descargar ahora