TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Efficient Amortised and Real-Time Queues in Haskell

72 pointsby jkarniover 9 years ago

3 comments

wyagerover 9 years ago
In my experience, bankers&#x27; Queues (like the one presented in the article) are <i>not</i> the best persistent queue solution.<p>The Finger Tree (available in the Haskell standard library under Data.Sequence) is a really impressive data structure. It&#x27;s persistent, it has O(log(min(n,len-n))) access and modification (which means O(1) cons, snoc, head, and last), and O(log(min(m,n))) concatenation.<p>In my testing, it was several times faster than the fastest banker&#x27;s queue library I found.
评论 #10954545 未加载
sdegutisover 9 years ago
I probably understand these concepts without knowing their official names. But man, sometimes I feel really dumb when I see phrases like &quot;Queue Invariant&quot; or &quot;Amortised Complexity&quot;. It&#x27;s nice that this article explains them simply.
评论 #10913945 未加载
评论 #10914102 未加载
bsaulover 9 years ago
Never thought lazyness could transform an o(1) operation into an o(n) as a side effect.<p>I thought memory management was hard to reason about in pure functional languages, but i never thought it could affect algorithmic complexity this badly.
评论 #10914962 未加载
评论 #10915356 未加载
评论 #10914954 未加载