Skip to content

Commit

Permalink
fixed all issues that had \ sticking out of them as well as rendering…
Browse files Browse the repository at this point in the history
… algorithms (#21)
  • Loading branch information
JohnLu2004 authored Jul 30, 2024
1 parent cb9aa33 commit 068198f
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 79 deletions.
17 changes: 9 additions & 8 deletions src/content/questions/comp2804/2014-fall-final/23/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ const body = String.raw`
Consider the following recursive algorithm $\ThreeHeadsOrThreeTails$, which takes as input a positive integer $k$:
<div style="margin: 1rem 0;">
$\mathbf{Algorithm}$ $\ThreeHeadsOrThreeTails(k)\mathrm{:}$ <br>
$\text{flip a fair coin three times};$ <br>
$\mathbf{if}\ \text{the result is \(HHH\) or \(TTT\)}$ <br>
$\mathbf{then}\ \mathrm{return}\ k$ <br>
$\mathbf{else}\ \ThreeHeadsOrThreeTails(k + 1)$ <br>
$\mathbf{endif}$
</div>
<p>
$\mathbf{Algorithm}$ $\ThreeHeadsOrThreeTails(k)$: <br>
$\quad \text{flip a fair coin three times};$ <br>
$\quad \mathbf{if}\ \text{the result is $HHH$ or $TTT$}$ <br>
$\quad \quad \mathbf{then}\ \mathrm{return}\ k$ <br>
$\quad \mathbf{else}$ <br>
$\quad \quad \ThreeHeadsOrThreeTails(k + 1)$ <br>
$\quad \mathbf{endif}$
</p>
You run algorithm $\ThreeHeadsOrThreeTails(1)$, i.e., with $k = 1$. Define the random variable $X$ to be the value of the output
of this algorithm. What is the expected value of $X$?
Expand Down
4 changes: 2 additions & 2 deletions src/content/questions/comp2804/2015-fall-final/25/question.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`
Who discovered Newton's \binomial Theorem?
Who discovered Newton's Binomial Theorem?
`;

const label1 = String.raw`Professor \binomial.`;
const label1 = String.raw`Professor Binomial.`;
const label2 = String.raw`Justin Bieber.`;
const label3 = String.raw`Isaac Newton.`;
const label4 = String.raw`Professor G. Ruesome (the guy teaching COMP 9999).`;
Expand Down
17 changes: 9 additions & 8 deletions src/content/questions/comp2804/2016-fall-midterm/14/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ const body = String.raw`
Consider the following recursive algorithm $\ElisaDrinksCider$, which takes as input an integer
$n \geq 1$, which is a power of 2:
<p>
$\mathbf{Algorithm}\ \ElisaDrinksCider(n)\mathrm{:}$ <br>
$\mathbf{if}\ n = 1$ <br>
$\mathbf{then}\ \text{order Fibonachos}$ <br>
$\mathbf{else}\ \ElisaDrinksCider(n / 2);$ <br>
$\elsesp \text{drink \(n\) bottles of cider};$ <br>
$\elsesp \ElisaDrinksCider(n / 2)$ <br>
$\mathbf{endif}$
$\mathbf{Algorithm} \text{ ElisaDrinksCider}(n):$ <br>
$\quad \mathbf{if}\ n = 1\ \mathbf{then}$ <br>
$\quad \quad \text{order Fibonachos}$ <br>
$\quad \mathbf{else}$ <br>
$\quad \quad \ElisaDrinksCider(n / 2);$ <br>
$\quad \quad \text{drink n bottles of cider};$ <br>
$\quad \quad \ElisaDrinksCider(n / 2)$ <br>
$\quad \mathbf{endif}$
</p>
For $n$ a power of 2, let $C(n)$ be the total number of bottles of cider that you drink when running algorithm
Expand Down
43 changes: 17 additions & 26 deletions src/content/questions/comp2804/2017-fall-final/22/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,23 @@ const body = String.raw`
Alexa and May want to play the game of Monopoly. They use the following recursive algorithm
to decide who goes first:
<div style="margin: 1rem 0;">
$\mathbf{Algorithm}\ \WhoGoesFirst(k)\mathrm{:}$ <br>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">$//$</td>
<td>
$k \geq 1,$ $\text{the die is fair},$ $\text{and all rolls are independent}$
</td>
</tr>
</tbody>
</table>
$\text{Alexa rolls the die, let \(a\) be the result};$ <br>
$\text{May rolls the die, let \(m\) be the result};$ <br>
$\mathbf{if}\ a > m$ <br>
$\mathbf{then}\ \mathrm{print}\ {\tt Alexa\ goes\ first};$ <br>
$\thensp \mathrm{return}\ k$ <Br>
$\mathbf{endif};$ <br>
$\mathbf{if}\ a < m$ <br>
$\mathbf{then}\ \mathrm{print}\ {\tt May\ goes\ first};$ <br>
$\thensp \mathrm{return}\ k$ <br>
$\mathbf{endif};$ <br>
$\mathbf{if}\ a = m$ <br>
$\mathbf{then}\ \WhoGoesFirst(k + 1)$ <br>
$\mathbf{endif}$
</div>
<p>
$\WhoGoesFirst(k):$ <br>
$\quad \mathbf{if}\ k \geq 1\ \mathbf{then}$ <br>
$\quad \quad \text{Alexa rolls the die, let a be the result}$ <br>
$\quad \quad \text{May rolls the die, let m be the result}$ <br>
$\quad \quad \mathbf{if}\ a > m\ \mathbf{then}$ <br>
$\quad \quad \quad \text{print Alexa goes first}$ <br>
$\quad \quad \quad \mathbf{return}\ k$ <br>
$\quad \quad \mathbf{endif}$ <br>
$\quad \quad \mathbf{if}\ a < m\ \mathbf{then}$ <br>
$\quad \quad \quad \text{print May goes first}$ <br>
$\quad \quad \quad \mathbf{return}\ k$ <br>
$\quad \quad \mathbf{endif}$ <br>
$\quad \quad \mathbf{if}\ a = m\ \mathbf{then}$ <br>
$\quad \quad \quad \WhoGoesFirst(k + 1)$ <br>
$\quad \quad \mathbf{endif}$ <br>
</p>
The ladies run algorithm $\WhoGoesFirst(1)$, i.e., with $k = 1$. Define the random variable $X$ to
be the value of the output of this algorithm. <br>
Expand Down
45 changes: 18 additions & 27 deletions src/content/questions/comp2804/2018-winter-final/22/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,24 @@ const body = String.raw`
Alexa and Shelly want to play the game of Monopoly. They use the following recursive algorithm
to decide who goes first:
<div style="margin: 1rem 0;">
$\mathbf{Algorithm}\ \WhoGoesFirst(k)\mathrm{:}$ <br>
<table>
<tbody>
<tr>
<td style="vertical-align: top;">$//$</td>
<td>
$k \geq 1,$ $\text{the die is fair},$ $\text{and all rolls are independent}$
</td>
</tr>
</tbody>
</table>
$\text{Alexa rolls the die, let \(a\) be the result};$ <br>
$\text{Shelly rolls the die, let \(s\) be the result};$ <br>
$\mathbf{if}\ a > s$ <br>
$\mathbf{then}\ \mathrm{print}\ {\tt Alexa\ goes\ first};$ <br>
$\thensp \mathrm{return}\ k$ <Br>
$\mathbf{endif};$ <br>
$\mathbf{if}\ a < s$ <br>
$\mathbf{then}\ \mathrm{print}\ {\tt Shelly\ goes\ first};$ <br>
$\thensp \mathrm{return}\ k$ <br>
$\mathbf{endif};$ <br>
$\mathbf{if}\ a = s$ <br>
$\mathbf{then}\ \WhoGoesFirst(k + 1)$ <br>
$\mathbf{endif}$
</div>
<p>
$\WhoGoesFirst(k):$ <br>
$\quad \mathbf{if}\ k \geq 1\ \mathbf{then}$ <br>
$\quad \quad \text{Alexa rolls the die, let a be the result}$ <br>
$\quad \quad \text{Shelly rolls the die, let s be the result}$ <br>
$\quad \quad \mathbf{if}\ a > s\ \mathbf{then}$ <br>
$\quad \quad \quad \text{print Alexa goes first}$ <br>
$\quad \quad \quad \mathbf{return}\ k$ <br>
$\quad \quad \mathbf{endif}$ <br>
$\quad \quad \mathbf{if}\ a < s\ \mathbf{then}$ <br>
$\quad \quad \quad \text{print Shelly goes first}$ <br>
$\quad \quad \quad \mathbf{return}\ k$ <br>
$\quad \quad \mathbf{endif}$ <br>
$\quad \quad \mathbf{if}\ a = s\ \mathbf{then}$ <br>
$\quad \quad \quad \WhoGoesFirst(k + 1)$ <br>
$\quad \quad \mathbf{endif}$ <br>
</p>
The ladies run algorithm $\WhoGoesFirst(1)$, i.e., with $k = 1$. Define the random variable $X$ to
be the value of the output of this algorithm. <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const body = String.raw`
Consider the following statement: For any three random variables $X$, $Y$, and $Z$,
<ul>
<li> \mathbb{E}(\min(X,Y,Z)) = $\min(\mathbb{E}(X), \mathbb{E}(Y),$ $\mathbb{E}(Z)).$</li>
<li> $\mathbb{E}(\min(X,Y,Z)) = \min(\mathbb{E}(X), \mathbb{E}(Y), \mathbb{E}(Z))$</li>
</ul>
Which of the following is correct?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`The function $T:\N\to\N$ is defined recursively as follows:
const body = String.raw`The function $ T: \mathbb{N} \rightarrow \mathbb{N} $ is defined recursively as follows:
\[
T(n) =
\begin{cases}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`Let $D_1,D_2,D_3$ be the result of rolling a normal $6$-sided die three times. Define the events
$ A = \max\{D_1,D_2,D_3\}=4$ $
and
$ B = $D_1+D_2+D_3$ is \text{an even number} $
<ul>
<li>$A = \max\{D_1,D_2,D_3\}=4$
<li>$B = D_1+D_2+D_3$ is an even number
</ul>
Which of the following is true?`;

const label1 = String.raw`$A$ and $B$ are independent`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`A group of $n\ge 3$ friends stand around in a circle and each friend tosses a coin. If the result of a friend's coin toss is the different from the result of the coin tossed by their left neighbour and different from result of the coin tossed by their right neighbour, then the friend shouts \enquote{Huzzah!} Let $X$ be the number of friends who shout \enquote{Huzzah!}. What is $ E(X)$? `;
const body = String.raw`A group of $n\ge 3$ friends stand around in a circle and each friend tosses a coin. If the result of a friend's coin toss is the different from the result of the coin tossed by their left neighbour and different from result of the coin tossed by their right neighbour, then the friend shouts Huzzah! Let $X$ be the number of friends who shout Huzzah!. What is $ E(X)$? `;

const label1 = String.raw`$n/8$`;
const label2 = String.raw`$n/4$`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { MultipleChoiceQuestion } from "@common/MultipleChoiceQuestionGenerator";

const body = String.raw`Is the following statement true or false?
For any random variable $X$, $\E(X^2) = \E(X)\cdot \E(X)$.`;
For any random variable $X$, $\mathbb{E}(X^2) = \mathbb{E}(X)\cdot \mathbb{E}(X)$.`;

const label1 = String.raw`The statement is true`;
const label2 = String.raw`The statement is false`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const body = String.raw`A string that is obtained by rearranging the letters of
\[
\mathrm{ARABICA}
\]
is \emph{stupendous} if it contains the substring $\mathrm{CAB}$. For example $\mathrm{ARA\underline{CAB}I}$ and $\mathrm{I\underline{CAB}AAR}$ are both stupendous, but $\mathrm{ARABICA}$ is not. How many stupendous strings are there?`;
is stupendous if it contains the substring $\mathrm{CAB}$. For example $\mathrm{ARA\underline{CAB}I}$ and $\mathrm{I\underline{CAB}AAR}$ are both stupendous, but $\mathrm{ARABICA}$ is not. How many stupendous strings are there?`;

const label1 = String.raw`$70$`;
const label2 = String.raw`$60$`;
Expand Down

0 comments on commit 068198f

Please sign in to comment.