Skip to content

basic data structure and algorithm written in typescript

Notifications You must be signed in to change notification settings

knewbie/algorithm-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

b0f4912 · Apr 30, 2017

History

11 Commits
Apr 17, 2017
Apr 19, 2017
Apr 17, 2017
Apr 17, 2017
Apr 17, 2017
Apr 30, 2017
Apr 30, 2017
Apr 17, 2017
Apr 30, 2017
Apr 30, 2017
Apr 17, 2017
Apr 17, 2017
Apr 17, 2017
Apr 19, 2017
Apr 15, 2017
Apr 15, 2017
Apr 15, 2017
Apr 30, 2017
Apr 30, 2017
Apr 30, 2017
Apr 17, 2017
Apr 17, 2017
Apr 30, 2017

Repository files navigation

基础数据结构与算法实现(TypeScript版)

What's this

这个仓库的代码实现,是在阅读《数据结构与算法JavaScript描述》时,用TypeScript 将书中所涉及的数据结构与算法的实现版,具体的实现跟书中的实现有出入,根据实际应用中的需要,可以进一步拓展其功能与应用。

数据结构与算法列表:

  • 列表(List)
  • 队列(Queue)
  • 栈(Stack)
  • 链表(LinkedList)
    • 单链表(List)
    • 双向链表(DLList)
    • 环链表(CLList)
  • 字典(Dict)
  • 集合(Set)
  • 二叉树(BiTree)
    • 二叉查找树(BST)
  • 图(Grap)
  • 排序算法(Sort)
    • 冒泡排序(Bubble Sort)
    • 梳排序(冒泡改进版)(Comb Sort)
    • 选择排序 (Select sort)
    • 插入排序 (Insert Sort)
    • 希尔排序 (Shell Sort)
    • 快速排序 (Quick Sort)
      • 单基准快排(递归 & 非递归)
      • 双基准快排 (Dual Pivot)
      • 三路快排 (3 way)
  • 查找算法(Search)
    • 顺序查找(Seq Search) 使用自组织数据
    • 二分查找(Binary Search)

补充:

排序算法中还有一些算法书中介绍过的未在这里列出与实现,还有这些基础算法的改进升级版,比如上面的双基准快排和三路快排。其他的算法会慢慢被充

How To Run & Test

每个对应的数据结构都有一个test_XXX的测试文件, 测试时需要先将TS文件用tsc编译器,编译为js文件,然后再用node执行对应的js文件:

    # 举个例子
    $ tsc test_List.ts
    $ node test_List.js 
    # 每次改变ts文件都需要重新编译,这个可以考虑加入fs Watch,让其在后台一直监控,每次有变动,直接编译

Note

util.ts文件里包涵了一些共用的函数实现,目前只有一个compare函数,后续如果有需要共用的,都将在些文件中实现。

About

basic data structure and algorithm written in typescript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published