• Binary search is a simple algo, check mid value, compare, ignore invalid half, move to the valid half until completed / element is found.But the code has many variable, low, high, midShould the loop be while (low < high) or while (low <= high)?or high = mid -1 or high…

    Continue reading →: Binary Search
  • In this post, we will talk about leetcode 295: https://leetcode.com/problems/find-median-from-data-stream/description/ Problem looks simple, we need to find a Median of data stream, we can sort at each getMedian call. In short we have a such algo: Maintain a dynamic array or list.On every new number:Insert it into the list.To get…

    Continue reading →: Find Median from Data Stream
  • We will talk about the problem leetcode 4, https://leetcode.com/problems/median-of-two-sorted-arrays/description/ What is Median The median of a list is the “middle” value: So, if Array is [1,2,3], middle element is 2.if it is [1,2,3,4], middle elements are 2,3 so (2 + 3) / 2 = 2.5 Brute Force At first, we…

    Continue reading →: Finding the Median of Two Sorted Arrays
  • Threads

    std::thread is the standard C++11 way to spawn a new OS-level thread. Each std::thread object represents a single, joinable thread of execution. Under the hood, on Linux/Android, it wraps pthread_create() and uses native threads Creating a simple thread Important points to note .join() -> Waits for the thread to complete…

    Continue reading →: Threads
  • TinyALSA

    tinyalsa is a small, lightweight C library designed to simplify interaction with the Advanced Linux Sound Architecture (ALSA) in the Linux kernel. 1. ALSA and TinyALSA What is ALSA? ALSA (Advanced Linux Sound Architecture) is the standard framework in the Linux kernel for managing audio and MIDI hardware. It’s powerful…

    Continue reading →: TinyALSA
  • In this article, we will talk about different process states. We can check this via : cat /proc/status Code State Name Meaning R Running / Runnable Currently executing or ready to run S Sleeping Waiting (interruptible sleep) — e.g. blocked on I/O, waiting for futex D Uninterruptible Waiting, non-interruptible, e.g.,…

    Continue reading →: Process States & Scheduling
  • ,

    Merge k Sorted Lists

    In this article we will discuss leetcode23 https://leetcode.com/problems/merge-k-sorted-lists Sequential Merge So, the basic thought which comes to mind is to merge the first 2, make them 1 list and then merge it with other, keeping doing until we have 1 list. L1 → [1, 4]L2 → [2, 6]L3 → [0,…

    Continue reading →: Merge k Sorted Lists
  • Virtual Memory

    Virtual memory is an abstraction provided by the operating system where each process sees a private, uniform, and contiguous memory space, regardless of the actual physical memory available. Virtual addresses used by your code are translated to physical addresses via a hardware component called the Memory Management Unit (MMU) using…

    Continue reading →: Virtual Memory
  • , ,

    Priority Queue

    In this article we will see different way to use max, min heap using priority_queue in cpp. By default, priority_queue creates a maxHeap. Max Heap Min Heap To implement a minHeap, we need to tell compiler to change default comparison order, which can be done via passing a different comparator.…

    Continue reading →: Priority Queue
  • Process Memory Layout

    Linux organizes the virtual memory space of a process into segments, each serving a specific purpose. This is crucial for memory safety, performance, and debugging. Here’s a standard layout from low to high memory: +————————-+ | Text Segment | ← Executable instructions +————————-+ | Initialized Data (.data)| ← Global/static vars…

    Continue reading →: Process Memory Layout

It’s Jdecoder

I am trying to decode the concepts into simple words and documenting items i know or currently learning.

Let’s connect

Design a site like this with WordPress.com
Get started