xpoet / js-data-structure-and-algorithm Goto Github PK
View Code? Open in Web Editor NEW从 0 到 1 学习 JavaScript 数据结构与算法
Home Page: https://data-structure-and-algorithm.xpoet.cn
从 0 到 1 学习 JavaScript 数据结构与算法
Home Page: https://data-structure-and-algorithm.xpoet.cn
let myArray2 = [1,2,3,4,5]
myArray2.splice(4,2)
myArray2 => [1, 2, 3, 4]
希望贴一下Queue的代码
我的算法呢?
// remove(data) 删除指定 data 所在的节点(继承单向链表) remove(data) { return super.remove(data); }
但是单向链表中的remove方法仅仅只改变了next指针,对currentNode.next.pre没做任何修改是不是会产生问题?
是不是还应该加上这一条:
currentNode.next.pre = previousNode
[QueueElement, QueueElement, QueueElement, QueueElement, QueueElement]
0: QueueElement {element: "A", priority: 10}
1: QueueElement {element: "B", priority: 15}
2: QueueElement {element: "C", priority: 11}
3: QueueElement {element: "D", priority: 20}
4: QueueElement {element: "E", priority: 18}
let myArray2 = [1, 2, 3, 4, 5];
// 删除索引 4 位置起,2 个元素
myArray2.splice(4, 2);
console.log(myArray2); //--> [1, 2, 3,4],你写成了[1,2,3]
两篇链表的常见操作里 isEmpty() 后面返回 trun
应该是打错字了吧
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.