#include <iostream>  is the preprocessor, it includes the iostream library, the library contains codes that enable us to use functions such as cout. using namespace std  is included so that we do not have to type std::cout , instead of cout. The std::  can be omitted because of this. main  is the name of the first function that will run when we […]

Before we understand Dijkstra algorithm, let’s introduce the concept of graph. A graph consists of vertices and edges connecting them. A graph has many applications because it mimics the connection between nodes/ vertices in network, social media, map with buildings as nodes and roads as edges connecting them, etc. Dijkstra algorithm is an algorithm to […]

The notes below are condensed from ideas from Kenneth Rosen’s Discrete Mathematics and its applications (Chapter 9: Relations, Chapter 2.3: Functions), UTMSPACE Discrete structures subject notes, and my own notes. Relations Relation, R is a subset of Cartesian product A x B. Elements of R is called ordered pairs. e.g. R = {(squirrel, mammal), (human, mammal), […]