Arnab Chakraborty has Published 4293 Articles

A data structure for n elements and O(1) operations?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

549 Views

Here we will see one data-structure with n elements, and O(1) operations. So the operations will take constant amount of time to execute.The data structure will hold n elements (from 0 to n-1). The data can be in any order. The Insertion, deletion and searching will take O(1) amount of ... Read More

A product array puzzle (O(1) Space) in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

184 Views

Here we will see one interesting problem related to array. There is an array with n elements. We have to create another array of n elements. But the i-th position of second array will hold the product of all elements of the first array except the i-th element. And one ... Read More

A Product Array Puzzle in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

283 Views

Here we will see one interesting problem related to array. There is an array with n elements. We have to create another array of n elements. But the i-th position of second array will hold the product of all elements of the first array except the i-th element. And one ... Read More

Absolute Difference of even and odd indexed elements in an Array (C++)?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

570 Views

Here we will see how we can get the absolute differences of odd and even indexed elements in an array. The absolute difference indicates that if the difference of one pair is negative, the absolute value will be taken. For an example, let the numbers are {1, 2, 3, 4, ... Read More

Activity Selection Problem (Greedy Algo-1) in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

2K+ Views

There are n different activities are given with their starting time and ending time. Select maximum number of activities to solve by a single person.We will use the greedy approach to find the next activity whose finish time is minimum among rest activities, and the start time is more than ... Read More

Add minimum number to an array so that the sum becomes even in C++?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

134 Views

Suppose there is an array with some numbers. We have to tell minimum how many numbers will be added with it to make the sum of the elements even. The number must be greater than 0. So if the sum of the elements is odd, we will add 1, but ... Read More

C++ Program for Common Divisors of Two Numbers?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

315 Views

Here we will see how we can get the number of common divisors of two numbers. We are not going to find all common divisors, but we will count how many common divisors are there. If two numbers are like 12 and 24, then common divisors are 1, 2, 3, ... Read More

C++ Program for GCD 0.of more than two (or array) numbers?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

191 Views

Here we will see how we can get the gcd of more than two numbers. Finding gcd of two numbers are easy. When we want to find gcd of more than two numbers, we have to follow the associativity rule of gcd. For example, if we want to find gcd ... Read More

C++ Program for Smallest K digit number divisible by X?

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

257 Views

In this problem we will try to find smallest K-digit number, that will be divisible by X. To do this task we will take the smallest K digit number by this formula (10^(k-1)). Then check whether the number is divisible by X or not, if not, we will get the ... Read More

C++ program for Solving Cryptarithmetic Puzzles

Arnab Chakraborty

Arnab Chakraborty

Updated on 30-Jul-2019 22:30:26

1K+ Views

In the crypt-arithmetic problem, some letters are used to assign digits to it. Like ten different letters are holding digit values from 0 to 9 to perform arithmetic operations correctly. There are two words are given and another word is given as answer of addition for those two words. As ... Read More

Advertisements