Code Review: Week1 作業

分析標的: Week1 作業

optimized version A
change entry Data Structure
from 136byte -> 32byte

修改後 commit

Reduce the size of entry structure

to reduce cache miss

更好的 commit

Shrink phonebook structure to reduce cache miss

隨堂測驗

int p(int i, int N)
{
    return (i < N && printf("%d\n", i) && !p(i + 1, N)) \
           || printf("%d\n", i);
}
  • && 前後的敘述對調,是否影響輸出?
    • i < N && printf("%d\n", i) 變更為 printf("%d\n", i) && (i < N) 的話,程式輸出為何?
  • 做出單調遞減輸出,像是 5 -> 4 -> 3 -> 2 -> 1
Select a repo