Graphs are one of the most common data structures in computer science. Especially with today's machine learning and artificial intelligence trends, understanding them is crucial. A shocking amount of real-life things can be modeled with graphs. Humans think in associations, so it's obvious why connecting things in this way is practical.
But graphs can be a little tricky to understand! This is because they need a paradigm shift to fully grok. You see, graphs are a non-linear data structure, meaning there is no sequential order intrinsic to them.
Let's explore what this means.
xxxxxxxxxx
16
class Main {
public static void main(String[] args) {
// replace with your Java logic here
for(int i = 1; i <= 100; i++) {
if(i % 3 == 0 && i % 5 == 0) {
System.out.println("FizzBuzz");
} else if(i % 3 == 0) {
System.out.println("Fizz");
} else if(i % 5 == 0) {
System.out.println("Buzz");
} else {
System.out.println(i);
}
}
}
}
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment