Sha256: 8a6bef3c9a021521ad3044ea7780683cd1fe29d718bb3f2fa7a1364048cea3bd

Contents?: true

Size: 437 Bytes

Versions: 1

Compression:

Stored size: 437 Bytes

Contents

module Zadt
  class DoublyLinkedListNode
    attr_accessor :val
    attr_reader :next, :prev
    def initialize(val = nil, next_ = nil)
      @val = val
      if !next_
        @next = next_
      else
        self.next = next_
      end
      @prev = nil
    end

    def next=(node)
      @next = node
      node.prev = self
    end

    def prev=(node)
      @prev = node
      node.next = self if node.next != self
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zadt-1.1.7 lib/zadt/AbstractDataTypes/LinkedList/DoublyLinkedList.rb