Skip to content

Instantly share code, notes, and snippets.

Avatar

Alejandro AR kinduff

View GitHub Profile
@kinduff
kinduff / README.md
Last active Apr 24, 2021
[Fix Github Header using Stylus] #stylus
View README.md

Fix Github Header using Stylus

Step 1: Install Stylus

Step 2: Install the style

Install directly with Stylus

@kinduff
kinduff / donquijote.txt
Last active Apr 26, 2020
Don Quijote de la Mancha en Texto Plano
View donquijote.txt
This file has been truncated, but you can view the full file.
Capítulo I. Que trata de la condición y ejercicio del famoso hidalgo don Quijote de la Mancha
View keybase.md

Keybase proof

I hereby claim:

  • I am kinduff on github.
  • I am kinduff (https://keybase.io/kinduff) on keybase.
  • I have a public key whose fingerprint is 1560 2754 A367 26FA 204F 588E 111B 8174 3316 4BC9

To claim this, I am signing this object:

View insertion_sort.rb
def sort(values)
length = values.size - 1
1.upto(length) do |i|
temp = values[i]
j = i - 1
while j >= 0 and values[j] > temp
values[j+1] = values[j]
j -= 1
View bubble_sort.rb
def sort(values)
length = values.size - 2
swapped = true
while swapped
swapped = false
0.upto(length) do |i|
if values[i] > values[i+1]
values[i], values[i+1] = values[i+1], values[i]
View binary_search.rb
def findIndex(values, target)
binarySearch(values, target, 0, values.size - 1)
end
def binarySearch(values, target, start, finish)
return -1 if start > finish
middle = ((start+finish)/2).floor
value = values[middle]
View hash_table_linked_list.rb
class LinkedList
#...
end
class Node
#...
end
class HashTable
def initialize(size)
View linked_list_removeAt.rb
def removeAt(index)
prev = nil
node = @head
i = 0
loop do
prev = node
node = node.next
i += 1
break unless !node.nil? and i < index
end
View linked_list.rb
class LinkedList
def initialize
@head = @tail = nil
end
def add(value)
node = Node.new(value)
@head = node if @head.nil?
@tail.next = node unless @tail.nil?
View hash_table.rb
class HashTable
def initialize(size)
@size = size
@buckets = Array.new(@size)
end
def add(value)
index = hash(value)
@buckets[index] = value
end