Skip to content

Instantly share code, notes, and snippets.

View sgrayrw's full-sized avatar

Yuxiao Wang sgrayrw

View GitHub Profile

CS107 -- Exam 1 Practice

Here are some practice problems for the upcoming exam. These are somewhat representative, but won't be precisely what's on the exam: they exercise the same kinds of ideas.

I'll just do a quick dump of problems. I won't be giving a key right now, because my experience is that studnets don't work the questions but just look at the key if they have one. I am happy to check your answers if you write them up. I'll also comment on problems a bit tomorrow.

  1. In git, briefly explain what a merge conflict is and how you might fix it. You do not need to
# Prove that the cost of this function is O(n)
# Prove that this function computes a result x' such that:
# x' = x * (x+1) / 2
def e(x):
if (x == 0): return 0
return: x + e(x - 1)
# Prove that the return value of this function is a list l' such that:
# forall i < len(l). l'[i] = 2 * l[i]
def isEmpty(lst): return len(lst) == 0
def hd(lst): return lst[0]
def tl(lst): return lst[1:]
# Return the reverse of lst
def reverse(lst): return []
# Find the minimum element of the list
ascendbruce /
Last active June 12, 2024 18:39
Use macOS-style shortcuts in Windows

Use macOS-style shortcuts in Windows / keyboard mappings using a Mac keyboard on Windows

ℹ️ There is a newer alternative project that does similar things and more, check it out at

Make Windows PC's shortcut act like macOS (Mac OS X) (using AutoHotkey (ahk) script)

With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.

How does it work