Articles for author: Prajwal Agarwal

Leaky Bucket Algorithm

Problem Statement Consider a host A connected to a network. Host A produces bursty traffic (explained below) in the form of variable-length packets that must be transmitted to the receiver through a network. Suppose Host A sends : This traffic nature is called bursty traffic, coming from a source into the network. Bursty traffic is ...

Inversion Count in an Array

The Inversion count in an array indicates the number of element pairs (i, j) where i < j and A[i] > A[j], serving as a measure of the array’s unsortedness. Understanding Inversion count in an Array is essential for analyzing sorting algorithms’ efficiency and optimizing them, making count inversion a key concept in algorithm design ...

Find Duplicates in Array

Problem Statement Given an array A of size N + 1. Each element in array A is between 1 and N. Write a program to find one of the duplicates in array A. If there are multiple answers, then print any. Example 1 Input:N = 5A = [1, 2, 5, 3, 4, 3]Output3 ExplanationIn this ...