Starting up:
[bw1425n01]s0925570: ./hshell.rb
Clearing previous output:
s0925570@hadoop $ rmr ~/data/output
Deleted hdfs://bw1425n01.inf.ed.ac.uk/user/s0925570/data/output
| import heapq | |
| import random | |
| class HeapSorter: | |
| def __init__(self, num_blocks, input_sequence): | |
| self.num_blocks = num_blocks | |
| self.input_sequence = input_sequence | |
| def sorted(self): | |
| return heapq.merge(*self.__sorted_subsequences__()) |
| \documentclass[10pt, a4paper]{article} % use "amsart" instead of "article" for AMSLaTeX format | |
| \usepackage{microtype} | |
| \usepackage[textwidth=17cm,textheight=24cm]{geometry} | |
| \usepackage{fullpage} % See geometry.pdf to learn the layout options. There are lots. | |
| \usepackage{helvet} | |
| \usepackage{listings} | |
| \usepackage[usenames,dvipsnames,svgnames,table]{xcolor} | |
| \usepackage[normalem]{ulem} | |
| \usepackage{epstopdf} | |
| \usepackage{rotating} |
| # Exercise: | |
| # Given the Pre-order and In-order traversals of a tree, | |
| # reconstruct the original tree structure. | |
| # | |
| # Pre-order node output: Node (Left) (Right) | |
| # In-order node output: (Left) Node (Right) | |
| # | |
| # Example: | |
| # 'a' | |
| # | | |
| # Read the CSV file into R | |
| citations <- read.csv("citations2013.csv") | |
| # At this point, people were told to attach(). Apparently that's icky. | |
| print("Dataset contains the following columns:") | |
| print(names(citations)) | |
| print("Length of citations$Citations2013:") | |
| print(length(citations$Citations2013)) |
| import Control.Arrow | |
| import Data.Function | |
| import Data.List | |
| import Data.Ord | |
| -- mapReduce key_func val_func reduce_func -- | |
| mapReduce :: Ord c => (b1 -> c) -> (b1 -> b) -> ([b] -> c1) -> [b1] -> [(c, c1)] | |
| mapReduce k r v = reduce' r . group' . map' k v | |
| where | |
| reduce' f = map (fst . head &&& f . map snd) |
| def foo | |
| puts "This is a test" | |
| end |
| def spiral_flatten(matrix_chunks) | |
| [].tap do |result| | |
| until matrix_chunks.empty? | |
| result.concat matrix_chunks.shift | |
| matrix_chunks[0..-2].to_a.each { |chunk| result << chunk.pop } | |
| break if matrix_chunks.empty? | |
| result.concat matrix_chunks.pop.reverse | |
| matrix_chunks[1..-1].to_a.reverse_each { |chunk| result << chunk.shift } | |
| end | |
| end |
| λ server git:(client/server-model) ✗ ruby pearserver.rb | |
| # Connection from 1 | |
| <Ryan White(1)> yo | |
| # Connection from 2 | |
| # Connection from 3 | |
| <James Maverick(2)> hey | |
| <Daniel Harris(3)> what's up? | |
| # Connection from 4 | |
| <Daniel Lannister(4)> hey | |
| # Connection from 5 |
Starting up:
[bw1425n01]s0925570: ./hshell.rb
Clearing previous output:
s0925570@hadoop $ rmr ~/data/output
Deleted hdfs://bw1425n01.inf.ed.ac.uk/user/s0925570/data/output
#Exploring Redstone Circuits
###Resources Basic Gate Tutorials
###Ideas
####Basic Inputs