Essential Problem-Solving Tool | Linked List | LeetCode Notes
🌐 中文版:繁體中文 Introduction to the Linked List A Linked List is a common data structure, composed mainly of data and the address of the next node, forming a structure where nodes link to each other, with the last node pointing to the NULL address. The main way we implement it is with C. To implement a Linked List, we must first define the node itself with a struct. Implementing a Linked ListDefining the node1234typedef struct node{ int data; struct node *next;} Node; Above we define...
Using a Hash Table | LeetCode#1 Two Sum
🌐 中文版:繁體中文 Problem statement The problem gives an integer array and an integer target, and asks us to find any two elements in the array that add up to target and return their indices. Also, each input array has exactly one output answer. Solution 1: brute forceAs usual, we start with brute force: get a solution first, then see how to optimize later. 123456789101112131415161718192021222324/** * Note: The returned array must be malloced, assume caller calls free(). */int* twoSum(int* nums, ...
Essential Problem-Solving Tool | Hash Table | LeetCode Notes
🌐 中文版:繁體中文 Basic introductionA hash table is a Key-Value mapping structure used for fast data lookup. Compared to the $O(\log n)$ time complexity of general search algorithms, its time complexity is $O(1)$. The main reason for the lightning speed is the hash function. If we first store n numbers in a hash table, then to check whether a number A is already in the hash table, we just throw A into the hash function and immediately know which slot in the hash table A maps to. When a Hash Table...
Binary Search | Easy | LeetCode#704 Binary Search
🌐 中文版:繁體中文 Problem statement The problem gives an integer array nums that is sorted, and we want to find the index of the element target in it, returning -1 if it isn’t found. It also requires that the algorithm run in $O(\log n)$ time. SolutionMy approach123456789101112131415161718192021222324252627282930int search(int* nums, int numsSize, int target) { // init int i,mid=0,low=0, high=numsSize-1; // Binary search // 1. find lower index and high index according to the ...
Executing Remote Operations with AWS IoT Jobs: A Hands-On Tutorial
What is a Job? A Job is a remote operation that is sent to and executed on one or more devices connected to AWS IoT. For example, you can define a Job that instructs a set of devices to download and install application or firmware updates, reboot, rotate certificates, or perform remote troubleshooting operations. How to create a Job?You must create a job document first. The Job Document is a description of the remote operations to be performed a Job Target When you create a Job, you specif...
Steps to Create a Lambda Function URL
🌐 中文版:繁體中文 What is a Lambda URL? Official definition: A function URL is a dedicated HTTP(S) endpoint for a Lambda function. You can create and configure a function URL through the Lambda console or the Lambda API. When you create a function URL, Lambda automatically generates a unique URL endpoint for you. Once created, the URL endpoint never changes. The function URL endpoint format is: 1https://<url-id>.lambda-url.<region>.on.aws Note that some regions don’t support functio...
Horizontally Scaling ActiveMQ
🌐 中文版:繁體中文 Amazon MQAmazon MQ offers managed ActiveMQ, a message-queue service. I recently ran into the question of how to do horizontal scaling on Amazon MQ. First, a quick explanation of the difference between vertical scaling and horizontal scaling. Scaling means expanding. Vertical scaling focuses on boosting a single instance’s compute power, so vertical scaling might be a better CPU/GPU, larger memory capacity, and so on. In terms of AWS services, it might be swapping the instan...
Linux Process Deep Dive-1: Knowledge of PID 0
PID 0 An Idle Process used to swap all pages of processs to/from memory/backing store. “Swap Process” It was there, so Linux always have CPU to execute something If you try to execute ps command on the clean Ubuntu Linux, you’ll find there was no process with “PID0” Idle systemcall not supported since kernal 2.3.13 Then how can we prove that PID0 really exist? Demo Using bpftrace for tracking the kernel function hrtimer_wakeup hrtimer_wakeup mean to: Waking up processes Move the...
【Study Notes】OTA Update -1
🌐 中文版:繁體中文 What is an OTA Update (Over-The-Air Update)?Updating a device’s software/firmware over wireless communication. The OTA flow Notify The device is notified of a pending OTA update The device can choose to ignore the update or accept it to trigger the download Download The device downloads the update via various supported protocols The update package downloads to a pre-configured storage area E.g. an S3 bucket The update may be a brand-new firmware image or a patch to exis...
FreeRTOS_Note
AWS FreeRTOS FreeRTOS includes libraries for connectivity, security, and over-the-air (OTA) updates. FreeRTOS also includes demo applications that show FreeRTOS features on qualified boards. FreeRTOS is an open-source project. You can download the source code, contribute changes or enhancements, or report issues on the GitHub site at https://github.com/FreeRTOS/FreeRTOS. FreeRTOS - ArchitectureFreeRTOS contains two types of repositories single library repositories Each single library repo...











