#binarytree

Fanyang Meng :verified:FanyangMeng@mfy.social
2025-04-23

Ever tried finding the minimum depth of a binary tree? 🌳 It’s not as simple as it sounds! The challenge lies in correctly identifying the shortest path to a leaf node (one with no children). This post dives into the nuances, common pitfalls, and multiple solution approaches—recursive and iterative—to tackle this problem effectively. Whether you're a coding enthusiast or prepping for interviews, this is a gem! Read more here: fanyangmeng.blog/111-minimum-d #LeetCode #BinaryTree #Coding

Orhun Parmaksız 👾orhun@fosstodon.org
2025-04-10

Need a random map for your Rust game project? Np.

🦀 **knossos**: A Rust library / CLI for generating mazes.

🚀 Supports multiple algorithms & saving to a file!

⭐ GitHub: github.com/unrenamed/knossos

#rustlang #maze #library #opensource #gamedev #generation #binarytree #labrinth

Fanyang Meng :verified:FanyangMeng@mfy.social
2025-02-23

🧠💡 Determining whether a binary tree is symmetric is a common problem in coding interviews. This blog post explores both recursive and iterative approaches to solve this problem effectively. Understanding the logic behind these methods is crucial for mastering binary tree operations. Whether you prefer recursion or iteration, this guide provides clear explanations and Python code examples to help you grasp the concepts. Check out the full post here: fanyangmeng.blog/symmetric-tre #LeetCode #BinaryTree #Python

Fanyang Meng :verified:FanyangMeng@mfy.social
2025-02-21

Inverting a binary tree is a classic problem that teaches valuable lessons about tree traversal and recursion. This blog post explores different approaches, including recursive and iterative methods, and compares their strengths and weaknesses. Whether you're preparing for technical interviews or enhancing your algorithmic skills, understanding this problem is crucial. Dive in to strengthen your tree manipulation skills! 🌳🔄 Read more: fanyangmeng.blog/invert-binary #BinaryTree #Algorithms

Kerrick Long (code)kerrick@ruby.social
2025-02-13

Ruby's expressiveness is second to none.

#Ruby #BinaryTree #LeetCode #Programming

class BinaryNode
  attr_accessor :value, :parent, :left, :right

  include Enumerable
  def each(...) = each_breadth_first(...)

  def initialize value, left = nil, right = nil
    @value, @left, @right = value, left, right
    children.each { it.parent = self }
  end

  def left? = (not left.nil?)
  def right? = (not right.nil?)
  def parent? = (not parent.nil?)

  def root? = parent.nil?
  def leaf? = (left.nil? and right.nil?)
  def balanced? = (left? and right?)
  def all_balanced? = all? { it.balanced? or it.leaf? }

  def children = [left, right].compact
  def ancestors = if root? then [] else parent.ancestors + [parent] end
  def descendants = collect { it.children }.flatten
  def depth = map { it.ancestors.size }.max + 1

  def each_breadth_first(&block) = traverse :push, &block
  def each_depth_first(&block) = traverse :unshift, &block

  private def traverse method, &block
    nodes = [self]
    until nodes.empty?
      current = nodes.shift
      yield current
      nodes.send(method, *current.children)
    end
  end
end
Anya "CZGoldEdition" Hueing - Artist for Hire 🎨czgoldedition@meow.social
2025-01-02

Another new sample photo - here's Leaf!! The final pin of the Earth Unit Line!

The clear enamel is a little overfilled here, but otherwise it's almost there! To get this pin, follow the Short Circuit pre-launch page here: backerkit.com/call_to_action/8 🍂✨

#leaf #leaves #binarytree #printedcircuitboard #pcb #natureart #scifiart #enamelpins #pins #backerkit #pintopia #artistsonmastodon

Photo of a hand holding up a hybrid enamel pin of leaves designed to look like a printed circuit board (PCB). Text on the image reads: "Short Circuit", "Leaf", and "manufacturer pin sample".
JSDev Spacejsdevspace
2024-11-06
Akshat Singhakshatsingh
2024-10-24

