Sha256: 870cda0d1b356cf0cb7a93f34486070458905f94a6b1b748410cab1ceec95295

Contents?: true

Size: 750 Bytes

Versions: 1

Compression:

Stored size: 750 Bytes

Contents

require "sungemm/version"

module Sungemm
  def self.fibo_finder(n)
    if (0..1).include?(n)
      n
    else
      fibo_finder(n-2)+fibo_finder(n-1)
    end
  end

  class Stack
    def initialize(array)
      @array = array
    end

    def pop(count = 1)
      r=@array.pop(count).reverse
      r=r.last if count==1
      r
    end

    def push(values)
      values.each {|x| @array << x}
      true
    end

    def to_a
      @array
    end
  end

  class Queue
    def initialize(array)
      @array = array
    end

    def pop(count = 1)
      r = @array.shift(count)
      r = r.first if count == 1
      r
    end

    def push(values)
      values.each { |x| @array << x }
      true
    end

    def to_a
      @array
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sungemm-0.0.1 lib/sungemm.rb