PFDS 11.2.2

538 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
538
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

PFDS 11.2.2

  1. 1. PFDS 11.2Catenable Double-Ended Queues~ using implicit recursive slowdown ~ @rf0444
  2. 2. Simple Implementationdata Cat a = Shallow (Deq a) | Deep (Deq a) (Cat (Deq a)) (Deq a)
  3. 3. Simple Implementation ++
  4. 4. Simple Implementation cons snoc
  5. 5. Simple Implementation
  6. 6. Simple Implementation( ++ )
  7. 7. Simple Implementation( ++ ) 再帰 O(min(log n1, log n2))
  8. 8. using compound elementsdata Cat a = Shallow (Deq a) | Deep (Deq a) (Cat (Ele a)) (Deq a) (Cat (Ele a)) (Deq a)
  9. 9. using compound elementsdata Ele a = Simple (Deq a) | Compound (Deq a) (Cat (Ele a)) (Deq a)
  10. 10. using compound elements ++
  11. 11. using compound elements
  12. 12. using compound elements
  13. 13. using compound elements snoc cons
  14. 14. using compound elements
  15. 15. using compound elements
  16. 16. using compound elementstail1. f が 4 要素以上 f a m b r2. a の先頭が Simple3. a の先頭が Compound4. a が空、b の先頭が Simple5. a が空、b の先頭が Compound6. a も b も空
  17. 17. using compound elementstail (1)
  18. 18. using compound elementstail (1)
  19. 19. using compound elementstail (2)
  20. 20. using compound elementstail (2)
  21. 21. using compound elementstail (2)
  22. 22. using compound elementstail (3)
  23. 23. using compound elementstail (3)
  24. 24. using compound elementstail (3)
  25. 25. using compound elementstail (3)
  26. 26. using compound elementstail (3) ++
  27. 27. using compound elementstail (3)
  28. 28. using compound elementstail (3)
  29. 29. using compound elementstail (4) 空
  30. 30. using compound elementstail (4) 空
  31. 31. using compound elementstail (4)
  32. 32. using compound elementstail (4)
  33. 33. using compound elementstail (4) 空
  34. 34. using compound elementstail (5) 空
  35. 35. using compound elementstail (5) 空
  36. 36. using compound elementstail (5)
  37. 37. using compound elementstail (5)
  38. 38. using compound elementstail (5)
  39. 39. using compound elementstail (5)
  40. 40. using compound elementstail (6) 空 空
  41. 41. using compound elementstail (6) 空 空
  42. 42. using compound elementstail (6) *どちらかのサイズが 3 以下なら、くっつけて Shallow
  43. 43. using compound elementstail (6)
  44. 44. using compound elementstail (6) 空 空

×