Programming Articles

Page 1840 of 2547

Number of elements greater than K in the range L to R using Fenwick Tree (offline queries)

Riya Kumari
Riya Kumari
Updated on 12-Jul-2023 499 Views

In the field of computer science, we have to process large datasets which includes query selection and update operations. It is a challenging task for the developers to execute these operations in real-time with less time complexity. Using Fenwick tree is an efficient way to tackle these range-based query problems. Fenwick Tree is a data structure which updates elements and calculates the prefix sums of the numbers in a table efficiently. It is also known as Binary Indexed Tree. In this article, we will discuss how to use Fenwick Trees for finding the number of elements greater ...

Read More

Number of divisors of product of N numbers

Riya Kumari
Riya Kumari
Updated on 12-Jul-2023 566 Views

Divisor of a number is which divides it exactly without any remainders. In other words, a divisor of a number n is the one which results in n when multiplied by any other integer. It can also be called as a factor of a number. Dividend ÷ Divisor = Quotient. For example, if we divide 60 with 5 we will get 12 and vice versa therefore, 12 and 60 can be considered as divisors of 60. Number of Divisors of Product of N Numbers Given task is to find the number of divisors of the product of the given ...

Read More

Number of divisors of a given number N which are divisible by K

Riya Kumari
Riya Kumari
Updated on 12-Jul-2023 460 Views

Finding the number of divisors of a given number N which is also divisible by K (any constant number) is a typical mathematical problem which requires lot of calculations. Here, K is usually a number which is less than or equal to square root of N. However, we can construct a C++ program by which counting such numbers will be an easier task. In this article, we will discuss different methods in C++ using which we can find solution to the above given problem. Input Output Scenarios If we consider the below scenario here we have N value as ...

Read More

Difference between Thread ID and Thread Handle

Pradeep Kumar
Pradeep Kumar
Updated on 12-Jul-2023 947 Views

In multi−threaded programming, threads are lightweight units of execution that enable concurrent execution within a single process. Threads share the same memory space and resources of the process, allowing for efficient utilization of system resources. To work with threads, developers often need to distinguish between different threads and manage their execution. This is where the concepts of thread ID and thread handle come into play. In a multi−threaded programming environment, threads are independent units of execution within a process. Each thread has its own unique identifier and a corresponding handle that can be used to manipulate and manage the thread. ...

Read More

Difference between system() and execl() Call

Pradeep Kumar
Pradeep Kumar
Updated on 12-Jul-2023 959 Views

In programming, system−level calls are used to interact with the operating system and perform various tasks. Two commonly used system−level calls are system() and execl(). While both these calls allow executing external programs, they differ in their functionality and usage. What is system() Call? The system() call is a higher−level function that allows the execution of shell commands or scripts. When system() is invoked with a command as its argument, it starts a new shell process, which then interprets and executes the specified command. The system() call provides a simple way to interact with the command line and execute external ...

Read More

How to Configure Nginx as Reverse Proxy for Nodejs App?

Satish Kumar
Satish Kumar
Updated on 11-Jul-2023 2K+ Views

Introduction Nginx and Nodejs are two powerful tools that web developers use to build modern web applications. Nginx is a high-performance, open-source web server that can also function as a reverse proxy, caching server, load balancer, and more. Nodejs is a JavaScript runtime built on the Chrome V8 engine that allows developers to create fast and scalable network applications. The First Step: Installing and Configuring Nginx A Step-By-Step Guide to Installing Nginx on the Server Before you can configure Nginx as a reverse proxy for your Nodejs app, you need to install it. The installation process varies depending on your ...

Read More

Convert a Binary String to Another by Flipping Prefixes a Minimum Number of Times

Prabhdeep Singh
Prabhdeep Singh
Updated on 11-Jul-2023 369 Views

Prefixes are the substrings that start from the zeroth index and could be of any size from 1 to the length of the given string. We are given two binary string which means both strings contain only two different types of characters and we have to make the first string equal to the second one by flipping the prefix a minimum number of times. Also, it is given that the length of both of the given strings is equal. Input 1 string str1 = "01100" string str2 = "10101" Output 3 Explanation Only operation that we can perform ...

Read More

Largest Roman Numeral Possible by Rearranging Characters of a Given String

Prabhdeep Singh
Prabhdeep Singh
Updated on 11-Jul-2023 302 Views

The characters represent Roman numbers: 'I', 'V', 'X', 'L', 'C', 'D', and 'M'. We will be given a string that may contain another character also (all the characters will be uppercase English alphabets) and we have to find the largest Roman numerical number possible by altering the position of the characters of the given string, also if it is not possible to get one, then we will return invalid as the answer. Input 1 string str = “VICML” Output MCLVI Explanation In the given string we have M have the greater value followed by the C, and then all ...

Read More

How to resample a NumPy array representing an image?

Rohan Singh
Rohan Singh
Updated on 11-Jul-2023 3K+ Views

Resampling a Numpy array representing an image is the process of changing the size of the array while maintaining the quality of the image. We can resample an array using interpolation, decimation, and upsampling techniques in Python. We can use the ndimage.zoom() function for Scipy library in Python to resample a Numpy array representing an image. In this article, we will understand how to resample a Numpy array representing an image using the Scipy module in Python. Interpolation Interpolation is a technique used to estimate values between existing data points. In Numpy we have several interpolation methods like liner, ...

Read More

Java Program to Check if all Rows of a Matrix are Circular Rotations of Each Other

Prabhdeep Singh
Prabhdeep Singh
Updated on 11-Jul-2023 298 Views

Matrix consists of rows and columns to form a rectangular array. And circular rotations mean rotating the array's elements so that one rotation places the last element in the first position and the rest of the elements to the right. In this problem, we have given a matrix of n * n, and our task is to check if all rows of a matrix are circular rotations of each other then print “YES” otherwise print “NO”. Let's see examples with explanations below to understand the problem in a better way. Input 1 mat = [ [ 1, 5, 6], ...

Read More
Showing 18391–18400 of 25,466 articles
Advertisements