Arnab Chakraborty

Arnab Chakraborty

3,768 Articles Published

Articles by Arnab Chakraborty

Page 176 of 377

What is OpenMP?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 8K+ Views

OpenMP (Open Multi-Processing) is a set of compiler directives and an API for programs written in C, C++, or FORTRAN that provides support for parallel programming in shared-memory environments. OpenMP identifies parallel regions as blocks of code that may run concurrently across multiple threads. Syntax #pragma omp parallel { // Code block to execute in parallel } How OpenMP Works Application developers insert compiler directives into their code at parallel regions, and these directives instruct the OpenMP run-time library to execute the region in parallel. When OpenMP encounters the #pragma ...

Read More

Windows Anonymous Pipe

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 1K+ Views

Windows anonymous pipes are unidirectional communication channels that enable data transfer between parent and child processes. They behave similarly to UNIX pipes but use Windows-specific APIs. Reading and writing operations are performed using standard ReadFile() and WriteFile() functions. Syntax BOOL CreatePipe( PHANDLE hReadPipe, // Read handle PHANDLE hWritePipe, // Write handle LPSECURITY_ATTRIBUTES sa, // Security attributes DWORD nSize ...

Read More

Binary Search using pthread in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 635 Views

Binary search is one of the most efficient searching algorithms for sorted arrays. It works by repeatedly dividing the search space in half. In this article, we'll explore how to implement binary search using multiple threads (pthread) in C to potentially improve performance by parallelizing the search across different segments of the array. Syntax #include int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); int pthread_join(pthread_t thread, void **retval); Example: Multithreaded Binary ...

Read More

Binary representation of next greater number with same number of 1's and 0's in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 351 Views

In C programming, finding the binary representation of the next greater number with the same number of 1's and 0's is a classic problem that can be solved using a next-permutation approach. Given a binary string, we need to find the smallest binary number that is greater than the given number and contains exactly the same count of 0's and 1's. Syntax char* nextBinary(char* bin); Algorithm The algorithm works in two main steps − Find the rightmost '01' pattern and swap it to '10' Rearrange all bits after the swap position to ...

Read More

BFS using vectors & queue as per the algorithm of CLRS in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 431 Views

In graph theory, BFS (Breadth-First Search) is a fundamental traversal algorithm described in CLRS (Introduction to Algorithms). It explores vertices level by level using a queue data structure and maintains vertex states using colors. Syntax void BFS(int graph[][MAX_VERTICES], int vertices, int source); Algorithm The CLRS BFS algorithm uses the following pseudocode − BFS(G, s) - begin for each vertex u in G.V - {s}, do u.color := white u.d := infinity ...

Read More

Betrothed numbers in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 641 Views

Betrothed numbers are a special pair of numbers where the sum of proper divisors of one number equals one more than the other number. These mathematical curiosities demonstrate interesting relationships between divisibility and number theory. Syntax int sumOfProperDivisors(int n); void findBetrothedPairs(int limit); Understanding Betrothed Numbers For example, the pair (48, 75) are betrothed numbers − Proper divisors of 48: {1, 2, 3, 4, 6, 8, 12, 16, 24}, sum = 76 Proper divisors of 75: {1, 3, 5, 15, 25}, sum = 49 Since 76 = 75 + 1 and 49 = ...

Read More

Baum Sweet Sequence in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 259 Views

The Baum Sweet Sequence is a binary sequence where each term is determined by analyzing the binary representation of a number. If a number n has any block of consecutive zeros with odd length in its binary form, then the nth term is 0, otherwise it is 1. For example, if the number is 4, its binary representation is 100. This has one block of two consecutive zeros (even length), so the 4th term of the Baum Sweet sequence is 1. Syntax int baumSweetTerm(int n); Algorithm The algorithm works as follows − ...

Read More

Auxiliary Space with Recursive Functions in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 460 Views

Here we will see how auxiliary space is required for recursive function calls and how it differs from normal function calls in terms of memory usage. Syntax returnType functionName(parameters) { // Base case if (condition) return baseValue; // Recursive case return functionName(modifiedParameters); } Recursive Function Example Consider a recursive factorial function − #include long fact(int n) { if (n == 0 || ...

Read More

Array range queries for elements with frequency same as value in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 357 Views

In C programming, array range queries for elements with frequency same as value is a problem where we need to find how many elements in a given range appear exactly as many times as their value. For example, if element 3 appears 3 times in the range, it contributes to our answer. Syntax int query(int start, int end, int arr[], int n); Algorithm The approach uses frequency counting within the specified range − Begin create frequency map for elements in range [start, end] count ...

Read More

Area of the biggest possible rhombus that can be inscribed in a rectangle in C Program?

Arnab Chakraborty
Arnab Chakraborty
Updated on 15-Mar-2026 232 Views

Here we will see one problem, where one rectangle is given. We have to find the area of largest rhombus that can be inscribed in the rectangle. Rectangle Inscribed Rhombus Length (l) Breadth (b) ...

Read More
Showing 1751–1760 of 3,768 articles
« Prev 1 174 175 176 177 178 377 Next »
Advertisements