Skip to content
UoL CS Notes

Home

This website houses notes from my studies at the University of Liverpool. If you see any errors or issues, please do open an issue on this site's GitHub.

Trees - 2 - Binary Trees

COMP108 Lectures

A binary tree is a tree where the degree is at most two. The two sub-trees are called left sub-tree and the right sub-tree (may be empty). Traversing There are three common ways to traverse a binary tree: Pre-order traversal (VLR) Vertex, left sub-tree, right sub-tree. In-order traversal (LVR) Left...

Read More

Trees - 1

COMP108 Lectures

Trees are linked lists with branches. Definition A tree $T=(V,E)$ consists of a set of vertices $V$ and a set of edges $E$ such that for any pair of vertices $u,v\in V$ there is exactly one path between $u$ and $v$: graph TD u((u)) --> y((y)) u --> v((v)) u...

Read More

File Management

COMP124 Lectures

Disk Hardware Disks are based around the concept of blocks: Disks are split into block of a certain size. Files fill up one or more blocks. Only one file can fill each block, so some wasted space if a file is smaller than the block. Operating system determines the block...

Read More

Abstract Classes

COMP122 Labs

UML diagrams including abstract classes and interfaces can be drawn in the following way: classDiagram Degreeable <|.. Dog Emailable <|.. ResearchCouncil Billable <|.. ResearchCouncil Degreeable <|.. Student Billable <|.. Student Emailable <|.. Person Person <|-- Lecturer Payable <|.. Lecturer Person <|-- Student Lecturer <|-- Professor class Person{ <<Abstract>> -name String...

Read More

Interfaces

COMP122 Lectures

Interfaces allow you to abstract the workings of your code and provide simple interfaces to the user: Lamp Example public interface Switchable { public void switchOn(); public void switchOff(); } This defines the interface type that someone can call. Switchable l = new Lamp(); l.switchOn(); l.switchOff(); This is the use...

Read More

Abstract Classes

COMP122 Lectures

We can stop instantiations of certain superclasses by making them abstract: classDiagram class Shape <<abstract>> Shape Shape : +colour String Shape <|-- Circle class Circle{ +radius double +area() double } The name of this class should be in italics. If it is abstract. I have used an annotation here which...

Read More

Calculus in the Complex Plane

COMP116 Tutorials

Expressing Complex Functions in Terms of $u$ and $v$. Calculate for $z=x+iy$ $f(z)=z^3$ $(x+iy)(x+iy)(x+iy)$ $(x^2+2ixy-y^2)(x+iy)$ $x^3+x^2iy+2ix^2y-2xy^2-xy^2-iy^3$ $u(x,y)=x^3-3xy^2$ $v(x,y)=3x^2y-y^3$ $f(z)=\vert z\vert+ z^2$ $(x^2+y^2)+(x+iy)^2$ $(x^2+y^2)+x^2+2ixy-y^2$ $2x^2+2ixy$ $u(x,y)=2x^2$ $v(x,y)=2xy$ Cauchy-Riemann Conditions $f(z)=z^3$ $u(x,y)=x^3-3xy^2$ $v(x,y)=3x^2y-y^3$ $\frac{\partial u}{\partial x}=3x^2-3y^2$ $\frac{\partial v}{\partial y}=3x^2-3y^2$ This part is valid. $\frac{\partial u}{\partial y}=-6xy$ $\frac{\partial v}{\partial x}=6xy$ This part is...

Read More

Statistics & Data Analysis

COMP116 Lectures

Experimental proof makes justifications more clear and accessible. Methodology Suppose we have some algorithm which we suspect runs efficiently most of the time. We can test this using the following experimental method: Run the algorithm a number of times on different data. Determine the average time taken. This raises the...

Read More

Round Robin

COMP124 Lectures

Preemptive algorithm that gives a set CPU time to all active processes. Similar to FCFS, but allows for preemption by switching between processes. Ready queue is treated as circular. The CPU allocates each process a time-slice. Time Quantum - A small unit of time, varying anywhere between 10 and 100...

Read More