算法
文章平均质量分 53
evail_
这个作者很懒,什么都没留下…
展开
-
js 常用排序
js常用排序算法原创 2022-06-09 14:19:03 · 128 阅读 · 0 评论 -
js设计模式之策略模式
js设计模式之策略模式 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> <style> * {原创 2020-08-15 08:55:31 · 197 阅读 · 0 评论 -
JS设计模式之发布订阅模式
JS设计模式之发布订阅模式 class Observe { constructor() { this.cacheList = {} } publish(type, message) { this.cacheList[type] && this.cacheList[type].forEach(item => item(message))原创 2020-08-15 08:50:13 · 122 阅读 · 0 评论 -
js常用排序方法
桶排序 桶排序只能对正整数进行排序,利用js的数组特性,创建一个新数组作为桶,然后遍历原数组,将值放入对应的桶中,就是将原数组每一项的值作为新数组的索引,该方法为去重排序 function sortT(arr) { var index = []; for (let i = 0; i < arr.length; i++) { if (parseInt(arr[i]) == arr[i]) { index[arr[i]] = 1 }原创 2020-07-11 15:40:40 · 195 阅读 · 0 评论 -
ES6 实现二叉排序树
这里写自定义目录标题ES6 实现二叉排序树定义节点类定义二叉树类二叉排序树特性生成二叉排序树遍历方式二叉排序树的查找方式增加节点删除节点修改节点其他方法GitHub ES6 实现二叉排序树 定义节点类 class Node { //定义节点类 constructor(value) { this.value = value; } addParents(node) { //添加父节点 this.parents = node } addChi原创 2020-07-05 10:57:15 · 404 阅读 · 0 评论