A Curious Thinker | life-long-learner | https://www.linkedin.com/in/abdulsalamone/

Today, we will learn how to implement a Typing Effect in React from scratch.

Image for post
Image for post

A working Example can be found here.

Setting-Up

Start by creating a starter react app using npx create-react-app my-app or follow the procedure from here.

Go to App.js, remove all redundant Elements, and add a h1tag where the typing effect will take place.

Now import to add additional hooks using import {useEfect, useState} from "react";

Create an array of words that will be type one by one.

Now we have to keep track of the index of the word array for typing a specific word, so we will use the useState hook because we also want to update the index on the runtime (after a word has been typed). …


Image for post
Image for post

Pythagorean Triplets are set of three ordered positive integers (x,y,z) such that

                       x^2 + y^2 = z^2    --- (1)
where,
x < y < z <= N

There are several techniques for generating Pythagorean Triplets for example using Gaussian Integers and using Euclid’s formula. They can be used to generate all primitive Pythagorean Triplets, which again can be used to generate all non-primitive Pythagorean triplets by using the fact that the non Primitive Pythagorean triples are a positive integer multiple of primitive Pythagorean Triplets.

Generating Pythagorean triplets simply using two loops by iterating over x and y for all possible x and y, and checking if they satisfy Equation (1), takes time O(N² ). Also using the above methods for generating primitive Pythagorean triplets and from them generating all Pythagorean triples may take time O(N² ). …


“A Mandelbrot set marks the set of points in the complex plane such that the corresponding Julia set is connected and not computable. The Mandelbrot set is the set obtained from the recurrence relation, Z_(n) = Z²_(n-1) + c, where, Z_(0) = c. where c is a complex number” — Wolfram Mathworld.

Image for post
Image for post

The colors in a Mandelbrot set represents the iterations at which that complex number diverges to infinity (we can use here some threshold instead of infinity). …


Search far and wide

Image for post
Image for post

Breadth-first search (BFS) is a common search technique on graphs. BFS is a companion of depth-first search (DFS). While DFS traverses the graph depth-wise, BFS does it breadth-wise. It’s used to find a node in a graph. It may also be used to get the path to that node from a given node or to just traverse all the nodes and edges in a graph.

Why use BFS over DFS?

Let’s say we want to find a node in a tree where we know in advance the tree is not bushy (higher diameter) and the node lies somewhere in the middle of the tree. …


Dive into search

Image for post
Image for post

Depth-First Search (DFS) is a common search technique on graphs. It is used to find a node in a graph and may also be used to get the path to that node from a given node or to just traverse all the nodes and edges in a graph.

It can also be augmented to do many more interesting things such as finding connected components, strongly connected components, minimum spanning tree, cycles in graphs, topological sort, etc.

For a refresher and basic concepts on graphs visit my previous post, graph theory algorithms simplified.

All the code used in this series can be found on GitHub. …


Graph theory 101

Image for post
Image for post

Graph theory is a very broad branch of mathematics and it is highly applicable in real-world problems. Originally, graph theory was “invented” to solve real-world problems and after that, it was hijacked by abstract mathematicians like all other branches of mathematics.

In this tutorial and subsequent tutorials, we will look at some graph theory algorithms and their implementations in Python. Now, back to the meat of the subject.

What Is a Graph?

In a nutshell, a graph is a set of vertices/nodes and edges. If you are not comfortable with “set” replace it with collection.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store