随笔分类 - 数据结构
数据结构
摘要://快速排序 class ArrayList { constructor () { this.array = [] } insert (data) { return this.array.push(data) } quickSort () { this.array = this.quick(this
阅读全文
摘要://快速排序 class ArrayList { constructor () { this.array = [] } insert (data) { return this.array.push(data) } quickSort () { this.array = this.quick(this
阅读全文
摘要://归并排序 class ArrayList { constructor () { this.array = [] } insert (data) { return this.array.push(data) } mergeSort () { this.array = this.merge_1(th
阅读全文
摘要://希尔排序 class ArrayList { constructor () { this.array = [] } insert (data) { return this.array.push(data) } shellSort () { let length = this.array.leng
阅读全文
摘要://选择排序 class ArrayList { constructor () { this.array = [] } insert (data) { return this.array.push(data) } tostring () { return this.array.join('-') }
阅读全文
摘要://冒泡排序 class ArrayList { constructor () { this.array = [] } insert (data) { return this.array.push(data) } tostring () { return this.array.join('-') }
阅读全文
摘要:// 节点类 class Node { constructor(data) { this.data = data this.left = null this.right = null } } //平衡二叉树Balanced Binary Tree class BBT { constructor()
阅读全文
摘要:class Node { constructor (data) { this.data = data this.next = null } } class LinkList { constructor () { //初始化,空链表,长度为0 this.head = null this.length
阅读全文
摘要://二叉树BST class Node { constructor (data) { this.data = data this.left = null this.right = null } } class BST { constructor () { this.root = null } ins
阅读全文
摘要://二叉树BST class Node { constructor (data) { this.data = data this.left = null this.right = null } } class BST { constructor () { this.root = null } ins
阅读全文
摘要://二叉树BST class Node { constructor (data) { this.data = data this.left = null this.right = null } } class BST { constructor () { this.root = null } ins
阅读全文
摘要://递归 //阶乘 function factorial (n) { if (n == 0) return 1 return n * factorial(n - 1) } //斐波那契数列 function fibonacci (n) { if (n == 1 || n == 2) return 1
阅读全文
摘要://集合,不允许重复,无序 class Gather { constructor () { this.items = {} } add (prop) { if (this.isHas(prop)) return false else this.items[prop] = undefined retu
阅读全文
摘要://双向循环链表 class DoubleNode { constructor (data) { this.data = data this.prev = null this.next = null } } class DoubleCycleList { constructor () { this.
阅读全文
摘要://单向循环链表 class Node { constructor (data) { this.data = data this.next = null } } class CycleList { constructor () { this.head = null this.length = 0 }
阅读全文
摘要://双向链表 class Node { constructor (data) { this.data = data this.prev = null this.next = null } } class DoubleList { constructor () { this.head = null t
阅读全文
摘要://链表结构 //封装节点 class Node { constructor (data) { this.data = data this.next = null } } class LinkList { constructor () { //初始化,空链表,长度为0 this.head = nul
阅读全文
摘要:class priorityElement { constructor (elem, priority) { this.elem = elem this.priority = priority } } class priorityQueue { constructor () { this.items
阅读全文
摘要://队列,先进先出 class Queue { constructor () { this.items = [] } //入队 enQueue (elem) { return this.items.push(elem) } //出队 deQueue () { return this.items.sh
阅读全文
摘要://队列,先进先出 class Queue { constructor () { this.items = [] } //入队 enqueue (elem) { return this.items.push(this.items) } //出队 dequeue () { return this.it
阅读全文