programming-interviews/ruby/list/linked_list.rb
def delete(value)
    if self.head && self.head.value == value
      self.head = self.head.next_element
    else
      self.each_element do |element|
        if element.next_element && element.next_element.value == value
          element.next_element = element.next_element.next_element
        end
      end
    end
  end
# Deletes the first instance of value from list
Deletes the first instance of value from list
Deletes the first instance of value from list
def delete(value)
    if self.head && self.head.value == value
      self.head = self.head.next_element
    else
      self.each_element do |element|
        if element.next_element && element.next_element.value == value
          element.next_element = element.next_element.next_element
        end
      end
    end
  end
def delete ( value ) if self . head && self . head . value == value self . head = self . head . next_element else self . each_element do | element | if element . next_element && element . next_element . value == value element . next_element = element . next_element . next_element end end end end
Deletes the first instance of value from list
Deletes the first instance of value from list
value