Found 7401 Articles for C++

Palindrome by swapping only one character

Rudradev Das
Updated on 27-Dec-2023 17:23:08

56 Views

In a C++ environment, the palindrome is a process where a set or string remains same from the intial stage of the process to termination of that same particular process. Assume, we have a string denoted as the str[]. And the task is to check the string will be paindrome or not after performing the swapping process with only one character for once. Here is a general example of the swapping process − Input : ARBRDD Output : true Explanation: Swap the value A(1st index present in the list) with the R. Input : INDBAN Output : true Explanation: ... Read More

Print reverse string after removing vowels

Rudradev Das
Updated on 27-Dec-2023 17:18:14

61 Views

The reverse() is a pre-installed and predefined header file, which is used to define as a template in a process in a C++ environment. The method is able to reverse the elements from last to first manner in a range for any value container. For this process the time complexity is O(n). Lets assume, we have a string or a sentance declared as str[] with some data elements and now the task is to perform reverse process after removing the vowels from that string to get the final outcome. Here is some general examples of the process method − ... Read More

Program to reverse a string (Iterative and Recursive)

Rudradev Das
Updated on 27-Dec-2023 17:14:39

54 Views

The reverse() is a pre-installed and predefined header file, which is used to define as a template in a process in a C++ environment. The method is able to reverse the elements from last to first manner in a range for any value container. For this process the time complexity is O(n). Lets assume, we have a string declared as str[] with some data elements and now the task is to perform reverse process on this string to get the final outcome. Here is a general example of the process − Input string is here : S = "ARBRDD" ... Read More

Count palindromic characteristics of a String

Rudradev Das
Updated on 27-Dec-2023 17:04:09

20 Views

In a C++ environment, the palindrome is a characteristics where we get the same value after getting the result. Assume, there is a string denoted as S and the length is N. Now we need to run an operation on that string to find the palindromic characteristic is the number of k-palindromes in a given range. Here is a general example of the process − Input for the process : abba Output by the process : 6 1 0 0 Explanation of the method: "6" 1-palindromes numbers operation = "a", "b", "b", "a", "bb", "abba". "1" 2-palindromes numbers operation ... Read More

XOR Linked List – A Memory Efficient Doubly Linked List

Divya Sahni
Updated on 03-Nov-2023 15:28:07

1K+ Views

Linked List The linked list is a linear data structure containing elements called nodes. Each node consists of two main components: data (payload of that node) and a pointer to the next node in the list. They are simple and efficient to use providing easy allocation and deallocation of memory. Doubly Linked List Doubly linked list is a special type of linked list which again consists of a basic element called nodes. Each node consists of three main components: data (payload of that node), a pointer to the previous node of the sequence and a pointer to the next ... Read More

Sort numbers stored on different machines

Divya Sahni
Updated on 03-Nov-2023 15:12:14

346 Views

In today’s world with a large amount of data and interconnected systems, a vast amount of data is created and stored across various machines. One challenging challenge is to sort this data stored across multiple devices. Sorting being a fundamental operation in computations is used for optimal retrieval, search and analysis of data. But with distributed systems and various interconnected machines, this task of sorting becomes difficult and important. Problem Statement Given an array containing N linked lists that depict N different machines. Each of these linked lists contains some variable number of numbers in sorted order. The task is ... Read More

Segment Tree | Sum of a given range

Divya Sahni
Updated on 03-Nov-2023 15:10:40

214 Views

Segment Tree A segment tree is a tree data structure used for storing intervals and segments. It is a static structure, i.e. it cannot be modified once it is built. Segment trees are used to handle range queries on an array or a similar linear data structure. In a segment tree, we divide an input array into segments and precompute the values for these segments. Each node in a segment tree depicts an interval or segment of the array. The root node represents the entire array and each child node represents the segments formed by dividing the parent node. This division leads ... Read More

Segment Tree | Range Minimum Query

Divya Sahni
Updated on 03-Nov-2023 15:06:10

272 Views

Segment Tree − A segment tree is a tree data structure used for storing intervals and segments. It is a static structure, i.e. it cannot be modified once it is built. Segment trees are used to handle range queries on an array or a similar linear data structure. In a segment tree, we divide an input array into segments and precompute the values for these segments. Each node in a segment tree depicts an interval or segment of the array. The root node represents the entire array and each child node represents the segments formed by dividing the parent node. This ... Read More

Print unique rows in a given Binary matrix

Divya Sahni
Updated on 03-Nov-2023 15:01:03

195 Views

In computer science, binary matrix holds a very strong position containing a lot of information as the data is depicted using 0’s and 1’s which is the language of computers. In binary matrix, unique row refers to a row that is not identical to any other row in the matrix. Each unique row contains unique information that is not present anywhere else in the matrix except the row itself. Discovering these unique rows give information about relationships between rows, patterns in the matrix and identification of critical elements. Problem Statement Given a binary matrix mat[] containing 0’s and 1’s. The ... Read More

Pattern Searching using Suffix Tree

Divya Sahni
Updated on 03-Nov-2023 14:57:58

223 Views

Trie − A trie is a tree-based data structure used to store and retrieve a dynamic set of strings. Compressed Trie − A compressed trie is a variation of the trie data structure used for storing and searching dynamic sets of strings. Memory usage is minimised by sharing common prefixes. In a compressed trie, nodes with only one child are merged with their parent nodes compressing the common prefixes into a single edge. Suffix Tree − A suffix tree is a data structure used in string processing to store and search for all suffixes of a given string. It represents all possible suffixes ... Read More

Advertisements