## Use Notepad++ As Offline JSON Validator

If you are on Windows & already using NotePad++, you can use it as an offline JSON validator tool. Just install this plugin. Now you can validate & view JSON text in tree structure inside the text editor. It might not give you fancy UI like some of the online JSON formatters do, but it … Read more

## Difference Between Wait And Park Methods In Java Thread

If you are familiar with thread dump or at least looked at it couple of times, probably you would have noticed WAITING  & WAITING (parking) states. So what’s the difference? In Java, we have Objects.wait() and Unsafe.park() methods. Both of them will suspend the running thread & put it in waiting state. But these two … Read more

## Find Pattern And Its Anagrams In A Text

Suppose we need to find if some text contains a pattern or any of its anagrams. I will explain how you can do it in O(n) time. Let’s consider the example below: Text: cedaabd Pattern: abad Here are all possible 4-letter anagrams of abad: aabd aadb abad abda adab adba baad bada bdaa daab daba … Read more

## How Asynchronous Ajax Calls Get Executed In JavaScript Event Loop

I will keep this post short. There are tons of resources where you can find JavaScript and it’s event loop architecture. I am here to clarify few things. Let’s take an example from this resource. It fairly explains the event loop & the event queue used by JavaScript engine. But the question is what happens … Read more

## KMP Algorithm Explained In Plain English

Here I am just trying to explain KMP algorithm in plain english. I will also explain worst time complexity & why it is O(m + n). We will take two examples, one with no repeatable character in the pattern & another with repeatable characters in the pattern. Pattern With Repeatable Characters: Text: aaaabaabab Pattern: aaaaa … Read more

## Simple Explanation Of Rabin-Karp Pattern Matching Algorithm

In this post, I will try to explain Rabin-Karp algorithm & its worst time complexity. Rabin-Karp algorithm is based on hash matching.   Let’s take an example. Text: aadabcPattern: abc   Let’s create a table as below & represent each letter with some arbitrary number. We will use it to calculate hash. a b c … Read more