Sha256: b93628dbcc29d7aa58d69b9ed0f05a9201d618161e35769989a9821c8be24404

Contents?: true

Size: 357 Bytes

Versions: 1

Compression:

Stored size: 357 Bytes

Contents

puts "Linear Search"
puts "-------------"

def findIndexAndNumber(number, array)
  i = 0 # Inicializador do array
  size = array.length
  while i < size do
    if array[i] == number then
      puts "Number #{number} founded at #{i} of array"
      return
    end
    i = i + 1
  end

  puts "Number not found!"
end

findIndexAndNumber(56, [22,32,12,44,56])

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
algoritmos-0.1.0 lib/LinearSearch.rb