Server Side Programming Articles

Page 938 of 2109

An application on Bertrandís ballot theorem in C/C++

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

Bertrand's ballot theorem states that in an election where candidate A receives p votes and candidate B receives q votes (where p > q), the probability that A is always strictly ahead throughout the counting process is (p-q)/(p+q). This theorem has practical applications in probability theory and combinatorics. Syntax Probability = (p - q) / (p + q) where p > q > 0 Mathematical Example Let there are 5 voters, of whom 3 vote for candidate A and 2 vote for candidate B (so p = 3 and q = 2). Ten possibilities ...

Read More

All combinations of strings that can be used to dial a number in C/C++?

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

Given a phone number, this program generates all possible string combinations that can be formed using the traditional phone keypad mapping. Each digit (2-9) maps to multiple letters, while digits 0 and 1 map to themselves. Syntax void printWords(int number[], int n); Keypad Mapping 2 ABC 3 DEF 4 GHI 5 JKL ...

Read More

C vs BASH Fork bomb in C/C++?

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

A fork bomb is a type of denial-of-service attack that creates an exponential number of processes, consuming system resources. While BASH fork bombs are more persistent because created processes detach from the parent, C fork bombs have their own characteristics and can be modified to increase their impact. Syntax #include int main() { while(1) { fork(); } return 0; } BASH vs C Fork Bomb Differences The key differences between BASH and ...

Read More

AA Trees in C/C++?

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

An AA tree in computer science is defined as a form of balanced binary search tree designed for storing and retrieving ordered data efficiently. AA trees are a variation of red-black trees but with simplified balancing rules. Unlike red-black trees, red nodes (horizontal links) in AA trees can only exist as right children, never left children. Key Properties AA trees maintain the following invariants − The level of every leaf node is one The level of every left child is exactly one smaller than its parent The level of every right child is equal to or ...

Read More

A-Buffer Method in C/C++?

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

The A-Buffer method is an advanced hidden surface removal technique in computer graphics that extends the traditional Z-Buffer algorithm. Also known as anti-aliased, area-averaged, or accumulation buffer, this technique handles both opaque and transparent objects, making it suitable for complex rendering scenarios where multiple surfaces contribute to a single pixel. Syntax struct ABuffer { float depth; union { struct { int r, g, b; ...

Read More

A Number Link Game in C/C++?

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

The Number Link Game is a logic puzzle played on an n × n grid. Some squares are empty, some are solid (blocked), and some contain numbered endpoints (1, 2, 3, etc.). Each number appears exactly twice on the board. The goal is to connect matching numbers with non-intersecting paths using only horizontal and vertical movements, filling all non-solid squares. Syntax // Union-Find structure for path generation typedef struct { int parent[MAX_SIZE]; int rank[MAX_SIZE]; } UnionFind; // Game board representation typedef struct { int ...

Read More

System() Function in C/C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 15-Mar-2026 38K+ Views

The system() function is a part of the C standard library that executes system commands. It is used to pass commands that can be executed in the command processor or terminal of the operating system, and returns the command's exit status after completion. Note: To use the system() function, include header file. Syntax int system(const char *command); Parameters command − A pointer to a null-terminated string containing the command to be executed. If NULL, checks if command processor is available. Return Value Returns the exit ...

Read More

Power of Two in C

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

In C programming, checking whether a number is a power of two is a common problem that can be solved efficiently using bitwise operations. A power of two is any number that can be expressed as 2n where n is a non-negative integer (1, 2, 4, 8, 16, 32, etc.). Syntax bool isPowerOfTwo(int n); // Returns true if n is a power of 2, false otherwise Algorithm The key insight is that powers of two have a specific binary pattern − they have exactly one bit set to 1 (the MSB) and all other ...

Read More

Program to print Square inside a Square in C

suresh kumar
suresh kumar
Updated on 15-Mar-2026 1K+ Views

In C, printing a square inside a square involves creating a pattern where two square borders are drawn using nested loops. The outer square forms the boundary, while an inner square is positioned within it, creating a nested square pattern. Syntax for (row = 1; row

Read More

Program to print solid and hollow rhombus patterns in C

suresh kumar
suresh kumar
Updated on 15-Mar-2026 763 Views

A rhombus pattern in C is a diamond-like shape created using stars (*). There are two types: solid rhombus (completely filled with stars) and hollow rhombus (only the border is filled with stars). Syntax // Nested loops to create rhombus pattern for(row = 1; row

Read More
Showing 9371–9380 of 21,090 articles
« Prev 1 936 937 938 939 940 2109 Next »
Advertisements