Hi there đź‘‹, I’m Niraj Kashyap

I am a software engineer passionate about coding and technology. Welcome to my personal blog and portfolio where I share my projects, insights, and experiences in the tech world.

Lowest Common Ancestor LCA in Finite State Machines

What is Lowest Common Ancestor (LCA)? The Lowest Common Ancestor (LCA) of two nodes in a tree is the deepest (i.e., lowest) node that is an ancestor of both nodes. In other words, it is the shared ancestor of the two nodes that is located farthest from the root. The concept is fundamental in computer science, especially in the context of tree data structures, such as binary trees, general trees, and state machines. ...

January 31, 2026 Â· 3 min Â· 553 words Â· Niraj Kashyap

Why Finite State Machines Are Everywhere: From Software to Human Life

Why Finite State Machines Are Everywhere: From Software to Human Life Finite State Machines (FSMs) are everywhere — whether you are writing software, designing systems, or simply living your daily life. From a login screen that moves from “logged out” to “logged in”, to a human being transitioning from “sleeping” to “working”, the same pattern exists. In this article, we’ll explore what a Finite State Machine is, how it works in software, and why human behavior itself can be understood as a series of states and transitions. ...

January 13, 2026 Â· 3 min Â· 602 words Â· Niraj Kashyap

Finite State Machines Backed by PostgreSQL Intro

Building a Finite State Machine with PostgreSQL Finite State Machines (FSMs) are powerful tools for modeling workflows, processes, and business logic that involve a series of states and transitions. While FSMs are often implemented in application code, PostgreSQL’s advanced features—such as triggers, constraints, and procedural functions—make it possible to manage state transitions directly within the database. In this upcoming blog series, we will discover how to build Finite State Machines (FSM) with PostgreSQL. The series will guide you through designing robust FSMs, enforcing valid transitions, and leveraging PostgreSQL’s advanced features—such as triggers, constraints, and procedural functions—to manage state transitions directly in the database. By the end of the series, you’ll see how PostgreSQL can serve as more than just a data store—it can be the engine that drives your application’s stateful logic.

December 30, 2025 Â· 1 min Â· 132 words Â· Niraj Kashyap