Ravi Ranjan has Published 148 Articles

C++ Program to Find Maximum Element in an Array using Binary Search

Ravi Ranjan

Ravi Ranjan

Updated on 04-Jun-2025 15:36:00

506 Views

The binary search works on the divide and conquer principle as it keeps dividing the array into half before searching. For applying the binary search algorithm, the given array should be sorted. Since the array is sorted we do not need to search the maximum element in the array. Here, ... Read More

C++ Program to Implement Booth’s Multiplication Algorithm for Multiplication of 2 signed Numbers

Ravi Ranjan

Ravi Ranjan

Updated on 03-Jun-2025 17:46:59

2K+ Views

Booth's algorithm is a multiplication algorithm that multiplies two signed binary numbers in 2's complement notation. Booth used desk calculators that were faster at shifting than adding and created the algorithm to increase their speed. In this article, we have an array of multiplicand bits and an array of multiplier ... Read More

C++ Program to Implement Quick Sort with Given Complexity Constraint

Ravi Ranjan

Ravi Ranjan

Updated on 03-Jun-2025 17:46:44

3K+ Views

The quick sort technique is based on the partitioning of an array into smaller sub-arrays. It is based on the divide-and-conquer algorithm. The average time complexity of this algorithm is O(n*log(n)), but the worst complexity is O(n^2). To reduce the chances of the worst case, we implement the quick sort ... Read More

When can I use a forward declaration in C/C++?

Ravi Ranjan

Ravi Ranjan

Updated on 02-Jun-2025 18:20:45

887 Views

A forward declaration informs the compiler that a class, function, or variable is declared earlier, but it will be defined later in the code. In this article, our task is to understand the forward declaration and when to use it. When is Forward Declaration Used in C/C++? The forward ... Read More

C++ Program to Implement Naor-Reingold Pseudo Random Function

Ravi Ranjan

Ravi Ranjan

Updated on 02-Jun-2025 14:48:26

214 Views

The Naor-Reingold pseudo-random function uses a mathematical formula for generating random numbers using an array of secret keys('a') and bits of an input number('x'). The generated random numbers can be repeated based on the array of secret keys. In this article, our task is to generate random numbers using the ... Read More

C++ Program to Check the Connectivity of Directed Graph Using DFS

Ravi Ranjan

Ravi Ranjan

Updated on 30-May-2025 18:59:12

751 Views

To check if a directed graph is connected or not, we need to check if there exists a path between every pair of vertices. A directed graph (or digraph) is a graph where each edge has a direction, edges are in ordered pairs, and edges traverse from the source vertex ... Read More

Check if a graph is strongly connected - Set 1 (Kosaraju using DFS) in C++

Ravi Ranjan

Ravi Ranjan

Updated on 30-May-2025 18:58:57

345 Views

To check a strongly connected graph using Kosaraju's algorithm, we need to understand the strongly connected graph and Kosaraju's algorithm. For a graph to be strongly connected, it should be a directed graph, and for any pair of vertices u and v in the directed ... Read More

C++ Program to Check Whether a Graph is Strongly Connected or Not

Ravi Ranjan

Ravi Ranjan

Updated on 29-May-2025 19:19:15

417 Views

To check if a graph is strongly connected or not, we need to check if for any pair of vertices u and v in the directed graph, there exists a directed path from u to v and a directed path from v to u. In this article, we have a ... Read More

C++ Program to Generate a Graph for a Given Fixed Degree Sequence

Ravi Ranjan

Ravi Ranjan

Updated on 29-May-2025 19:18:23

335 Views

In this article, we will understand how to generate a graph for a given fixed-degree sequence. The degree of each node is given in the form of an array. The graph generated will be an undirected graph where the degree of each node will correspond to the given degree array. ... Read More

C++ Program to Check Whether an Undirected Graph Contains a Eulerian Path

Ravi Ranjan

Ravi Ranjan

Updated on 29-May-2025 19:17:56

1K+ Views

The Euler path is a path using which we can visit every edge exactly once in a graph. The same vertex can be used for multiple times. The source and destination nodes in the Euler path are different. If the source and destination node become the same, then the Eulerian ... Read More

Previous 1 ... 6 7 8 9 10 ... 15 Next
Advertisements