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 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.

你可能感兴趣的:(ARTS 打卡第三周)