CS106B Assignment3
Foreword
记录2022 winter的CS106B Assignment3
The Sierpinski Triangle
递归画出分形
1 | void drawSierpinskiTriangle(GWindow& window, |
Human Pyramids
需要记忆化的递归
1 | Map<pair<int, int>, int> memo; |
What Are YOU Doing?
枚举子集的递归
1 | Set<string> allEmphasesOf(const string& sentence) { |
Shift Scheduling
递归找最佳排班方案,需要边递归边对时间限制和重叠限制进行剪枝不然大Case会卡死
写的有点丑,不是很懂为什么参数里$shifts$要用$Set$存
1 | Set<Shift> highestValueScheduleFor(const Set<Shift>& shifts, int maxHours) { |