Request Response Communication Pattern

The request-response model is a communication pattern used in computing where a client sends a request to a server, and the server responds to the request. This model is used in various communication protocols and APIs to exchange data between clients and servers widely used in web development, networking, and distributed systems. Examples of this request response pattern can be seen in following use cases: Protocols HTTP DNS SSH RPC TCP APIS...

July 3, 2024 · 7 min · 1417 words · Xavier Loera Flores

Arrays in Memory

Arrays are a data structure used to store a collection of elements of the same type. They are stored in memory continuously. This means that all the elements of the array can be found sequentially in memory. Arrays in RAM Array elements are stored sequentially in memory. The memory address of the first element of the array is used to access the entire array. The size of the data between each element in the array is determined by the size of the data type of the elements....

July 1, 2024 · 2 min · 280 words · Xavier Loera Flores

Two Sum

Problem https://leetcode.com/problems/two-sum/ Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order. Examples Example 1: Input: nums = [2,7,11,15], target = 9 Output: [0,1] Explanation: Because nums[0] + nums[1] == 9, we return [0, 1]....

June 8, 2024 · 3 min · 532 words · Xavier Loera Flores

In Place Algorithms

In Place Algorithms In place algorithms are algorithms that are executed without needing extra memory. They will modify the input data directly and work within the same memory space. In place algorithms can use a amount of extra memory and still be considered in place. As long as the output is stored in the same memory space as the input, the algorithm is considered in place. Algorithms that don’t modify the input data directly and require extra memory are considered out of place or not in place....

June 8, 2024 · 2 min · 321 words · Xavier Loera Flores

Stable Sorting Algorithms

Stable Sorting Algorithms Stable sorting algorithms are algorithms that maintain the relative order of equally valued elements in its sorted output. This means that if two elements are equal in value, the element that appears first in the original list will appear first in the sorted list. Use Case One use case when sorting a list of objects by multiple keys. If the list is sorted by one key and then sorted by another key, the relative order of the first key will be maintained in the second sort....

June 4, 2024 · 2 min · 227 words · Xavier Loera Flores

Merge Sort

Merge Sort Merge Sort is a divide-and-conquer algorithm that divides the input list into two halves, recursively sorts the halves, and then merges the sorted halves. This algorithm is efficient for larger lists and is a stable sorting algorithm that guarantees $O(n \log n)$ time complexity. Key Points Time Complexity: $O(n \log n)$ Space Complexity: $O(n)$ Process: Divide: The input list is divided into two halves Conquer: The two halves are recursively sorted Merge: The sorted halves are merged back together in sorted order Features:...

June 2, 2024 · 3 min · 531 words · Xavier Loera Flores

Bubble Sort

Bubble Sort Bubble Sort is a simple sorting algorithm which repeatedly compares and swaps adjacent elements in place. By swapping elements into the correct order, larger elements will be bubbled towards the end of the list. Effectively, the algorithm bubbles the current largest element to the end of the list in each phase of the algorithm. Although this algorithm is simple, it is not efficient for larger lists. Key Points Time Complexity: $O({n}^{2})$...

June 1, 2024 · 2 min · 380 words · Xavier Loera Flores