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

# Typing Effect in React

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

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 `h1`tag 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). …

# All Pythagorean Triplets Less Than Equal to N in Optimal Time Complexity

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² ). …

# Mandelbrot Set with Python

“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.

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 Technique on Graphs: Breadth-First Search

## Search far and wide

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. …

# Search Technique on Graphs: Depth-First Search

## Dive into search

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. …