Implement bread-first-search, bfs, on trees of type a
data Tree a = Empty | Node a (Tree a) (Tree a)
deriving Show
bfs :: Tree a -> [a]
bfs x = traverse [x]
traverse :: [Tree a] -> [a]
traverse [] = []
Motivation: compute the minimal number of changes needed to transform one string into another. Goal: find “cheapest” sequence of editing steps using operations
Implement the well-known power
function in two different new ways. The power function takes two arguments n and k and computes nk. Your implementation only has to work for non-negative integer k. The following is a straightforward implementation of this function:
power :: Int -> Int -> Int
power n k | k < 0 = error "power: negative argument"
power n 0 = 1
power n k = n * power n (k-1)
You will implement two more ways in this part.
##Checkstyle
It is a Intellij plugin, helps you to check your code, import, javadoc etc.
[Checkstyle Intellij plugin] (https://github.com/jshiell/checkstyle-idea)
Swagger is the world's most popular framework for APIs.
[Swagger] (http://swagger.io/)
Install plugin on Intellij.
Under Intellij Preferences
->Plugin
->Browse repositories...
Search keyword : Swagger
Install it and restart Intellij.
pragma solidity ^0.4.0; | |
contract BuyNccuCoin { | |
function buy () returns (bool) { | |
// buy coin | |
// 客戶賣回給銀行 | |
// receiver 這邊要放銀行 | |
NccuBank nccuBank = new NccuBank(); | |
if (nccuBank.check() < msg.value) { |