This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 bag | |
| import ( | |
| "bytes" | |
| "errors" | |
| "fmt" | |
| ) | |
| type bag struct { | |
| m map[interface{}]int |
This file contains hidden or 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 queue | |
| import ( | |
| "bytes" | |
| "errors" | |
| "fmt" | |
| "sync" | |
| ) | |
| type node struct { |
This file contains hidden or 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 stack | |
| import ( | |
| "bytes" | |
| "errors" | |
| "fmt" | |
| "sync" | |
| ) | |
| type node struct { |