frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Data-structure-typed – TreeMap, Heap, Graph and more for TypeScript

https://github.com/zrwusa/data-structure-typed
2•zrwusa•2h ago

Comments

zrwusa•2h ago
Hi HN! I built a data structures library for JavaScript/TypeScript that I've been refining for 2+ years.

*Why another one?*

Native JS only gives us Array, Map, Set, Object. When you need a sorted map, priority queue, or graph algorithms, you're stuck with either: - Half-baked npm packages with poor TS support - Porting Java/C++ code yourself - Libraries that expose too many internals

*What's different:*

1. *Native API feel* - TreeMap/TreeSet work like Map/Set, just sorted: ```ts const map = new TreeMap([['b', 2], ['a', 1], ['c', 3]]); [...map.keys()] // ['a', 'b', 'c'] - sorted! ```

2. *Java-style navigation* - `floor()`, `ceiling()`, `lower()`, `higher()`, `rangeSearch()`

3. *Full TypeScript* - No `any` types, proper generics throughout

4. *Performance* - Red-Black Tree backed, ~2x faster iteration than js-sdsl

*Included:* - Binary Trees: BST, AVL, Red-Black, TreeMap, TreeSet, TreeMultiMap - Heaps: Min/Max Heap, Priority Queue - Graphs: Directed/Undirected with Dijkstra, Bellman-Ford, Tarjan, etc. - Linear: Queue, Deque, Stack, LinkedList - Others: Trie, HashMap

npm: `npm install data-structure-typed`

Happy to answer questions about implementation details, performance tradeoffs, or TypeScript typing challenges!

---

## Alternative shorter version:

*Title:* Show HN: TreeMap, Heap, Graph for TypeScript – native API feel, full type safety

*Text:* After 2 years of refinement, sharing my TypeScript data structures library.

TreeMap/TreeSet work like native Map/Set but sorted. Includes Java-style navigation (floor, ceiling, rangeSearch). Also: Heap, PriorityQueue, Graph with Dijkstra/Bellman-Ford/Tarjan, Trie, and more.

Red-Black Tree backed, ~2x faster iteration than js-sdsl.

Would love feedback, especially on API design choices!

Show HN: PulseWatch – AI website monitor with plain-language summaries

https://pulsewatch.watch
1•KaracaTR•2m ago•0 comments

Microsoft bans the word "Microslop" on its Discord, then locks the server

https://www.windowslatest.com/2026/03/02/microsoft-gets-tired-of-microslop-bans-the-word-on-its-d...
1•robtherobber•4m ago•0 comments

KlongPy

https://github.com/briangu/klongpy
1•tosh•5m ago•0 comments

Jolla phone – a full-stack European alternative

https://commerce.jolla.com/products/jolla-phone-sept-26
1•spinningslate•6m ago•1 comments

Show HN: Commitdog – Git on steroids CLI (pure Go, ~3MB binary)

https://aysdog.com/commitdog
3•anirbanfaith•11m ago•1 comments

Submission Deadline for 12th International Workshop on Plan 9 ends March 9 2026

http://iwp9.org/
2•nakedneuron•11m ago•0 comments

Vilayat-E Faqih

https://en.wikipedia.org/wiki/Guardianship_of_the_Islamic_Jurist
1•simonebrunozzi•11m ago•0 comments

Tailwind CSS UI Components

https://apexcodestudios.com
1•TheMashaBrand•13m ago•0 comments

Show HN: C7 – Pipe up-to-date library docs into any LLM from the terminal

https://github.com/VedanthB/context7-cli
1•vedanthbora•14m ago•0 comments

Show HN: DailyWatch – Free video discovery across 8 regions

https://dailywatch.video/
1•ibrahimtxyz•15m ago•0 comments

Flowly – Make your Mac mouse scroll like a trackpad

https://flowlyapp.dev/
2•simonij•16m ago•2 comments

Show HN: Swalpa – Spoken Kannada learning platform built with Antigravity

https://swalpa.org/games/
2•maurys•22m ago•2 comments

AWS data center hit by Iran

https://www.reuters.com/world/middle-east/amazons-cloud-unit-reports-fire-after-objects-hit-uae-d...
6•wayneshng•24m ago•1 comments

Why Tokyo's Metro Is Profitable and New York City's Isn't [video]

https://www.youtube.com/watch?v=HdJwAUdvlik
1•simonebrunozzi•25m ago•0 comments

Edwin Smith Papyrus

https://en.wikipedia.org/wiki/Edwin_Smith_Papyrus
2•Antibabelic•27m ago•0 comments

The world is running out of silver – and AI is accelerating the squeeze

https://www.mining.com/sponsored-content/the-world-is-running-out-of-silver-and-ai-is-acceleratin...
1•voice_of_genre•27m ago•1 comments

Show HN: Pure Rust IFC/BIM Viewer in the Browser via WebAssembly

https://bimifc.de/?file=bayarena_lighting.ifc
1•holg•30m ago•0 comments

Tangled: Our €3,8M seed round

https://blog.tangled.org/seed
1•thombles•32m ago•1 comments

Empirical evidence for consciousness without access

https://www.sciencedirect.com/science/article/pii/S0010027723001634
1•paraschopra•33m ago•0 comments

Show HN: Open-source expense and budget tracker with SQL API for AI agents

https://github.com/kirill-markin/expense-budget-tracker
2•MarkinK•33m ago•0 comments

Show HN: A Software-Defined USB PD Charger (ESP32, FPGA, Open Source Hardware)

https://www.crowdsupply.com/candysign/hummingkit
5•SDCforAll•34m ago•0 comments

Introducing-Perplexity-Computer

https://www.perplexity.ai/hub/blog/introducing-perplexity-computer
2•Tangokat•35m ago•0 comments

Ganak: The making of a high-performance model counter

https://www.msoos.org/2026/03/ganak-the-making-of-a-versatile-high-performance-model-counter/
2•zero_k•36m ago•1 comments

The Fall of Samakin Altwalker and the Dark Side of OpenAI

https://greggbayesbrown.substack.com/p/the-fall-of-samakin-altwalker-and
1•superfluous_g•37m ago•0 comments

Rolv.ai: Universal sparse compute primitive, back end-agnostic reproducibility

https://rolv.ai
1•heggenhougen•38m ago•0 comments

John Carmack – a tech god of tech illiterates

https://boards.4chan.org/g/thread/108271937/the-gospel-of-the-axe-deconstructing-the-divine
1•voice_of_genre•39m ago•0 comments

Benzene changed chemistry forever – with Judy Wu [video]

https://www.youtube.com/watch?v=0kYMUFzylOs
1•mariuz•40m ago•0 comments

I Didn't Like App Launchers for Arch Linux, So I Wrote My Own in Rust

https://rafaelzimmermann.com/posts/app-launcher-rust.html
4•auxtmp•43m ago•0 comments

OpenPencil – AI-native design editor. Open-source Figma alternative

https://github.com/open-pencil/open-pencil
1•xlmnxp•43m ago•0 comments

Understanding Rope: From Rotary Embeddings to Context Extension

https://mli0603.notion.site/Understanding-RoPE-From-Rotary-Embeddings-to-Context-Extension-316a34...
1•sebg•43m ago•0 comments