Teaching Kids Programming – Four Algorithms to Validate a Binary Search Tree

Teaching Kids ProgrammingVideos on Data Structures and Algorithms Given a binary tree root, return whether it’s a binary search tree. A binary tree node is a binary search tree if : All nodes on its left subtree are smaller than node.valAll nodes on its right subtree are bigger than node.valAll nodes hold the properties.Constraintn ≤ … Read more

Teaching Kids Programming – Algorithms to Find the Lowest Common Ancestor of a Binary Search Tree

Teaching Kids ProgrammingVideos on Data Structures and Algorithms Given a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST. According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that … Read more

Teaching Kids Programming – Depth First/Limit Search and Iterative Deepening Search Algorithm on Unweighted Graph

Teaching Kids ProgrammingVideos on Data Structures and Algorithms Shipping and Receiving – Sum of Costs between Pair of Vertices in Unweighted Graph You are given a two-dimensional list of integers ports where ports[i] represents the list of ports that port i is connected to. You are also given another two-dimensional list of integers shipments where … Read more

Teaching Kids Programming – All Elements in Two Binary Search Trees (Parallel Iterative Inorder Traversal Algorithm)

Teaching Kids ProgrammingVideos on Data Structures and Algorithms Given two binary search trees root1 and root2, return a list containing all the integers from both trees sorted in ascending order. Example 1:Input: root1 = [2,1,4]root2 = [1,0,3]Output: [0,1,1,2,3,4] Example 2:Input: root1 = [1,null,8]root2 = [8,1]Output: [1,1,8,8] Constraints:The number of nodes in each tree is in … Read more

Teaching Kids Programming – Design and Develop an Apple Catching Game on Microbit using Python

Teaching Kids Programming: Videos on Data Structures and Algorithms We have actually developed and designed the Apple Catching/Eating Game on Microbit using Javascript: Microbit Programming: How to Make a Catching-Apple Game by Using Sprites Objects? Today, we are going to use the Python to re-implement the Game on Microbit. Actually we can switch the programming … Read more

Teaching Kids Programming – Simple AI Algorithm of Decision Rules/Trees in Microbit Apple Catching Game

Teaching Kids Programming: Videos on Data Structures and Algorithms Yesterday, we talked about the Apple-Catching Game on Microbit: human plays with two Buttons, A to move the bowl one pixel left, B to move the bowl one pixel right. Today, we are going to teach Computer how to play using the most simplest AI algorithm … Read more

Teaching Kids Programming – Left/Right Side View of a Binary Tree using Depth/Breadth First Search Algorithms

Teaching Kids Programming: Videos on Data Structures and Algorithms Given the root of a binary tree, imagine yourself standing on the left/right side of it, return the values ​​of the nodes you can see ordered from top to bottom. Given the following Binary Tree, the left side view will be [6, 3, 6] while the … Read more