版博士V2.0程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <p align="center">
  2. <a href="https://js-sdsl.org/" target="_blank" rel="noopener noreferrer">
  3. <img src="https://js-sdsl.org/assets/image/logo/logo-removebg.png" alt="js-sdsl logo" width="120" />
  4. </a>
  5. </p>
  6. <h3><p align="center">A javascript standard data structure library which benchmark against C++ STL</p></h3>
  7. <p align="center">
  8. <a href="https://www.npmjs.com/package/js-sdsl"><img src="https://img.shields.io/npm/v/js-sdsl.svg" alt="NPM Version" /></a>
  9. <a href="https://github.com/js-sdsl/js-sdsl/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/js-sdsl/js-sdsl/build.yml" alt="Build Status" /></a>
  10. <a href='https://coveralls.io/github/js-sdsl/js-sdsl?branch=main'><img src='https://coveralls.io/repos/github/js-sdsl/js-sdsl/badge.svg?branch=main' alt='Coverage Status' /></a>
  11. <a href="https://github.com/js-sdsl/js-sdsl"><img src="https://img.shields.io/github/stars/js-sdsl/js-sdsl.svg" alt="GITHUB Star" /></a>
  12. <a href="https://npmcharts.com/compare/js-sdsl?minimal=true"><img src="https://img.shields.io/npm/dm/js-sdsl.svg" alt="NPM Downloads" /></a>
  13. <a href="https://unpkg.com/js-sdsl/dist/umd/js-sdsl.min.js"><img src="https://img.badgesize.io/https://unpkg.com/js-sdsl/dist/umd/js-sdsl.min.js?compression=gzip&style=flat-square/" alt="Gzip Size"></a>
  14. <a href="https://openbase.com/js/js-sdsl?utm_source=embedded&amp;utm_medium=badge&amp;utm_campaign=rate-badge"><img src="https://badges.openbase.com/js/rating/js-sdsl.svg?token=fh3LMNOV+JSWykSjtg1rA8kouSYkJoIDzGbvaByq5X0=" alt="Rate this package"/></a>
  15. <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/npm/l/js-sdsl.svg" alt="MIT-license" /></a>
  16. <a href="https://github.com/js-sdsl/js-sdsl/"><img src="https://img.shields.io/github/languages/top/js-sdsl/js-sdsl.svg" alt="GITHUB-language" /></a>
  17. </p>
  18. <p align="center">English | <a href="https://github.com/js-sdsl/js-sdsl/blob/main/README.zh-CN.md">简体中文</a></p>
  19. ## ✨ Included data structures
  20. - **Stack** - first in last out stack.
  21. - **Queue** - first in first out queue.
  22. - **PriorityQueue** - heap-implemented priority queue.
  23. - **Vector** - protected array, cannot to operate properties like `length` directly.
  24. - **LinkList** - linked list of non-contiguous memory addresses.
  25. - **Deque** - double-ended-queue, O(1) time complexity to `unshift` or getting elements by index.
  26. - **OrderedSet** - sorted set which implemented by red black tree.
  27. - **OrderedMap** - sorted map which implemented by red black tree.
  28. - **HashSet** - refer to the [polyfill of ES6 Set](https://github.com/rousan/collections-es6).
  29. - **HashMap** - refer to the [polyfill of ES6 Map](https://github.com/rousan/collections-es6).
  30. ## ⚔️ Benchmark
  31. We are benchmarking against other popular data structure libraries. In some ways we're better than the best library. See [benchmark](https://js-sdsl.org/#/test/benchmark-analyze).
  32. ## 🖥 Supported platforms
  33. | ![][Edge-Icon]<br/>IE / Edge | ![][Firefox-Icon]<br/>Firefox | ![][Chrome-Icon]<br/>Chrome | ![][Safari-Icon]<br/>Safari | ![][Opera-Icon]<br/>Opera | ![][NodeJs-Icon]<br/>NodeJs |
  34. |:----------------------------:|:-----------------------------:|:---------------------------:|:---------------------------:|:-------------------------:|:---------------------------:|
  35. | Edge 12 | 36 | 49 | 10 | 36 | 10 |
  36. ## 📦 Download
  37. Download directly by cdn:
  38. - [js-sdsl.js](https://unpkg.com/js-sdsl/dist/umd/js-sdsl.js) (for development)
  39. - [js-sdsl.min.js](https://unpkg.com/js-sdsl/dist/umd/js-sdsl.min.js) (for production)
  40. Or install js-sdsl using npm:
  41. ```bash
  42. npm install js-sdsl
  43. ```
  44. Or you can download the isolation packages containing only the containers you want:
  45. | package | npm | size | docs |
  46. |---------------------------------------------------|-----------------------------------------------------------------------|------------------------------------------------------------------|-----------------------------|
  47. | [@js-sdsl/stack][stack-package] | [![NPM Package][stack-npm-version]][stack-npm-link] | [![GZIP Size][stack-umd-size]][stack-umd-link] | [link][stack-docs] |
  48. | [@js-sdsl/queue][queue-package] | [![NPM Package][queue-npm-version]][queue-npm-link] | [![GZIP Size][queue-umd-size]][queue-umd-link] | [link][queue-docs] |
  49. | [@js-sdsl/priority-queue][priority-queue-package] | [![NPM Package][priority-queue-npm-version]][priority-queue-npm-link] | [![GZIP Size][priority-queue-umd-size]][priority-queue-umd-link] | [link][priority-queue-docs] |
  50. | [@js-sdsl/vector][vector-package] | [![NPM Package][vector-npm-version]][vector-npm-link] | [![GZIP Size][vector-umd-size]][vector-umd-link] | [link][vector-docs] |
  51. | [@js-sdsl/link-list][link-list-package] | [![NPM Package][link-list-npm-version]][link-list-npm-link] | [![GZIP Size][link-list-umd-size]][link-list-umd-link] | [link][link-list-docs] |
  52. | [@js-sdsl/deque][deque-package] | [![NPM Package][deque-npm-version]][deque-npm-link] | [![GZIP Size][deque-umd-size]][deque-umd-link] | [link][deque-docs] |
  53. | [@js-sdsl/ordered-set][ordered-set-package] | [![NPM Package][ordered-set-npm-version]][ordered-set-npm-link] | [![GZIP Size][ordered-set-umd-size]][ordered-set-umd-link] | [link][ordered-set-docs] |
  54. | [@js-sdsl/ordered-map][ordered-map-package] | [![NPM Package][ordered-map-npm-version]][ordered-map-npm-link] | [![GZIP Size][ordered-map-umd-size]][ordered-map-umd-link] | [link][ordered-map-docs] |
  55. | [@js-sdsl/hash-set][hash-set-package] | [![NPM Package][hash-set-npm-version]][hash-set-npm-link] | [![GZIP Size][hash-set-umd-size]][hash-set-umd-link] | [link][hash-set-docs] |
  56. | [@js-sdsl/hash-map][hash-map-package] | [![NPM Package][hash-map-npm-version]][hash-map-npm-link] | [![GZIP Size][hash-map-umd-size]][hash-map-umd-link] | [link][hash-map-docs] |
  57. ## 🪒 Usage
  58. You can visit our [official website](https://js-sdsl.org/) to get more information.
  59. To help you have a better use, we also provide this [API document](https://js-sdsl.org/js-sdsl/index.html).
  60. For previous versions of the documentation, please visit:
  61. `https://js-sdsl.org/js-sdsl/previous/v${version}/index.html`
  62. E.g.
  63. [https://js-sdsl.org/js-sdsl/previous/v4.1.5/index.html](https://js-sdsl.org/js-sdsl/previous/v4.1.5/index.html)
  64. ### For browser
  65. ```html
  66. <script src="https://unpkg.com/js-sdsl/dist/umd/js-sdsl.min.js"></script>
  67. <script>
  68. const {
  69. Vector,
  70. Stack,
  71. Queue,
  72. LinkList,
  73. Deque,
  74. PriorityQueue,
  75. OrderedSet,
  76. OrderedMap,
  77. HashSet,
  78. HashMap
  79. } = sdsl;
  80. const myOrderedMap = new OrderedMap();
  81. myOrderedMap.setElement(1, 2);
  82. console.log(myOrderedMap.getElementByKey(1)); // 2
  83. </script>
  84. ```
  85. ### For npm
  86. ```javascript
  87. // esModule
  88. import { OrderedMap } from 'js-sdsl';
  89. // commonJs
  90. const { OrderedMap } = require('js-sdsl');
  91. const myOrderedMap = new OrderedMap();
  92. myOrderedMap.setElement(1, 2);
  93. console.log(myOrderedMap.getElementByKey(1)); // 2
  94. ```
  95. ## 🛠 Test
  96. ### Unit test
  97. We use [karma](https://karma-runner.github.io/) and [mocha](https://mochajs.org/) frame to do unit tests and synchronize to [coveralls](https://coveralls.io/github/js-sdsl/js-sdsl). You can run `yarn test:unit` command to reproduce it.
  98. ### For performance
  99. We tested most of the functions for efficiency. You can go to [`gh-pages/performance.md`](https://github.com/js-sdsl/js-sdsl/blob/gh-pages/performance.md) to see our running results or reproduce it with `yarn test:performance` command.
  100. You can also visit [here](https://js-sdsl.org/#/test/performance-test) to get the result.
  101. ## ⌨️ Development
  102. Use Gitpod, a free online dev environment for GitHub.
  103. [![Open in Gippod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/js-sdsl/js-sdsl)
  104. Or clone locally:
  105. ```bash
  106. $ git clone https://github.com/js-sdsl/js-sdsl.git
  107. $ cd js-sdsl
  108. $ npm install
  109. $ npm run dev # development mode
  110. ```
  111. Then you can see the output in `dist/cjs` folder.
  112. ## 🤝 Contributing
  113. Feel free to dive in! Open an issue or submit PRs. It may be helpful to read the [Contributor Guide](https://github.com/js-sdsl/js-sdsl/blob/main/.github/CONTRIBUTING.md).
  114. ### Contributors
  115. Thanks goes to these wonderful people:
  116. <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
  117. <!-- prettier-ignore-start -->
  118. <!-- markdownlint-disable -->
  119. <table>
  120. <tbody>
  121. <tr>
  122. <td align="center"><a href="https://www.linkedin.com/in/takatoshi-kondo-02a91410/"><img src="https://avatars.githubusercontent.com/u/275959?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Takatoshi Kondo</b></sub></a><br /><a href="https://github.com/js-sdsl/js-sdsl/commits?author=redboltz" title="Code">💻</a> <a href="https://github.com/js-sdsl/js-sdsl/commits?author=redboltz" title="Tests">⚠️</a></td>
  123. <td align="center"><a href="https://www.youtube.com/c/noname0310"><img src="https://avatars.githubusercontent.com/u/48761044?v=4?s=100" width="100px;" alt=""/><br /><sub><b>noname</b></sub></a><br /><a href="https://github.com/js-sdsl/js-sdsl/commits?author=noname0310" title="Code">💻</a></td>
  124. </tr>
  125. </tbody>
  126. </table>
  127. <!-- markdownlint-restore -->
  128. <!-- prettier-ignore-end -->
  129. <!-- ALL-CONTRIBUTORS-LIST:END -->
  130. This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
  131. ## ❤️ Sponsors and Backers
  132. The special thanks to these sponsors or backers because they provided support at a very early stage:
  133. <a href="https://eslint.org/"><img src="https://js-sdsl.org/assets/image/sponsors/eslint-logo-color.png" alt="eslint logo" width="150"></a>
  134. Thanks also give to these sponsors or backers:
  135. [![sponsors](https://opencollective.com/js-sdsl/tiers/sponsors.svg?avatarHeight=36)](https://opencollective.com/js-sdsl#support)
  136. [![backers](https://opencollective.com/js-sdsl/tiers/backers.svg?avatarHeight=36)](https://opencollective.com/js-sdsl#support)
  137. ## 🪪 License
  138. [MIT](https://github.com/js-sdsl/js-sdsl/blob/main/LICENSE) © [ZLY201](https://github.com/zly201)
  139. [Edge-Icon]: https://js-sdsl.org/assets/image/platform/edge.png
  140. [Firefox-Icon]: https://js-sdsl.org/assets/image/platform/firefox.png
  141. [Chrome-Icon]: https://js-sdsl.org/assets/image/platform/chrome.png
  142. [Safari-Icon]: https://js-sdsl.org/assets/image/platform/safari.png
  143. [Opera-Icon]: https://js-sdsl.org/assets/image/platform/opera.png
  144. [NodeJs-Icon]: https://js-sdsl.org/assets/image/platform/nodejs.png
  145. [stack-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/OtherContainer/Stack.ts
  146. [stack-npm-version]: https://img.shields.io/npm/v/@js-sdsl/stack
  147. [stack-npm-link]: https://www.npmjs.com/package/@js-sdsl/stack
  148. [stack-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/stack/dist/umd/stack.min.js?compression=gzip&style=flat-square/
  149. [stack-umd-link]: https://unpkg.com/@js-sdsl/stack/dist/umd/stack.min.js
  150. [stack-docs]: https://js-sdsl.org/js-sdsl/classes/Stack.html
  151. [queue-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/OtherContainer/Queue.ts
  152. [queue-npm-version]: https://img.shields.io/npm/v/@js-sdsl/queue
  153. [queue-npm-link]: https://www.npmjs.com/package/@js-sdsl/queue
  154. [queue-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/queue/dist/umd/queue.min.js?compression=gzip&style=flat-square/
  155. [queue-umd-link]: https://unpkg.com/@js-sdsl/queue/dist/umd/queue.min.js
  156. [queue-docs]: https://js-sdsl.org/js-sdsl/classes/Queue.html
  157. [priority-queue-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/OtherContainer/PriorityQueue.ts
  158. [priority-queue-npm-version]: https://img.shields.io/npm/v/@js-sdsl/priority-queue
  159. [priority-queue-npm-link]: https://www.npmjs.com/package/@js-sdsl/priority-queue
  160. [priority-queue-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/priority-queue/dist/umd/priority-queue.min.js?compression=gzip&style=flat-square/
  161. [priority-queue-umd-link]: https://unpkg.com/@js-sdsl/priority-queue/dist/umd/priority-queue.min.js
  162. [priority-queue-docs]: https://js-sdsl.org/js-sdsl/classes/PriorityQueue.html
  163. [vector-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/SequentialContainer/Vector.ts
  164. [vector-npm-version]: https://img.shields.io/npm/v/@js-sdsl/vector
  165. [vector-npm-link]: https://www.npmjs.com/package/@js-sdsl/vector
  166. [vector-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/vector/dist/umd/vector.min.js?compression=gzip&style=flat-square/
  167. [vector-umd-link]: https://unpkg.com/@js-sdsl/vector/dist/umd/vector.min.js
  168. [vector-docs]: https://js-sdsl.org/js-sdsl/classes/Vector.html
  169. [link-list-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/SequentialContainer/LinkList.ts
  170. [link-list-npm-version]: https://img.shields.io/npm/v/@js-sdsl/link-list
  171. [link-list-npm-link]: https://www.npmjs.com/package/@js-sdsl/link-list
  172. [link-list-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/link-list/dist/umd/link-list.min.js?compression=gzip&style=flat-square/
  173. [link-list-umd-link]: https://unpkg.com/@js-sdsl/link-list/dist/umd/link-list.min.js
  174. [link-list-docs]: https://js-sdsl.org/js-sdsl/classes/LinkList.html
  175. [deque-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/SequentialContainer/Deque.ts
  176. [deque-npm-version]: https://img.shields.io/npm/v/@js-sdsl/deque
  177. [deque-npm-link]: https://www.npmjs.com/package/@js-sdsl/deque
  178. [deque-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/deque/dist/umd/deque.min.js?compression=gzip&style=flat-square/
  179. [deque-umd-link]: https://unpkg.com/@js-sdsl/deque/dist/umd/deque.min.js
  180. [deque-docs]: https://js-sdsl.org/js-sdsl/classes/Deque.html
  181. [ordered-set-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/TreeContainer/OrderedSet.ts
  182. [ordered-set-npm-version]: https://img.shields.io/npm/v/@js-sdsl/ordered-set
  183. [ordered-set-npm-link]: https://www.npmjs.com/package/@js-sdsl/ordered-set
  184. [ordered-set-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/ordered-set/dist/umd/ordered-set.min.js?compression=gzip&style=flat-square/
  185. [ordered-set-umd-link]: https://unpkg.com/@js-sdsl/ordered-set/dist/umd/ordered-set.min.js
  186. [ordered-set-docs]: https://js-sdsl.org/js-sdsl/classes/OrderedSet.html
  187. [ordered-map-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/TreeContainer/OrderedMap.ts
  188. [ordered-map-npm-version]: https://img.shields.io/npm/v/@js-sdsl/ordered-map
  189. [ordered-map-npm-link]: https://www.npmjs.com/package/@js-sdsl/ordered-map
  190. [ordered-map-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/ordered-map/dist/umd/ordered-map.min.js?compression=gzip&style=flat-square/
  191. [ordered-map-umd-link]: https://unpkg.com/@js-sdsl/ordered-map/dist/umd/ordered-map.min.js
  192. [ordered-map-docs]: https://js-sdsl.org/js-sdsl/classes/OrderedMap.html
  193. [hash-set-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/HashContainer/HashSet.ts
  194. [hash-set-npm-version]: https://img.shields.io/npm/v/@js-sdsl/hash-set
  195. [hash-set-npm-link]: https://www.npmjs.com/package/@js-sdsl/hash-set
  196. [hash-set-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/hash-set/dist/umd/hash-set.min.js?compression=gzip&style=flat-square/
  197. [hash-set-umd-link]: https://unpkg.com/@js-sdsl/hash-set/dist/umd/hash-set.min.js
  198. [hash-set-docs]: https://js-sdsl.org/js-sdsl/classes/HashSet.html
  199. [hash-map-package]: https://github.com/js-sdsl/js-sdsl/blob/main/src/container/HashContainer/HashMap.ts
  200. [hash-map-npm-version]: https://img.shields.io/npm/v/@js-sdsl/hash-map
  201. [hash-map-npm-link]: https://www.npmjs.com/package/@js-sdsl/hash-map
  202. [hash-map-umd-size]: https://img.badgesize.io/https://unpkg.com/@js-sdsl/hash-map/dist/umd/hash-map.min.js?compression=gzip&style=flat-square/
  203. [hash-map-umd-link]: https://unpkg.com/@js-sdsl/hash-map/dist/umd/hash-map.min.js
  204. [hash-map-docs]: https://js-sdsl.org/js-sdsl/classes/HashMap.html