Data Structures and Algorithms in Ruby: Binary Trees

  Рет қаралды 3,034

Conner Jensen

Conner Jensen

2 жыл бұрын

In this video I walk you through how to code up a binary search tree in ruby.
We start by creating the BinaryTree and Node classes and then add a find algorithm that allows us to search our binary trees to see if they contain a value.
Thanks for watching let me know if you have any question in the comment section below.

Пікірлер: 18
@tito-lx2rp
@tito-lx2rp 7 ай бұрын
Excellent explanation! New subscriber
@santaclause1988ify
@santaclause1988ify 2 жыл бұрын
Please keep these Data Structure and Algorithm videos coming.
@MinionNil
@MinionNil Жыл бұрын
great video, thnx you!
@MoeNegm
@MoeNegm 2 жыл бұрын
i added this to line 10 because it's easier to see true or false instead of the blank nil: return find_helper(root, value) || false also for the puts i did this: puts bt.root.right.nil? it would return true if it's nil. it doesn't change anything to the code it just makes it easier to test. another excellent tutorial, THANK YOU!
@teetanrobotics5363
@teetanrobotics5363 Ай бұрын
Bro awesome content. Need other data strcutures as well. stack, queues heaps, etc. Also need louder mic.
@connerjensen8170
@connerjensen8170 Ай бұрын
Noted!
@phanta5m
@phanta5m 2 жыл бұрын
Simple yet clear explanation
@azhagurajaallinall126
@azhagurajaallinall126 Жыл бұрын
I thought to search DSA Tutorial in Ruby(simple style of ruby) & i got yours .. Awesome bro,keep doing it 😃🌟✨🙌 72'nd like,1831'st view,15'th comment & new sub from now 😇😊 Love from brother at India 24.01.2023 07:48 pm ist
@user-lg8dj9dz1l
@user-lg8dj9dz1l 2 жыл бұрын
Дякую! Nice content.
@kylespeller
@kylespeller 2 жыл бұрын
This is so hopeful. Thanks a ton. You did a great job explaining this
@jekoapulava3908
@jekoapulava3908 Жыл бұрын
I literally learned everything thanks to you. Hope you doing well and waiting for your new videos
@louisritter6798
@louisritter6798 2 жыл бұрын
Are there more videos in this series coming? Very good content and clear explanations
@amitkumar352
@amitkumar352 2 жыл бұрын
Excellent content, just curious that is it okay to use Struct for creating nodes like Node = Struct.new(:value, :left, :right)?
@connerjensen8170
@connerjensen8170 2 жыл бұрын
Thanks! Yes that is a great idea, I think a struct would be a great replacement for the Node class. Thanks for your comment!
@GokuSan389
@GokuSan389 2 жыл бұрын
Hello nice video, can't wait to see the next one. Just did this exercise, keep them coming. However I have an itsy-bitsy tiny correction :) In Node initialize method you can use keyword arguments so you don't have to reassign nil values for left and right, i.e. left: nil, right: nil, value: nil. I am curious though should value be initialized as nil, should binary tree hold a node with nil value 🤔
@celinepatagmiranda7849
@celinepatagmiranda7849 Жыл бұрын
Is using self the same as using @? Example self.value = 4 VS @value = 4
@ljkafds
@ljkafds 10 ай бұрын
It would have the same effect, which I'm guessing is the reason people asked in a previous video-it's a bit more concise and idiomatic to set the instance variable over using the attr_writer in initialize, but both work.
@okumuoriaro4994
@okumuoriaro4994 Жыл бұрын
Is it me or I can't hear a thing dude, why are you swallowing your words?
Data Structures and Algorithms in Ruby: Linked Lists
14:51
Conner Jensen
Рет қаралды 6 М.
Data Structures: Trees
9:57
HackerRank
Рет қаралды 993 М.
Mini Jelly Cake 🎂
00:50
Mr. Clabik
Рет қаралды 17 МЛН
RSpec Tutorial #1: Getting Started With RSpec
9:00
Conner Jensen
Рет қаралды 20 М.
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 241 М.
How to solve (almost) any binary tree coding problem
4:20
Inside code
Рет қаралды 154 М.
How I Got Good at Coding Interviews
6:29
NeetCode
Рет қаралды 1,6 МЛН
the new PS4 jailbreak is sort of hilarious
12:21
Low Level Learning
Рет қаралды 40 М.
Binary Search Algorithm in 100 Seconds
2:20
Fireship
Рет қаралды 503 М.