duyi-edu / duyi-webalgorithm Goto Github PK
View Code? Open in Web Editor NEW算法课程资料
算法课程资料
前端算法课 每节课内容查看课程对应的分支
修改
function f1(rootList, target) {
if (rootList == null || rootList.length == 0) return false;
var childList = []; //当前层所有节点的子节点,都在这个list中,这样传入下一层级的时候,就可以遍历整个层级的节点。
for (var i = 0; i < rootList.length; i++) {
if (rootList[i] != null && rootList[i].value == target) {
return true;
} else {
if (rootList[i] !== null) {
childList.push(rootList[i].left);
childList.push(rootList[i].right);
}
}
}
console.log(childList);
return f1(childList, target);
}
在链表长度为2的时候,会形成环形
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.