- 博客(9)
- 收藏
- 关注
原创 DSA__JS 学习随笔--字典
字典(Dictionary)字典是一种以键-值对形式存储数据的数据结构Dictionary类function Dictionary() { this.dataStore = new Array(); this.add = add; this.find = find; this.remove = remove; this.showAll = showAll; this.count = count; this.clear = clear; function add(key, value)
2021-11-16 09:49:18 320
原创 DSA__JS 学习随笔--链表
链表(Linked List)链表是由一组节点组成的集合每个节点都是用一个对象的引用指向它的后继,指向另一个节点的引用叫做链数组元素靠它们的位置进行引用,链表元素则是靠相互之间的关系进行引用链表的实现//Node类function Node(element) { this.element = element; this.next = null;}//LinkedList类function LList() { this.head = new Node("head"); this.fi
2021-11-15 16:42:14 542
原创 DSA__JS 学习随笔--队列
队列(Queue)队列是一种列表,只能在队尾插入元素,在队首删除元素队列是一种先进先出(First-In-First-Out, FIFO)的数据结构队列的实现function Queue() { this.dataStore = []; this.enqueue = enqueue; this.dequeue = dequeue; this.front = front; this.back = back; this.toString = toString; this.empty = e
2021-11-15 11:55:04 514
原创 DSA__JS 学习随笔--栈
栈(Stack)栈是一种特殊的列表,栈内的元素只能通过列表的一端访问,这一端称为栈顶栈是一种后入先出(LIFO, last-in-first-out)的数据结构栈的实现采用数组作为实现栈的底层数据结构来存储数据function Stack() { this.dataStore = []; this.top = 0; this.push = push; this.pop = pop; this.peek = peek; this.clear = clear; this.length =
2021-11-15 10:37:24 71
原创 DSA__JS 学习随笔--数组
数组(Array)使用数组创建数组// 1.通过[]操作符声明一个数组变量 效率最高let numbers = [];// 2.在声明数组变量时,直接在[]操作符内放入一组元素let numbers_ = [1, 2, 3, 4, 5];// 3.调用Array的构造函数创建数组let numbers__ = new Array();在脚本语言中,数组中的元素不必是同一种数据类型let obj = [1, 'hello', false, null];判断一个对象是否是数组Arra
2021-11-10 17:40:15 540
原创 JS 有趣的东西
递归函数纯暴力搜索1.组合1234 大小为2的组合 12、13、14、23、24、342.切割问题给定一个字符串 有几种切割方式3.子集问题1234的子集 1、2、3、 4、12、13、14、23、24、34、123、124、2344.排列问题5.棋盘问题...
2021-11-09 21:00:25 578
原创 JS 迭代器
在JavaScript中,迭代器是一个对象,它定义了一个序列,并可能在序列终止定义一个返回值。简单迭代器示例: function createRangeIterator(start, end, space) { let next = start; const rangeIterator = { next: function() { let res; if(next < end) { res = { value: next; done: false
2021-11-09 10:07:38 373
原创 Node.js 文件处理操作
新建文件夹const fs = require('fs');const path = require('path');function createFolder(dirpath){ try { if(!fs.existsSync(dirPath)){ let temPath; dirPath.split(/[/\\]/).forEach(function (dirName) { if (temPath) { temPath = path.join(te
2021-09-24 09:52:40 150
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人