-
Finding the Median of Two Sorted Arrays
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 can think to simply merge…
-
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 (like pthread_join).detach() -> Lets thread…
-
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 and flexible, offering a low-level…
-
Process States & Scheduling
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., waiting on I/O (often a…
-
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, 7]L4 → [3, 5] Step…
-
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 a page table. This translation…
Subscribe
Enter your email below to receive updates.