b0VIM 8.0N/\vDAIusuarioubuntu~usuario/LPP/prct6/prct06/lib/prct06/list.rbutf-8 3210#"! UtpadeY=0#se_ZX?2!  ~ p j e c 2 '   q c U N : '    u a Z J I 7 ) "    m V C : - %    s m h g Y = :  wv[PO<)eend end end end end x, y = y, x if (x>y) @aux[@pos..@aux.length-1] do |y| @pos = @pos + 1 @aux.each do |x| @pos = 0 @aux = self.map { |x| x} def sort_each end return @aux end end end @aux[y], @aux[y+1] = @aux[y+1], @aux[y] if ( @aux[y] > @aux[y+1] ) for y in 0..@aux.length-2-x for x in 0..@aux.length-1 @aux = self.map { |x| x } def sort_for end end aux = aux.nexst yield aux.value while aux!=nil do aux = @head def each(&block) #Funciones enumerables de la clase end return string end string+="]" end end aux=nil else aux=aux.nexst if(aux.nexst!=nil) string+=aux.value.to_s+"," while aux!=nil do if(@head!=nil) string="[" aux=@head def to_s #Método to_s que combierte la clase a string end end return aux end @head=nil if(@tail==nil) aux.prev=nil end @tail.nexst=nil if(@tail!=nil) @tail=@tail.prev aux=tail else puts "Lista vacia" if(@tail==nil) def extract_tail #Método de extracción por la cola end end @head=node @head.prev=node node.nexst=@head else @head=node @tail=node if(@head==nil) node = Node.new(value, nil, nil) def insert_head(value) #Metodo de inserción por la cabeza end end return false else return true if(@tail==nil) def empty #Función que retorna si la lista es vacia o no end end return aux end @tail=nil if(@head==nil) aux.nexst=nil end @head.prev=nil if(@head!=nil) @head=@head.nexst aux=@head else puts "Lista vacia" if(@head==nil) def extract #Método de extracción end end @tail=node @tail.nexst=node node.prev=@tail else @head=node @tail=node if(@tail==nil) node = Node.new(value, nil, nil) def insert(value) #Método de inserción end @tail=tail @head=head def initialize(head, tail) #Función initialize de la clase List attr_reader :head, :tail #Atributos de clase List include Enumerableclass ListNode = Struct.new(:value, :nexst, :prev)