Become a sponsor to zrwusa
Who am I
I am a software development engineer with 15 years of experience. After graduating from university, I have worked in various industries, including some well-known companies.
Current Situation
I moved to Malaysia for my child to receive formal education and hold a 10-year residency visa. However, this visa does not allow me to be employed by Malaysian companies. Due to my passion for programming and the absence of a standard data structures library in JavaScript/TypeScript, I decided to implement my own set of data structures - data-structure-typed in the open-source community.
Project Introduction
Ultimate Goal
- Become a part of the standard library in JS/TS.
Pain Points Addressed
Lack of Native Data Structures in JS/TS
-
Queue
: Many people use Array to simulate Queue and Deque, but the time complexity of Array.shift is O(n). We have implemented a Queue and Deque with O(1) time complexity for enqueue and dequeue operations. -
HashMap
: If you wish to use a pure HashMap to speed up your algorithms instead of the built-in Map (technically a LinkedHashMap), which the performance is compromised due to the need to consider insertion order. We have independently implemented a HashMap. -
Stack
: In JS, simulating a Stack with an Array is acceptable, and its performance is not inferior to a genuine Stack.
Missing Built-in Data Structures in JS/TS
-
Heap / Priority Queue
: The algorithm with O(log n) time complexity has been popular for improving efficiency since the advent of computers. A Heap supports insertion, deletion, and search with O(log n) time complexity, along with the ability to obtain the minimum value in O(1) time. -
Red Black Tree
: Developers familiar with databases, file systems, Linux virtual memory management, and network routing tables often have some understanding of Red-Black Tree. It's the least operation-intensive among all balanced binary search trees and offer the best performance balance in CRUD operations. -
Linked List
: For scenarios where insertion or deletion of elements is required at a specific index in an ordered collection, JS lacks a provided data structure. We need a LinkedList to implement this functionality.
Advantages
Performance:
- The performance of some data structures has surpassed JS's built-in data structures (
Queue
,Deque
,HashMap
), while most are close to or surpass those in other languages. Some are still not up to standard (Graph
,AVL Tree
).
Uniformity
-
- Implement or constrain
forEach
,filter
,map
,every
,some
,reduce
,find
,has
,hasValue
,get
,print
,isEmpty
,clear
,clone
methods in the base class.
- Implement or constrain
-
- Use generators to uniformly implement
[Symbol.iterator]
,entries
,keys
,values
. Delay iterator execution to prevent performance loss and provide control during traversal.
- Use generators to uniformly implement
-
- All deletion methods uniformly use the commonly used
delete
in ES6. Addition methods uniformly useadd
. Compatibility with some specifications in Java.
- All deletion methods uniformly use the commonly used
-
- The first parameter for all constructors is data, and the second parameter is configuration, maintaining uniformity. The first parameter accepts any iterable type for free conversion between data structures.
-
- Uniform return types, e.g.,
add
method uniformly returns a boolean.
- Uniform return types, e.g.,
Convenience and Simplicity of APIs
- Inspired by ES6, Java, ESNext, TypeScript, Python, e.g.,
forEach
,filter
,map
,every
,some
,reduce
,find
,has
,hasValue
,get
Use Commonly Understood Industry Standard Naming
enqueue
,dequeue
,push
,pop
,poll
,addLast
,addFirst
,pollFirst
,pollLast
,isEmpty
,clear
,print
,clone
Implement Customizable Features Whenever Possible
- Such as providing callback functions (lambda expressions) for all traversal methods.
Comprehensive Documentation
- Documentation not only explains the purpose of methods but also annotates time and space complexity across the entire series.
Community Activity
- In terms of the community, NPM download count , GitHub stars , contributors
Sponsor Us
- In terms of software engineering standards, our project has already achieved at least 75% completeness. With your sponsorship, we believe we can quickly raise the completion of this project to 95%, which is a form of assistance to my family and encouragement to our project team. We also hope to achieve the goal of becoming part of the
JS/TS
standard library as soon as possible.
Featured work
-
zrwusa/data-structure-typed
Javascript Data Structure & TypeScript Data Structure. Heap, Binary Tree, Red Black Tree, Linked List, Deque, Trie, HashMap, Directed Graph, Undirected Graph, Binary Search Tree, AVL Tree, Priority…
TypeScript 134 -
zrwusa/vivid-algorithm
Examples of data-structure-typed, Javascript Data Structure, TypeScript Data Structure Library. And 150+ algorithms. Meticulously crafted to empower developers with a versatile set of essential dat…
TypeScript 6
$5 a month
SelectYou will receive a Sponsor badge on your Github profile.
$10 a month
SelectYour name will be added to the "Supporter" section of https://github.com/zrwusa/data-structure-typed
$20 a month
SelectYou'll receive any rewards listed in the $10 monthly tier. Additionally, a Public Sponsor achievement will be added to your profile.
$50 a month
SelectYour name will be added to the "Top Supporter" section of https://github.com/zrwusa/data-structure-typed.
$100 a month
Select💯
I will include your company logo on a repo of your choosing under my GitHub account (Except for the Awesome list repos).
Your company logo will be featured on https://github.com/zrwusa/data-structure-typed.
(Contact me at the email in my profile to get your logo added)
$200 a month
Select💯💯
I will include your company logo on 2 repos of your choosing under my GitHub account (Except for the Awesome list repos).
Your company logo will be featured on https://github.com/zrwusa/data-structure-typed.
(Contact me at the email in my profile to get your logo added)
$800 a month
Select💯💯💯💯💯💯💯💯
Your company logo will be featured on:
the Awesome Node.js repo (20k views a month)
the Awesome Electron repo (6k views a month)
2 repos of your choosing under my GitHub account (Except for the Awesome list repos)
https://github.com/zrwusa/data-structure-typed
(Contact me at the email in my profile to get your logo added)