Sha256: 24ccc26a0e3dcc67bd45411ecf73c20c15964b1f3826ce8bfa8606122729fcbc
Contents?: true
Size: 469 Bytes
Versions: 1
Compression:
Stored size: 469 Bytes
Contents
class Linked_list attr_reader :inicio Node = Struct.new(:value,:next) def initialize @inicio=Node.new(nil,nil) end def insert(data) aux=Node.new(data,@inicio) @inicio=aux end def extract temp= @inicio[:value] @inicio=@inicio[:next] temp end def to_s temp = @inicio cont= 1 string = "" while(temp[:next]!=nil) string+="Valor numero #{cont}) Equivale a #{temp[:value]}\n" temp=temp[:next] cont+=1 end string end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dieta_alu0100885941-0.1.0 | lib/dieta/linked_list.rb |