ARTS 打卡第三周

Algorithm

Project Euler 25. 1000-digit Fibonacci number
Simple - linear

import java.math.BigInteger;

public class Linear {

    public static void main(String[] args) {
        int i = 1;
        BigInteger fi = BigInteger.ONE, fj = BigInteger.ONE;
        while (fi.toString().length() < 1000) {
            BigInteger fk = fi.add(fj);
            fi = fj;
            fj = fk;
            ++i;
        }
        System.out.println(i);
    }
}

Jump - log linear

import java.math.BigInteger;
import java.util.HashMap;

public class LogLinear {

    public static void main(String[] args) {
        HashMap<Integer, BigInteger> m = new HashMap<>();
        m.put(1, BigInteger.ONE);
        m.put(2, BigInteger.ONE);
        m.put(3, BigInteger.valueOf(2));

        int i = 2;
        while (m.get(i).toString().length() < 1000) {
            m.put(2*i - 1, m.get(i - 1).multiply(m.get(i - 1)).add(m.get(i).multiply(m.get(i))));
            m.put(2*i + 1, m.get(i + 1).multiply(m.get(i + 1)).add(m.get(i).multiply(m.get(i))));
            m.put(2*i, m.get(2*i + 1).subtract(m.get(2*i - 1)));
            i = 2*i;
        }
        i = i/2;

        BigInteger fi = m.get(i), fj = m.get(i + 1);
        while (fi.toString().length() < 1000) {
            BigInteger fk = fi.add(fj);
            fi = fj;
            fj = fk;
            ++i;
        }
        System.out.println(i);
    }
}

Review

Understanding Zero-knowledge proofs through illustrated examples

Properties of zero-knowledge proof system

  • soundness
  • completeness
  • zero-knowledge

sometimes a zero-knowledge proof system is only statistical

Tip

Code reuse approaches

  • Inheritance
  • Composition
  • Mixin
  • Trait

Share

Tacit Knowledge

The software industry overvalues comprehension and explanation.
Knowing how to program is very different from explaining your program, or even understanding the program you just finished writing.

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • 秋盡枯干滿地飄 日落西山竊冷笑 尋常枝高傲世足 風(fēng)寒踏過有今朝
    雨潔2018閱讀 102評(píng)論 0 10
  • 東湖子,健康之歌 勤鍛煉,多吃飯 勤勞鍛煉體質(zhì)棒,餐餐吃飽身體棒 多吃蔬菜少吃肉,路邊攤來我拒絕 ...
    沈小丁子閱讀 446評(píng)論 0 0
  • 成長(zhǎng)是一個(gè)漸漸的過程,做為一名媽媽,她最大的欣慰,就是在他的旁邊,見證著孩子漸漸成長(zhǎng)的過程。 做為一名媽媽,一位將...
    智愛189閱讀 539評(píng)論 0 1

友情鏈接更多精彩內(nèi)容