denoland/std

feature: add structured data in @std/data-structures

PandaWorker opened this issue · 3 comments

In programming, different data structures are very often needed and it would be good to add them to the package.

Some of the most popular are: Queue, Deque of the main ones based on the Linked List and more (Tree, Matrix, )

Very often I see how developers use arrays for queues, which is not correct.

Therefore, I suggest adding all possible popular data structures to the package at once.

What do you think about this?

I made a mistake with the package, I need to add a single/double linked list (Queue, Deque) to @std/data-structures

I think these classic structures would be useful additions if they are implemented using linked nodes. Such implementations would likely offer performance improvements over arrays1, but benchmarks of code in a PR will verify that.

In consideration of organization, I think grouping linear data structures into one issue (this one perhaps) would be helpful, while separating other kinds (e.g. a tree, or a matrix/table/grid/data frame) into different issues.

Footnotes

  1. In some precursory benchmarks using implementation code from past programming puzzles, I saw performance improvements for stack push/pop while using a singly-linked node list implementation when compared with a native JavaScript array.

Some references from Wikipedia:

…and some Rust structures for reference in consideration of API naming: