Articles on Trending Technologies

Technical articles with clear explanations and examples

Tutorix - AI Tutor

Minimum number of stops from given path in C++

Narendra Kumar
Narendra Kumar
Updated on 11-Mar-2026 257 Views

Problem statementThere are many points in two-dimensional space which need to be visited in a specific sequence.Path from one point to other is always chosen as shortest path and path segments are always aligned with grid lines.We are given the path which is chosen for visiting the points. We need to tell the minimum number of points that must be needed to generate given paths.Algorithm1. We can solve this problem by observing the pattern of movement when visiting the stop 2. If we want to take the shortest path from one point to another point, then we will move in ...

Read More

Type Conversion in C++

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

Here we will see what are the type conversion techniques present in C++. There are mainly two types of type conversion. The implicit and explicit.Implicit type conversionThis is also known as automatic type conversion. This is done by the compiler without any external trigger from the user. This is done when one expression has more than one datatype is present.All datatypes are upgraded to the datatype of the large variable.bool -> char -> short int -> int -> unsigned int -> long -> unsigned -> long long -> float -> double -> long doubleIn the implicit conversion, it may lose ...

Read More

Convert Hexadecimal value String to ASCII value String in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 2K+ Views

In this tutorial, we will be discussing a program to convert hexadecimal value string to ASCII value string.For this we will be provided with a string with some hexadecimal values. Our task is to get that hexadecimal value and convert it into equivalent ASCII values.Example#include using namespace std; string convert_ASCII(string hex){    string ascii = "";    for (size_t i = 0; i < hex.length(); i += 2){       //taking two characters from hex string       string part = hex.substr(i, 2);       //changing it into base 16       char ch = stoul(part, nullptr, 16);       //putting it into the ASCII string       ascii += ch;    }    return ascii; } int main(){    cout

Read More

Minimum removal to make palindrome permutation in C++

Narendra Kumar
Narendra Kumar
Updated on 11-Mar-2026 342 Views

Problem statementGiven a string S, we have to find minimum characters that we can remove to make any permutation of the string S a palindromeExampleIf str = “abcdba” then we remove to 1 character i.e. either ‘c’ or ‘d’.Algorithms1. There can be two types of a palindrome, even length, and odd length palindromes 2. We can deduce the fact that an even length palindrome must have every character occurring even number of times 3.An odd palindrome must have every character occurring even number of times except one character occurring odd number of time 4. Check the frequency of every character ...

Read More

Printing Pyramid in C++

Ajay yadav
Ajay yadav
Updated on 11-Mar-2026 541 Views

This article yields a “pyramid-like structure” as an output using the C++ programming code. In which the pyramid height and space are being determined by traversing double for loop constructs as following;Example#include using namespace std; int main() {    int space, rows=6;    for(int i = 1, k = 0; i

Read More

Convert min Heap to max Heap in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 833 Views

In this tutorial, we will be discussing a program to convert min heap to max heap.For this we will be provided with the array representation of the min heap. Our task is to convert that given min heap to max heap in O(n) time complexity.Example#include using namespace std; //converting a given subtree into a heap void convert_arrayheap(int arr[], int i, int n){    int l = 2*i + 1;    int r = 2*i + 2;    int largest = i;    if (l < n && arr[l] > arr[i])       largest = l;    if (r < ...

Read More

Minimum removals from array to make max – min <= K in C++

Narendra Kumar
Narendra Kumar
Updated on 11-Mar-2026 474 Views

Problem statementGiven N integers and K, find the minimum number of elements that should be removed such that Amax - Amin

Read More

Construct a frequency array of digits of the values obtained from x^1, x^2, ....., x^nn in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 208 Views

Suppose we have two integers x and n. We have to find the array such that it contains the frequency of index numbers occurring in (x^1, x^2, … x^(n – 1), x^n). So if x = 15 and n = 3, then output will be [0, 1, 2, 2, 0, 3, 0, 1, 0, 0]. As we know that x^1 to x^n, the values are 15, 225 and 3375. So the frequency array is 0, 1, 2, 2, 0, 3, 0, 1, 0, 0To solve this, we will follow these steps −Maintain the frequency count array to store the counts ...

Read More

Construct a graph from given degrees of all vertices in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 418 Views

Suppose we have a list of vertices, and their degrees are given. We have to generate one undirected graph from that degree sequence. It will not include loop or multiple edges. So if the degree sequence is like [2, 2, 1, 1], then the graph can be likeTo solve this, we will follow these steps −Define adjacency matrix adj to store the graphfor each vertex i, dofor each vertex j that is valid, and next to iif the degree of vertex i and j are more than zero, then connect themdisplay the matrix.Example#include #include using namespace std; void ...

Read More

Convert singly linked list into circular linked list in C++

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 672 Views

In this tutorial, we will be discussing a program to convert a singly linked list into circular linked list.For this we will be provided with a singly linked list. Our task is to take the elements of that list and get it converted into a circular linked list.Example#include //node structure of linked list struct Node {    int data;    struct Node* next; }; //converting singly linked list //to circular linked list struct Node* circular(struct Node* head){    struct Node* start = head;    while (head->next != NULL)       head = head->next;    //assigning start to the ...

Read More
Showing 28131–28140 of 61,297 articles
Advertisements