Data Structures in Golang - Linked List (2/2)

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 5

  • @m33rkat
    @m33rkat 2 дня назад

    This is great - please keep going!

  • @fagnersales532
    @fagnersales532 3 месяца назад +1

    You teach so well! I managed to implement `remove(value int)` by myself!

  • @يوسفالمطيري-ن7ر
    @يوسفالمطيري-ن7ر 4 месяца назад +2

    keep up the good work :)

  • @georgy2763
    @georgy2763 2 дня назад

    I think you need to add additional check if the length of your linked list is 1 (only 1 header) you will have a panic: runtime error: invalid memory address or nil pointer dereference if you try to delete the node that does not exist. Because for previousToDelete.next.data != value will be met with 1 value in the linked list, but the next condition if previousToDelete.next.next == nil will result in error. I just added this condition as well: if l.length == 1 && l.head.data != value {
    return
    }

  • @amitk6701
    @amitk6701 3 месяца назад +2

    Please share via GH repo