Learn the ABCs of Algorithm Alongside Free Resources to Guide you through till the End.

Learn the ABCs of Algorithm Alongside Free Resources to Guide you through till the End.

At the End of this Article, You would actually be Happy you Clicked it due to the massive amount of Knowledge you would be gaining - Previous Readers

The first time I came across an algorithm was in 2018/2019 while learning python as a tech enthusiast who wanted to know how Ai and robotics work, I could remember coming across the word on StackOverflow, which got me overwhelmed.

You currently reading this, have come across it, or did some normal world activities even tho you don't know what an algorithm is, because for you to do something like cooking, solving an assignment, talking to your crush, etc you've actually taken steps and that is Algorithm.

I use the word in every programming discussion I get into, which makes me sound like an Expert, which I am (just kidding o☺️).

what is an Algorithm?

Algorithm (which is a greek word) is a step-by-step sequence(a particular order in which related things follow each other.) for solving a problem.

The word "algorithm" was coined by the Persian mathematician Muhammad ibn Musa al-Khwarizmi in the 9th century, while he was working in Baghdad at the House of Wisdom. Special thanks to ChatGpt for this😘.

How does Algorithm Work in Real Life?

Let's understand an Algorithm by Cooking a virtual Noodles with the steps:

  1. Fill the pot you want to use to cook the noodles with water.

  2. Add the Seasons, Sauce, or Anything wey you wan add sha.

  3. Add the noodles to the pot and stir gently but in Nigeria, we stir aggressively because we want it done in milliseconds.

  4. Cook the noodles till the water dries off, But in Europe, you will drain it according to google because I never reach there before as at the time of writing this Article.

  5. Serve the noodles with your desired Drinks.

All these steps listed above are just to demonstrate Algorithms, Me and you know say if you wan cook am all these steps are natural to follow. Now You've understood the concept of an Algorithm if No continue to the Next Step.

How does Algorithm Work in the Programming World?

Let's understand an Algorithm by solving a Quadratic Equation using Python and Dart.

# Written By Techadot, Feel Free to use it.

#why Importing math: To Reduce lines of code, for example the sqrt is basically know as the Square Root Function. To Define yours without the Math library will make you go through Hell 
import math


def solve_quadratic(a, b, c):
    # Calculate the discriminant
    discriminant = b**2 - 4*a*c

    # Check if the discriminant is negative
    if discriminant < 0:
        return "No real roots"

    # Calculate the two roots
    root1 = (-b + math.sqrt(discriminant)) / (2*a)
    root2 = (-b - math.sqrt(discriminant)) / (2*a)

    # Return the roots
    return root1, root2

Now Using Dart.

import 'dart:math';

void main() {
  double a = 2.0;
  double b = 5.0;
  double c = 3.0;

  double discriminant = pow(b, 2) - 4 * a * c;
  double sqrtDiscriminant = sqrt(discriminant);

  if (discriminant < 0) {
    print("The quadratic equation has no real roots.");
  } else if (discriminant == 0) {
    double root = -b / (2 * a);
    print("The quadratic equation has one root: ${root}");
  } else {
    double root1 = (-b + sqrtDiscriminant) / (2 * a);
    double root2 = (-b - sqrtDiscriminant) / (2 * a);
    print("The quadratic equation has two roots: ${root1} and ${root2}");
  }
}

If You currently Learning another Language different from the Above, Just Try to Replicate it. As Replicating it would help you in understanding what you are Learning. PEN DOWN and Peace Out🖊️

Is This Everything About Algorithm?

😂😂, Honestly Know this is just a tip of an Iceberg About Algorithms. Even me doesn't know the End of the Algorithm Please Do not let that scare you. But Practicing more on LeetCode and watching tutorial videos on youtube would actually paved way for you in the programming world and increase your knowledge and make you an expert way more Better than Me.

Best Free Resource To become a better Version of Yourself Regarding Algorithm.

  1. CS50: Introduction to Computer Science

  2. Edx Platform (Just like Udemy)

  3. FreeCodeCamp: Algorithms and Data Structures Tutorial - Full Course for Beginners

  4. What's an algorithm? - David J. Malan

  5. CS50 2022 - Lecture 3 - Algorithms

  6. Algorithms in Python – Full Course for Beginner

Loved My Article, Check Me Out Here: https://zaap.bio/techadot