Перейти к содержимому

Coding Challenge #65.1: Binary Search Tree

The Coding Train

0:00 / 0:00

Coding Challenge #65.1: Binary Search Tree

357 929 просмотров · 9 лет назад
The Coding Train
1,76 млн подписчиков
357 929 просмотров · 9 лет назад
This multi-part coding challenge is part of the first week of my course: "Intelligence and Learning." Here I attempt to implement a classic data structure: The Binary Search Tree. Code: https://thecodingtrain.com/challenges... p5.js Web Editor Sketches: 🕹️ Binary Search Tree: https://editor.p5js.org/codingtrain/s... 🕹️ Visualizing a Binary Tree: https://editor.p5js.org/codingtrain/s... Other Parts of this Challenge: 📺 Visualizing a Binary Tree:    • Coding Challenge #65.2: Visualizing a Bina...   🎥 Previous video:    • Coding Challenge #64.1: Forward Kinematics   🎥 Next video:    • Coding Challenge #66: JavaScript Countdown...   🎥 All videos:    • Coding Challenges   References: 📕 Intelligence and Learning (Spring 2017): https://github.com/shiffman/NOC-S17-2... 📘 Grokking Algorithms book: http://amzn.to/2mMCK7Z 🔴 Live Stream Archive #87.3:    • Coding Train Live 87: Timer in JavaScript,...   Related Coding Challenges: 🚂 #68 Breadth-First Search:    • Coding Challenge #68: Breadth-First Search...   🚂 #98 Quadtree:    • Coding Challenge #98.1: Quadtree - Part 1   Timestamps: 0:00 Introducing today's topic: Binary Trees 1:18 Why would you use a binary tree? 3:36 What is a data structure? 4:47 Nodes with children 8:27 Algorithm for how the tree is sorted 11:36 Node object 12:17 Tree object 12:39 Use prototype to add an addNode function 18:58 Use recursion to add nodes 20:42 Deal with the case when two values are equal 22:50 How do you traverse the tree? 25:00 What does it mean to visit a node? 27:39 Add random values 28:58 Add a function to search the tree 37:57 Conclusion and suggested variations Editing by Mathieu Blanchette Animations by Jason Heglund Music from Epidemic Sound 🚂 Website: http://thecodingtrain.com/ 👾 Share Your Creation! https://thecodingtrain.com/guides/pas... 🚩 Suggest Topics: https://github.com/CodingTrain/Sugges... 💡 GitHub: https://github.com/CodingTrain 💬 Discord: https://thecodingtrain.com/discord 💖 Membership: http://youtube.com/thecodingtrain/join 🛒 Store: https://standard.tv/codingtrain 🖋️ Twitter:   / thecodingtrain   📸 Instagram:   / the.coding.train   🎥 Coding Challenges:    • Coding Challenges   🎥 Intro to Programming:    • Start learning here!   🔗 p5.js: https://p5js.org 🔗 p5.js Web Editor: https://editor.p5js.org/ 🔗 Processing: https://processing.org 📄 Code of Conduct: https://github.com/CodingTrain/Code-o... This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecod... #binarysearchtree #datastructure #intelligenceandlearning #javascript #p5js