$$ \begin{array}{ccc} \text { Alice } & & \text { Bob } \ a & \stackrel{[a] G}{\longrightarrow} & {[a] G} \ {[b] G} & \stackrel{[b] G}{\longleftrightarrow} & b \end{array} $$ Alice can now compute $$ K_{A}=[a]([b] G)=[a b] G $$ and Bob can now compute $$ K_{B}=[b]([a] G)=[a b] G . $$
COMP3077 COURSE NOTES :
INPUT: Message $m$ and public key $Y$. OUTPUT: The ciphertext $(U, c, r)$.
Choose $k \in_{R}{1, \ldots, q-1}$.
$U \leftarrow[k] G$.
$T \leftarrow[k] Y$.
$\left(k_{1} | k_{2}\right) \leftarrow K D(T, l)$.
Encrypt the message, $c \leftarrow E_{k_{1}}(m)$.
Compute the MAC on the ciphertext, $r \leftarrow M A C_{k_{2}}(c)$.
(local variables) array of int $S E Q N O[1 . . n] \longleftarrow \overline{0}$ set of int Neighbors $\longleftarrow$ set of neighbors (message types) UPDATE (1) To send a message $M$ : (1a) if $i=$ root then (1b) $S E Q N O[i] \longleftarrow S E Q N O[i]+1$; (1c) send $\operatorname{UPDATE}(M, i, S E Q N O[i])$ to each $j \in N$ eighbors. (2) When UPDATE $\left(M, j\right.$, seqno ${ }{j}$ ) arrives from $k$ : (2a) if $S E Q N O[j]<\operatorname{seqno}{j}$ then (2b) Process the message $M$; (2c) $S E Q N O[j] \longleftarrow$ seqno $_{j}$; (2d) send UPDATE $\left(M, j\right.$, seqno $\left._{j}\right)$ to $N$ eighbors $/{k}$ (2e) else discard the message.
COMP3001 COURSE NOTES :
if leader $=i$ then broadcast SEARCH_MWOE $($ leader $)$ along marked edges of tree (Sect. 5.5.5).
On receiving a SEARCH_MWOE(leader) message that was broadcast on marked edges: (a) Each process $i$ (including leader) sends an EXAMINE message along unmarked (i.e., non-tree) edges to determine if the other end of the edge is in the same component (i.e., whether its leader is the same). (b) From among all incident edges at $i$, for which the other end belongs to a different component, process $i$ picks its incident MWOE(localID,remoteID).
The leaf nodes in the MST within the component initiate the convergecast (Sect. 5.5.5) using REPLY_MWOEs, informing their parent of their MWOE(localID,remoteID). All the nodes participate in this convergecast.
(local variables) array of int $S E Q N O[1 . . n] \longleftarrow \overline{0}$ set of int Neighbors $\longleftarrow$ set of neighbors (message types) UPDATE (1) To send a message $M$ : (1a) if $i=$ root then (1b) $S E Q N O[i] \longleftarrow S E Q N O[i]+1$; (1c) send $\operatorname{UPDATE}(M, i, S E Q N O[i])$ to each $j \in N$ eighbors. (2) When UPDATE $\left(M, j\right.$, seqno ${ }{j}$ ) arrives from $k$ : (2a) if $S E Q N O[j]<\operatorname{seqno}{j}$ then (2b) Process the message $M$; (2c) $S E Q N O[j] \longleftarrow$ seqno $_{j}$; (2d) send UPDATE $\left(M, j\right.$, seqno $\left._{j}\right)$ to $N$ eighbors $/{k}$ (2e) else discard the message.
COMP2014 COURSE NOTES :
if leader $=i$ then broadcast SEARCH_MWOE $($ leader $)$ along marked edges of tree (Sect. 5.5.5).
On receiving a SEARCH_MWOE(leader) message that was broadcast on marked edges: (a) Each process $i$ (including leader) sends an EXAMINE message along unmarked (i.e., non-tree) edges to determine if the other end of the edge is in the same component (i.e., whether its leader is the same). (b) From among all incident edges at $i$, for which the other end belongs to a different component, process $i$ picks its incident MWOE(localID,remoteID).
The leaf nodes in the MST within the component initiate the convergecast (Sect. 5.5.5) using REPLY_MWOEs, informing their parent of their MWOE(localID,remoteID). All the nodes participate in this convergecast.
Let the value of $A$ be $x$. $$ \left.n=2, \frac{1}{3}+\frac{1}{4}-x>0 \quad \text { (Assume } \quad x<\frac{7}{12}\right) $$ Inductive Hypothesis: $$ \text { For } n=k, \frac{1}{k+1}+\frac{1}{k+2}+\cdots+\frac{1}{2 k}-x>0 $$ Inductive Step: $$ \begin{gathered} \text { For } n=k+1, \frac{1}{k+2}+\frac{1}{k+3}+\cdots+\frac{1}{2(k+1)}-x \ =\left[\frac{1}{k+1}+\frac{1}{k+2}+\cdots+\frac{1}{2 k}\right]+\frac{1}{2 k+1}+\frac{1}{2 k+2}-\frac{1}{k+1}-x \ \text { (Adding and substracting } \left.\frac{1}{k+1}\right) \end{gathered} $$ $$ =0 $$
COMP2009 COURSE NOTES :
Let $P(n)=1^{2}+2^{2}+\cdots n^{2}=\frac{n(n+1)(2 n+1)}{6}$ Basis: For $n=1, P(1)=1^{2}=1$ (on calculating LHS) $$ R H S=P(1)=\frac{1(1+1)(2+1)}{6}=\frac{(1)(2)(3)}{6}=1 $$ Therefore $P(1)$ is true. Inductive Hypothesis: $$ P(K)=1^{2}+2^{2}+\cdots k^{2}=\frac{k(k+1)(2 k+1)}{6} \text { is true. } $$ Inductive Step: We claim that $$ P(K+1)=1^{2}+2^{2}+\cdots+(k+1)^{2}=\frac{(k+1)(k+2)(2 k+3)}{6} \text { is true. } $$
SmartPtr<something $>$ spl, sp2;
Something* $\mathrm{p}$;
if (spl) // Test 1: direct test for non-nul1 pointer
if (spl) // Test $1:$ direct test for non-null pointer if $($ !sp1) // Test $2:$ direct test for null pointer
if $(! \operatorname{sp} 1) \quad / /$ Test $2:$ direct test for null pointer $\cdots \cdot$ if $(\operatorname{sp} 1=0) \quad / /$ Test 3 : explicit test for null pointer
$\cdots$
if $(\mathrm{sp} 1==\mathrm{sp} 2) / /$ Test 4 : comparison of two smart pointers
$\cdots$
if $(\operatorname{sp} 1==p) \quad / /$ Test 5 : comparison with a raw pointer
$\cdots$
COMP2009 COURSE NOTES :
$\mathrm{~ t e m p l a t e ~ 〈 c l a s s ~ T}$
class SmartPtr
f
public:
bool operator! () const // Enables "if (!sp) ..."
f
return pointee_ $==0$;
\}
inline friend bool operator==(const SmartPtr\& lhs,
const $T^{*}$ rhs)
$f$
return lhs.pointee_ $==$ rhs;
?
inline friend bool operator==(const $T^{*}$ lhs,
const SmartPtr\& rhs)
1
return lhs $==$ rhs pointee_;
\}
inline friend bool operator!=(const SmartPtr\& lhs,
const $T^{*} r h s$ )
$f$
return lhs.pointee_ I= rhs;
\}
inline friend bool operator!=(const $T^{*}$ lhs,
const SmartPtr\& rhs)
$\uparrow$
Let $U$ be any set fixed as a local universe. For each subset $A \subseteq U$ we can define a function $f_{A}: U \rightarrow{1,0}$ by putting $f_{A}(u)=1$ when $u \in A$ and $f_{A}(u)=0$ when $u \notin A$. This is known as the characteristic function of $A$ (modulo the universe $U$ ). Thus the characteristic function $f_{A}$ specifies the truth-value of the statement that $u \in A$.
Conversely, when $f: U \rightarrow{1.0}$, we can define the associated subset of $U$ by putting $A_{f}={u \in U: f(a)=1}$.
Clearly, there is a bijection between the subsets of $U$ and the functions $f: U \rightarrow$ ${1.0}$, and in fact we can make either do the work of the other. In some contexts, it is notationally more convenient to work with characteristic functions rather than subsets.
COMP1043 COURSE NOTES :
Other ways of writing recursive definitions are also current among computer scientists. In particular, one can think of the basis and induction step as being limiting and principle cases respectively, writing in our example: If $n=1$ then $f(n)=1$ If $n>1$ then $f(n)=f(n-1)+n$. This can also be expressed in the popular if-then-else form: If $n=1$ then $f(n)=1$ Else $f(n)=f(n-1)+n$ And some computer scientists like to abbreviate this further to the ungrammatical declaration: $$ f(n)=\text { if } n=1 \text { then } 1 \text { else } f(n-1)+n $$ which can look like mumbo-jumbo to the uninitiated.
procedure PassResult(terminate: integer;
inp1, inp2, out2: channel; var done boolean);
var $y$ :ResultTypes;
count:integer;
passing : boolean;
begin
done: =false;
passing : =true;
count: =0 ;
while not done and (count<terminate) do
pol1
inpl?result(y) $\rightarrow$
if passing then begin
out2 ! result (y) ;
passing: = false
end $\mid$
inp2?result $(y) \rightarrow$
if passing then begin
out2 ! result ( $y)$;
passing: false
and $\mid$
inpl?complete $\rightarrow$
count: $=$ coun $t+1$;
if count=terminate then out 2 ! complete |
inp2?complete $\rightarrow$
count: =count $+1$;
If count werminate then out 2 ! complete |
inpl ?eos $\rightarrow$ done: = true
end ;
COMP1009 COURSE NOTES :
If $r$ and $s$ are odd primes, then prime $p$ satisfies $$ p \equiv 1(\bmod r) \equiv s-1(\bmod s) $$ if $p$ is of the form $$ p=u(r, s)+k r s $$ where $$ u(r, s)=\left(s^{r-1}-r^{x-1}\right) \bmod r s $$ and $k$ is an integer.
$\langle$ HTML $\rangle$
$\langle\mathrm{HEAD}\rangle$
$\langle$ TTLE>Oracle Webserver formSelectopen</TITLE>
$\langle\mathrm{H} l$ Oracle Webserver htp. formselectOpen Examples $\langle/ \mathrm{H} 1\rangle$
$</ \mathrm{HEAD}>$
$\langle\mathrm{BODY}\rangle$
$\langle$ LORM ACTION="/Ows-bin/owa/test" METHOD="POST" $\rangle$
Choose the Server Site:<SELECT NAME="input_var_name:">
$\langle\mathrm{BR}\rangle$
$\langle\mathrm{BR}\rangle$
$\angle O P T I O N>B u f f a 10$
$\langle\mathrm{BR}\rangle$
$\langle O P T I O N>$ Rochester
$\langle\mathrm{BR}\rangle$
$\angle$ UPTION $>$ Syracuse
$\langle\mathrm{BR}\rangle$
$\langle/$ SELECT $\rangle$
$</ \mathrm{FORM}\rangle$
$</ \mathrm{BODY}\rangle$
$</$ HTML $\rangle$
The probability of an event for the ith individual can be written as a joint probability of $y_{i t}$. $$ \operatorname{Pr}\left(y_{i 1}, \ldots, y_{i T}\right)=\int_{a_{i 1}}^{b_{i 1}} \ldots \int_{a_{i T}}^{b_{i T}} \phi\left(\varepsilon_{i 1}, \ldots, \varepsilon_{i T}\right) d \varepsilon_{i T} \ldots d \varepsilon_{i 1} $$ where $a_{i t}=-\mathbf{x}{i t}^{\prime} \boldsymbol{\beta}, b{i t}=+\infty$ if $y_{i t}=1$, and $a_{i t}=-\infty, b_{i t}=-\mathbf{x}{i t}^{\prime} \beta$ if $y{i t}=0$, and $\phi(\cdot)$ is the standard $T$-variate normal density function. Conditioning on the permanent component, $v_{i}$, this expression can be written as $$ \int_{a_{i 1}}^{b_{i 1}} \ldots \int_{a_{i T}}^{b_{i T}} \int_{-\infty}^{+\infty} \phi\left(u_{i 1}, \ldots, u_{i T} \mid v_{i}\right) \phi\left(v_{i}\right) d v_{i} d u_{i 1} \ldots d u_{i T} $$ Because the transitory components are independent conditional on $v_{i}$, this expression can be simplified. In terms of model quantities, can be written as $$ \operatorname{Pr}\left(y_{i 1}, \ldots, y_{i T}\right)=\int_{-\infty}^{+\infty} \prod_{t=1}^{T} \Phi\left(\mathbf{x}{i t}^{\prime} \beta \mid v{i}\right)^{y_{i t}} \Phi\left(-\mathbf{x}{i t}^{\prime} \beta \mid v{i}\right)^{1-y_{i t}} \phi\left(v_{i}\right) d v_{i}, $$
PSGY1004 COURSE NOTES :
Since we estimate $J-1$ coefficients for any explanatory variable we still have not utilized the ordinal information in the dependent variable. If we further assume that the dependent variable can be scaled into an interval variable, $y_{j}$, model $6.8$ can be further simplified to $$ \log \left(\frac{p_{j}}{p_{j-1}}\right)=\alpha_{j}+\beta\left(y_{j}-y_{j-1}\right) x_{i}, \quad i=1, \ldots, I, \quad j=2, \ldots, J $$ As a special case, if integer scoring is applied to both $y$ and $x$, is reduced to $$ \log \left(\frac{p_{j}}{p_{j-1}}\right)=\alpha_{j}+\beta i, \quad i=1, \ldots, I ; \quad j=2, \ldots, J $$