Hafeezul Kareem has Published 344 Articles

Find A and B from list of divisors in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 01-Feb-2021 11:42:59

90 Views

In this tutorial, we are going to solve the below problem.Given an array of integers, we have to find two numbers A and B. All the remaining numbers in the array are the divisors of A and B.If a number is a divisor of both A and B, then it ... Read More

Find (a^b)%m where ‘a’ is very large in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 01-Feb-2021 11:42:43

144 Views

In this tutorial, we are going to solve the equation (ab)%m where a is a very large number.The equation (ab)%m=(a%m)*(a%m)...b_times. We can solve the problem by finding the value of a%m and then multiplying it b times.Let's see the steps to solve the problem.Initialize the numbers a, b, and m.Write ... Read More

Final string after performing given operations in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 01-Feb-2021 11:42:25

147 Views

In this tutorial, we are going to solve the following problem.Given a string containing only characters a and b, our task is to delete the sub-string ab from the string. And print the remaining string.Here, the idea is very simple to solve the problem. Every string with only a's and ... Read More

Create new linked list from two given linked list with greater element at each node in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 28-Jan-2021 07:05:45

2K+ Views

In this tutorial, we are going to write a program that creates a new linked list from the given linked lists.We have given two linked lists of the same size and we have to create a new linked list from the two linked lists with the max numbers from the ... Read More

Create a new string by alternately combining the characters of two halves of the string in reverse in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 28-Jan-2021 07:02:14

101 Views

In this tutorial, we are going to write a program that creates a new string by alternately combining the characters of the two halves of the string in reverse order.Let's see the steps to solve the problem.Initialize the string.Find the length of the string.Store the first half and second half ... Read More

Create a mirror tree from the given binary tree in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 28-Jan-2021 07:01:28

2K+ Views

In this tutorial, we are going to reflect the given binary tree.Let's see the steps to solve the problem.Write a struct node.Create the binary tree with dummy data.Write a recursive function to find the mirror of the given binary tree.Recursively call the function with left and right nodes.Swap the left ... Read More

Create a linked list from two linked lists by choosing max element at each position in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 28-Jan-2021 06:58:49

2K+ Views

In this tutorial, we are going to write a program that creates a new linked list from the given linked lists.We have given two linked lists of the same size and we have to create a new linked list from the two linked lists with the max numbers from the ... Read More

Double Tree with examples in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 28-Jan-2021 06:56:58

184 Views

In this tutorial, we are going to learn how to double the given tree.Let's see the steps to solve the problem.Create node class.Initialize the tree with dummy data.Write a recursive function to double the tree.Recursively traverse through the tree.Store the left node in a variable.After traversing add the data by ... Read More

Double the first element and move zero to end in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 28-Jan-2021 06:56:02

79 Views

In this tutorial, we are going to write a program that doubles the first element and moves all the zeroes to the end of the given array.We have to double a number when there are tow the same elements in adjacent indices. After that, we have to add a zero ... Read More

Double ended priority queue in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 28-Jan-2021 06:53:07

463 Views

In this tutorial, we are going to create a double-ended priority queue using the set in c++.Let's see the steps to create a double-ended queue.Create a struct with a name as you wish.Create a variable for the queue using the set.size method that returns the size of the queue.is_empty method ... Read More

Advertisements