☑️ Day 26/100: daily question

🟨 Question: 951. Flip Equivalent Binary Trees

Good binary tree question and I did see the approach but got good understanding of tree questions

🐈‍⬛ Check out my where I post all the daily streak 🔥 questions and 🏆 solutions

🔗 My Leetcode Github: github.com/akshatsingh1718

🔗 Solution Link: github.com/akshatsingh1718/lee

Akshat Singhakshatsingh
2024-10-23

☑️ Day 25/100: daily question

🟨 Question: 2641. Cousins in Binary Tree II

Easy binary tree question but I saw the solution, could be done without seeing it.

🐈‍⬛ Check out my where I post all the daily streak 🔥 questions and 🏆 solutions

🔗 Solution Link: github.com/akshatsingh1718/lee

🔗 My Leetcode Github: github.com/akshatsingh1718/lee

Akshat Singhakshatsingh
2024-10-23

☑️ Day 24/100: daily question

🟨 Question: 2583. Kth Largest Sum in a Binary Tree

Easy binary tree question

🐈‍⬛ Check out my where I post all the daily streak 🔥 questions and 🏆 solutions

🔗 Solution Link: github.com/akshatsingh1718/lee

🔗 My Leetcode Github: github.com/akshatsingh1718/lee

Mohammad HajiaghayiMTHajiaghayi@mathstodon.xyz
2023-05-04

Now (7pm ET Wed) watch youtu.be/B6ew819GVBI (FEEL FREE TO SUBSCRIBE TO YOUTUBE
@hajiaghayi

FOR FUTURE LESSONS) Lesson 18: Introduction to Algorithms by Mohammad Hajiaghayi:
#Trees #TreeStructures #SearchTrees #rootedtree #binarytree #dictionaryoperation #insert #delete

kowsvc :runbsdBg:joakinen@bsd.network
2022-12-25

This year, 2022 marks the 60th anniversary of that fateful day in 1962 when a 24-year-old Donald Knuth started writing “The Art of Computer Programming.” Now approaching his 85th birthday, Knuth has become almost a legend in the world of computer programming — and he’s still writing additional volumes for his massive analysis of algorithms.

But every year, right around Christmas time, there’s another tradition. Knuth gives a special lecture “pitched at non-specialists” for a small audience at Stanford University (where Knuth is a professor emeritus) and a larger audience online.

Donald Knuth’s 2022 ‘Christmas Tree’ Lecture Is about Trees
thenewstack.io/donald-knuths-2

#algorithms #donaldknuth #BinaryTree

2022-06-01

This clip is a bit more peaceful than that chaotic-looking one that I posted a couple of days ago 🙂.

#mathart #mathsart #binaryTree

2022-05-08

Some stuff that led to me thinking about a relationship between #PascalsTriangle and #binaryTrees.

It seems to have started with me trying to represent Pascal’s triangle using things like #crochet, #macrame, #braiding and #knitting.

#mathart #mathsart #binaryTree

A page describing some ideas that I had about making physical representations of Pascal’s Triangle using fiber arts and how it was similar to a binary tree.Some pictorial representations of the Pascal’s Triangle binary tree.Some other thoughts and pictures related to Pascal’s Triangle, powers of 2 and maybe taking them into 3 dimensions.
2022-05-06

A radial #binaryTree

Tweeted 4 year ago with this comment: “One thing that came out of this question is...a radial #binarytree. I think that @inversed_ru did something similar a while back in a different context. I may map this onto a cone, put it in a 3d modling program, intertwine branches...or...or...something #mathart #geometricart”. Note that the user name corresponds to Twitter, not Mastodon.

A binary tree constructed outwards from a point to give a disklike appearance.
2022-05-04

And another clip of a representation of a #PascalsTriangle #BinaryTree

#mathart

2022-05-03

Here is a clip to do with the #PascalsTriangle #BinaryTree shown as individual paths layered together

#mathart

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst