A more useful way to phrase it is that there are
By the fundamental theorem of arithmetic, any integer
A more useful way to phrase it is that there are
By the fundamental theorem of arithmetic, any integer
This is the problem in question.
Let
Making all sticks have length
Consider the following recursive algorithm:
def f(n: int) -> int:
if n <= 1:
return 1
else:
return g(n) + f(n / 2) + f(n / 2)
Given that g(n)
has time complexity f(n)
. Let's see if we can work out the answer without using any powerful machinery one might initially be tempted to use.[^1] Most of the difficulty will actually be in evaluating sums, but this should be doable if you've done MATH1081.
\usepackage{latexsym} | |
\usepackage[empty]{fullpage} | |
\usepackage{titlesec} | |
\usepackage{marvosym} | |
\usepackage[usenames,dvipsnames]{xcolor} | |
\usepackage{verbatim} | |
\usepackage{enumitem} | |
\usepackage{amssymb} | |
\usepackage[colorlinks,urlcolor=black]{hyperref} | |
\usepackage{fancyhdr} |
#include <cassert> | |
#include <vector> | |
// Given some price information at discrete time intervals, returns a suitable | |
// value for the price at a given time interval. You may assume that times is | |
// sorted in ascending order, and that there are at least two datapoints (i.e. | |
// prices for at least two times). | |
auto stock_price(int time, std::vector<int> const ×, | |
std::vector<float> const &prices) -> float { | |
return 0; |
eval
first, and then try satisfiable
.eval.c
and satisfiable.c
to your machine by copy/pasting the code into files with the same name.dcc -o eval eval.c
and dcc -o satisfiable satisfiable.c
respectively.######################## | |
# File system commands # | |
######################## | |
# Show the current working directory | |
pwd | |
# View the contents of the working directory | |
ls |
% I'm assuming you have the package imported already | |
\usepackage{bussproofs} | |
% In these examples, I like indenting the InfC part of each proof tree from the AxiomC(s) that spawned it, | |
% and keeping those AxiomC(s) on the same indent level, but I keep the bottom, final InfC unindented | |
% This is a personal choice but it makes it easier to keep track of what's happening for large trees | |
% A rule with no assumptions (i.e. an axiom) | |
\begin{prooftree} | |
\AxiomC{} |
These exercises are some I did while studying for COMP2521, as well as some others which I've found afterwards which I think will be relevant. I've collected these problems mostly from LeetCode and HackerRank, which are excellent sites for practicing your coding abilities. Accounts on both sites will be necessary to do the problems listed.
The difficulty ranking is obviously my opinion, but generally speaking here is what they mean:
If you're able to solve the easy and intermediate problems without much difficulty, you're probably very well prepared for any programming questions you'll receive in the ex