Golang Linked List - Golang Data Structures

  Рет қаралды 15,065

Golang Dojo

Golang Dojo

Күн бұрын

Пікірлер: 33
@GolangDojo
@GolangDojo 3 жыл бұрын
📝Get your *FREE Golang Cheat Sheet* - golangdojo.com/cheatsheet
@stephenoginga5926
@stephenoginga5926 9 ай бұрын
understood
@farzadmf
@farzadmf 3 жыл бұрын
Thank you for the great and engaging video. Small go nit suggestion: when using receiver functions, it's recommended to be consistent to either use a value pointer or a reference pointer. In fact, if you use mixed, go lint tools will complain.
@GolangDojo
@GolangDojo 3 жыл бұрын
I use golangci-lint which I heard is supposed to be strict, and nothing came up. Let me do some digging.
@GolangDojo
@GolangDojo 3 жыл бұрын
I'd imagine it's safer to pass by value and only use pointers when modifications to the data structure are needed. I asked around in the official Discord too and that seems to be the case. Also, golint is deprecated for what that's worth. Thanks for pointing this out!
@farzadmf
@farzadmf 3 жыл бұрын
I have a bunch of checks being run on my Go code usually and maybe linting is fine and it's one of the tools showing me warnings about that. What you mentioned is 100% true (using pointer receivers when modifying something); it's the consistency that matters usually: if you have one function receiving a pointer receiver because it's modifying something, even the ones not modifying anything are usually changed to receive a pointer receiver. Of course if you find a link or something that says you can have a mix of receivers, please let me know
@GolangDojo
@GolangDojo 3 жыл бұрын
I honestly have no idea which is preferred and don't have strong preference on either. If the linter is complaining, I'd probably listen to the linter in use. I'll keep an eye out on this, and maybe even mention our conversation here in a future video comparing popular Goalng linters!
@manpt123
@manpt123 Жыл бұрын
Thank you sir, when you said it took a day to create this video I immediately subscribed.
@letsgetrusty
@letsgetrusty 3 жыл бұрын
This guy putting out movies
@GolangDojo
@GolangDojo 3 жыл бұрын
HAHAHA
@alfredogrande2430
@alfredogrande2430 3 жыл бұрын
everyone: array golang dojo: *awway* jk, love your tutorials keep it up!
@GolangDojo
@GolangDojo 3 жыл бұрын
You should've seen my older channels. My accent was way worse lol. And thanks!
@patbateman-o4g
@patbateman-o4g 3 жыл бұрын
Honestly great video, already understood the concept of a linked list, however, you solidified my knowledge and you explained this much better than any of my prior instructors even did xD
@GolangDojo
@GolangDojo 3 жыл бұрын
Glad it was helpful!
@kaushikplays4676
@kaushikplays4676 3 жыл бұрын
func (l *LinkedList) remove(value int) { previous := l.head for current := l.head; current != nil; current = current.next { if current.value == value { if l.head == current { l.head = current.next } previous.next = current.next break } previous = current } } I kept head as the placeholder for previous. Do you think this is wrong?
@GolangDojo
@GolangDojo 3 жыл бұрын
The best way to figure it out is write some unit tests ;)
@linwei2906
@linwei2906 2 жыл бұрын
me too. func (l *linkedList) remove(value int) { /* if head.value = vlaue head = head->next */ if l.head.value == value { l.head = l.head.next } else { p := l.head iterator := p.next for ; iterator != nil; iterator = iterator.next{ if iterator.value == value { p.next = iterator.next } else { p = p.next } } } }
@dcastro97
@dcastro97 2 жыл бұрын
great video man!!.. I think we missed up to write a method to get length of a linked list, right?
@GolangDojo
@GolangDojo 2 жыл бұрын
Nice catch :)
@JC-jn9kp
@JC-jn9kp 2 жыл бұрын
For linkedlist, How are we able to input multiple values? Like "string", "string", Int
@Levelord92
@Levelord92 Жыл бұрын
But isn't Add() operation is O(n) since we need to iterate over the whole linked list in order to insert new element to the back?
@simonedandreta7883
@simonedandreta7883 3 жыл бұрын
How would you write a unit test for a method that doesn't return anything? For example the add() method. Thanks!
@GolangDojo
@GolangDojo 2 жыл бұрын
Testing series on the pipeline!
@simonedandreta7883
@simonedandreta7883 2 жыл бұрын
@@GolangDojo I have written few methods on linked lists in Go along with tests, but I am looking forward to your series!
@gwnbw
@gwnbw 2 жыл бұрын
17:34 whats that you use that package and method pops up if you hover over it?
@koushikhridoy8180
@koushikhridoy8180 Жыл бұрын
Please work on your English. It's difficult to understand. Great video though.
@vanshajdhar9223
@vanshajdhar9223 3 жыл бұрын
Amazing long awaited series
@GolangDojo
@GolangDojo 3 жыл бұрын
More on the way!
@lasfito
@lasfito Жыл бұрын
Great content, man. Appreciate it
@kaushik5055
@kaushik5055 3 жыл бұрын
Was waiting for this series 😃
@GolangDojo
@GolangDojo 3 жыл бұрын
Here we go! :)
@Levelord92
@Levelord92 Жыл бұрын
I would also suggest to use strconv.Itoa instead of fmt.Sprintf for converting our value into string, since we decide to max out our performance with strings builder
Golang Binary Search Tree - Golang Data Structures
36:31
Golang Dojo
Рет қаралды 9 М.
Why You Should AVOID Linked Lists
14:12
ThePrimeTime
Рет қаралды 277 М.
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 2,3 МЛН
How To Get Married:   #short
00:22
Jin and Hattie
Рет қаралды 24 МЛН
Which One Is The Best - From Small To Giant #katebrush #shorts
00:17
So...you THINK you know Go?
6:34
Golang Dojo
Рет қаралды 16 М.
This Will Make Everyone Understand Golang Interfaces
21:03
Anthony GG
Рет қаралды 52 М.
Linked List in Go (Data Structures and Algorithms - Golang)
27:01
Esoteric Tech
Рет қаралды 10 М.
If you are a beginner in Go, avoid this Slice pitfall!
9:26
Flo Woelki
Рет қаралды 4 М.
Beginners Should Think Differently When Writing Golang
11:35
Anthony GG
Рет қаралды 111 М.
Dynamic Programming isn't too hard. You just don't know what it is.
22:31
DecodingIntuition
Рет қаралды 157 М.
This Is The BEST Way To Structure Your GO Projects
11:08
Melkey
Рет қаралды 76 М.
Golang Generics. Do we ACTUALLY need them!?
12:51
Golang Dojo
Рет қаралды 19 М.
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 2,3 МЛН