B-Tree a data structures - Postgres Internals rabbit hole..
Introduction B-Trees are a facinating inventions in computing. They are some special kind of binary tree. But with very concrete rules. I have watched small video and now i am in the b-tree rabbit hole. I’ts nice last time i’ve been in a rabbit hole like this was when i was learning about prime numbers and how they used in cryptography, well thats a blog post for another day. So The btree data structure in simple terms is a tree which has multiple values in single node, and children nodes can be more than 2....
Designing a Stock Ticker Service
The Stock Ticker Service Design I got pissed off by seeing system design interview videos on this. So I thought why not write a blog post about it. Why i got pissed off? I have watched a video on youtube about this. This dude introduces a time series database infront of a stock ticker service. I mean come on, this is not a time series database, this is a stock ticker service....
Grouping anagrams
Problem Given an array of strings strs, group the anagrams together. You can return the answer in any order. Example 1: Input: strs = [“eat”,“tea”,“tan”,“ate”,“nat”,“bat”] Output: [[“bat”],[“nat”,“tan”],[“ate”,“eat”,“tea”]] Explanation: There is no string in strs that can be rearranged to form “bat”. The strings “nat” and “tan” are anagrams as they can be rearranged to form each other. The strings “ate”, “eat”, and “tea” are anagrams as they can be rearranged to form each other....
Remove more than two duplicates in-place
Problem Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed in the first part of the array nums. More formally, if there are k elements after removing the duplicates, then the first k elements of nums should hold the final result....
Inplace element removal an easy one
Problem Given an integer array nums and an integer val, remove all occurrences of val in nums in-place. The order of the elements may be changed. Then return the number of elements in nums which are not equal to val. Consider the number of elements in nums which are not equal to val be k, to get accepted, you need to do the following things: Change the array nums such that the first k elements of nums contain the elements which are not equal to val....
The nicest way to merge two sorted arrays
You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. Merge nums1 and nums2 into a single array sorted in non-decreasing order. The final sorted array should not be returned by the function, but instead be stored inside the array nums1. To accommodate this, nums1 has a length of m + n, where the first m elements denote the elements that should be merged, and the last n elements are set to 0 and should be ignored....
gRPC - The Witchcraft of Remote Procedure Calls
WTF is gRPC? Why GRPC ? Some technologies are like witchcraft. You hear about them, you see them in action, but you don’t really understand how they work. gRPC is one of those technologies for me. It’s a remote procedure call (RPC) framework that allows you to define services and methods in a language-agnostic way, and then generate client and server code in multiple languages. So what it means is there is a ....
Replication - Leaders and Followers
Replication - Leaders and Followers Replication, or read replica is a process of copy pasting data from a primary database to another database. This is done to improve performance, availability, and reliability of the database. Replication can be done in two ways: synchronous and asynchronous. In synchronous replication, the primary database waits for the replica to acknowledge that it has received the data before it can proceed. This ensures that the data is always consistent between the primary and replica databases, but it can also slow down the performance of the primary database....
IP V4 Subnetting tricks and basics
IP V4 Subnetting tricks and basics Introduction As usual lets try to be little intellectual. By saying a qoute i got it from chatgpt. “Good subnetting is like good carpentry: measure twice, cut once.” What ever it means it doesnt matter. But the point is to understand the concept of subnetting and how it works. This is somehow one of the most mind f**k*ng topic which i encoutered during my job....
Utils
First tool: Subnet Calculator If you want to calculate the subnet, you can use the following tool. It will help you to calculate the subnet, broadcast address, and usable IP addresses. Loading message...