Computing & Technology
by ACMer
2d ago
In 2003, I took the college entrance exam and then spent the summer in Beijing. In September, I enrolled at the International College at Beijing (ICB) of China Agricultural University. However, I was admitted through a self-funded program since my entrance exam score wasn’t high enough to secure a spot at the university. The ICB was a Sino-foreign joint program, with the first year of study in China and the second and third year abroad. The academic year 2003-2004 marked the first phase of my rapid growth in computer knowledge. I was dedicated to my studies during this period, and Continue Rea ..read more
Computing & Technology
by ACMer
5d ago
The statement “Backtracking = DFS + Pruning” is a concise and intuitive description of the backtracking algorithm. To understand this, let’s break down the key concepts in this equation. Depth-First Search (DFS) Algorithm DFS is an algorithm for traversing graphs or trees. It starts from the root node and explores as far as possible along one branch before backtracking to explore other branches. This search strategy is naturally suited for problems that require exploring all possible states, such as combinations or permutations. Pruning Strategy Pruning refers to the process of eliminating cer ..read more
Computing & Technology
by ACMer
6d ago
Teaching Kids Programming: Videos on Data Structures and Algorithms You are given a string s. Simulate events at each second i: If s == ‘E’, a person enters the waiting room and takes one of the chairs in it. If s == ‘L’, a person leaves the waiting room, freeing up a chair. Return the minimum number of chairs needed so that a chair is available for every person who enters the waiting room given that it is initially empty. Example 1: Input: s = “EEEEEEE” Output: 7 Explanation: After each second, a person enters the waiting room and no Continue Reading » The post Teaching Kids Programming – Min ..read more
Computing & Technology
by ACMer
2w ago
Teaching Kids Programming: Videos on Data Structures and Algorithms You are given an integer array nums. In one move, you can pick an index i where 0 <= i < nums.length and increment nums by 1. Return the minimum number of moves to make every value in nums unique. The test cases are generated so that the answer fits in a 32-bit integer. Example 1: Input: nums = Output: 1 Explanation: After 1 move, the array could be . Example 2: Input: nums = Output: 6 Explanation: After 6 moves, the array could be [3, 4, Continue Reading » The post Teaching Kids Programming – Minimum Increment to Make A ..read more
Computing & Technology
by ACMer
1M ago
A simple yet effective hash function for strings is the well-known “djb2” algorithm by Daniel J. Bernstein. It is simple to implement and has good performance characteristics for many use cases. C++ djb2 Hash Function Here is the implementation of the djb2 hash function in C++: #include <iostream> #include <string> unsigned long djb2(const std::string &str) { unsigned long hash = 5381; for (char c : str) { hash = ((hash << 5) + hash) + c; // hash * 33 + c } return hash; } Example usage: int main() { std::string input; std::cout << "Enter a string to hash: Continue R ..read more
Computing & Technology
by ACMer
1M ago
My Microsoft Surface Laptop Studio 2 becomes extremely laggy, slow, and nearly unusable in hot weather. The high CPU temperature causes it to throttle. After checking, I confirmed the laptop was indeed very hot, and I managed to cool it down with a large external fan. However, the room’s hot temperature led to a Windows 11 crash, resulting in a Blue Screen of Death (BSOD) related to the Nvidia GPU driver, nvlddmkm.sys. As temperatures soar during the hot weather months particular this year, computer users, especially those with powerful hardware setups, might notice a decline in performance or ..read more
Computing & Technology
by ACMer
1M ago
Teaching Kids Programming: Videos on Data Structures and Algorithms Table: Tree +-------------+------+ | Column Name | Type | +-------------+------+ | N | int | | P | int | +-------------+------+ N is the column of unique values for this table. Each row includes N and P, where N represents the value of a node in Binary Tree, and P is the parent of N. Write a solution to find the node type of the Binary Tree. Output one of the following for each node: Root: if the node is the root node. Leaf: if the node is the leaf node. Continue Reading » The post Teaching Kids Programming – SQL to Determine ..read more
Computing & Technology
by ACMer
1M ago
The apache server logs the access requests in /var/log/apache2 so we can analyse this log file to find out the last few requests. The following parses the apache2 server logs, and print the requests line by line. It is based on the BASH commands: awk and tail. #!/bin/bash NUMBER_OF_REQUESTS=50 LOG_FILES_PREFIX=/var/log/apache2/access tail -n \$NUMBER_OF_REQUESTS \$LOG_FILES_PREFIX* | awk -F'"' ' # Ensure the IP address, request, and user agent fields are present \$1 ~ /^+\.+\.+\.+/ && \$2 ~ /^(GET|POST|HEAD|PUT|DELETE|OPTIONS|PATCH)/ && \$6 != "" { split(\$1, part1, " ") ip = part1 s ..read more
Computing & Technology
by ACMer
1M ago
The following two features when enabled are the performance killer on Windows 11. As we navigate the intricacies of our Windows operating systems, ensuring optimal performance and safeguarding our privacy are top priorities. One way to achieve this is by tweaking a few essential settings, particularly focusing on Delivery Optimization and various privacy settings. This blog will guide you through turning off Delivery Optimization and adjusting your privacy settings for a more secure and efficient Windows experience. What is Delivery Optimization? Delivery Optimization is a feature in Windows 1 ..read more
Computing & Technology
by ACMer
1M ago
Teaching Kids Programming: Videos on Data Structures and Algorithms Apple Redistribution into Boxes You are given an array apple of size n and an array capacity of size m. There are n packs where the ith pack contains apple apples. There are m boxes as well, and the ith box has a capacity of capacity apples. Return the minimum number of boxes you need to select to redistribute these n packs of apples into boxes. Note that, apples from the same pack can be distributed into different boxes. Example 1: Input: apple = , capacity = Output: 2 Explanation: Continue Reading » The post Teaching Kids Pr ..read more

OR