This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package binary_search | |
import "errors" | |
// For testing: | |
// var Find = FindRecursive | |
var Find = FindIterative | |
func FindRecursive(list []int, num int) (int, error) { | |
if len(list) == 0 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package singly_linked_list | |
import ( | |
"bytes" | |
"errors" | |
"fmt" | |
) | |
type sListNode struct { | |
value interface{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CaesarCipher | |
( | |
encrypt | |
, decrypt | |
, cipher | |
) where | |
import Data.Char | |
isAsciiLetter :: Char -> Bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"strconv" | |
) | |
func Primes(n int) []int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"os" | |
"strconv" | |
) | |
func MakePascalTriangle(height int) [][]int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env runhaskell | |
import Control.Monad (when, unless) | |
main :: IO () | |
main = mapM_ fb [1..100] | |
fb :: Int -> IO () | |
fb n = do | |
let divBy3 = n `mod` 3 == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package priority_queue | |
import "errors" | |
type Elem struct { | |
Score int | |
Data interface{} | |
} | |
type priorityQueue struct { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
assert :: Bool -> () | |
assert False = error "assertion failed" | |
assert True = () | |
qSort :: Ord a => [a] -> [a] | |
qSort [] = [] | |
qSort [x] = [x] | |
qSort (x:xs) = qSort less ++ [x] ++ qSort more |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"strconv" | |
"strings" | |
) | |
type Node struct { | |
Data interface{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node | |
attr_accessor :data, :left, :right | |
def initialize(d, l = nil, r = nil) | |
self.data = d | |
self.left = l | |
self.right = r | |
end | |
end |