Before starting to explain the different time complexities, let’s first look at what an actual algorithm is. The formal definition of an algorithm is “a process or set of rules to be followed in calculations or other problem-solving operations, especially by a computer.”. So in other words, an algorithm is a defined path which is…

Continue reading# data structures

# Breadth-First-Search Example Java

Searching or traversing is really important when it comes to accessing data from a given data structure. There are different methods of traversing/searching elements within these data structures such as Graphs and Trees. Breadth-first search is one example of these methods. BFS is an algorithm that traverses tree or graph and it starts from the…

Continue reading# Graphs Java Example

Graphs are usually made from vertices and arcs. Sometimes they are also called nodes (instead of vertices) and edges (instead of arcs). For the sake of this tutorial I will be using nodes and edges as reference. Graphs usually look something like this: In many cases, the nodes and the edges are assigned values to…

Continue reading