Found 7346 Articles for C++

Longest Subarray with GCD Greater than 1

Rudradev Das
Updated on 06-Apr-2023 15:44:17

332 Views

An array is a collection of similar data sets which stored at adjacent memory locations in a continuous manner. It makes the process easier to evaluate the particular position of each and every element by defining an offset value to the particular base value of a database. The base value of that particular index is zero and an offset is a value of the difference of two particular indexes. A subarray is a section of a particular array which can be defined as a set of variables collectively with a label of multiple values. The longest subarray means in which ... Read More

C++ Program to Find the GCDs of given index ranges in an array

Rudradev Das
Updated on 06-Apr-2023 15:19:05

276 Views

In the field of data structure, a range query is a pre-processing method to operate on some input data in an efficient manner. A range query is responsible to answer any query of the particular input on any data subset. If we want to copy some data columns from a table we need to maintain an index for that particular dataset. An index is a direct link or a key, which is designed to provide an efficient searching process in a data set. It is mainly used to speed up the data retrieving from a lost data source. In mathematics, ... Read More

C++ Program to count of array elements greater than all elements on its left and at least K elements on its right

Rudradev Das
Updated on 06-Apr-2023 15:05:31

449 Views

A string is an object, which represents a sequence of data characters. The strings are the data container which always represented as a text format. It also used to concept, compare, split, join, replace, trim, length, intern, equals, comparison, substring operation. K largest(or smallest) elements in an array using Quick Sort partitioning algorithm. Here is an array R[] with N number of distinct integers. The task is to find that particular element which are strictly greater than all the elements preceding it and strictly greater than at least K elements on its right. The problem states that an array ... Read More

C++ Program for range LCM queries

Rudradev Das
Updated on 13-Apr-2023 12:16:47

134 Views

Ranging a query is a common database current interest operation present in data structure to restore all the records where the output value lies between an upper and lower boundary. This process works with some input data, to structure them in an efficient manner on any subset of a particular input. The range function, denoted as range(), is used to iterate a for loop over a series. We need to declare the start as 0 at the beginning of a process. If somehow we miss this step, the process will run and iterate the loop until the end (-1). A ... Read More

Maximize value of coins from adjacent row and columns cannot to be collected

Rudradev Das
Updated on 05-Apr-2023 18:11:34

145 Views

Dynamic programming is an optimization algorithmic technique to solve the particular problems by splitting them into some simple sub problems. It is a procedure by which we can combine the quality, condition, or fact of a complete search for a greedy algorithm being exact and accurate. But this method is an oxymoron itself because it comes with a great advantage and that is also its biggest disadvantage and limitation too. We can divide a problem into some sub problem but we can't divide the sub problems again. They should be solvable by its own. The concept of the sub problems ... Read More

C++ Program to Count Inversions of size three in a given array

Rudradev Das
Updated on 13-Apr-2023 12:12:26

146 Views

Inversion count is a step counting method by which we can calculate the number of sorting steps taken by a particular array. It is also capable to count the operation time span for an array. But, if we want to sort an array in a reverse manner, the count will be maximum number present in that array. Array: { 5, 4, 3, 2, 1} // for the reverse manner Pairs: {5, 4}, {5, 3} , {3, 2}, {3, 1}, {2, 1}, {4, 3}, {4, 2}, {4, 1}, }, {5, 2}, {5, 1} Output: 10 Array: {1, 2, 3, 4, ... Read More

Applications, Advantages and Disadvantages of Deque

Rudradev Das
Updated on 06-Apr-2023 10:04:54

2K+ Views

Deque or double ended queue is a sequential linear collection data queue that provides the function like a double-ended queue. In this data structure the method does not follow the First In First Out (FIFO) rule for data treatment. This data structure is also known as double-ended queue because the elements are inserted to the end of the queue and removed from the front. For a deque we can add and remove data only from both ends. The time complexity of the deque operation is O(1). There are two types of deque − Input Restricted Restriction at a ... Read More

Reverse each word in a linked list Node

Rudradev Das
Updated on 05-Apr-2023 17:58:17

212 Views

A linked list is a chain alike linear data structure, where the elements are not saved at memory in an adjacent manner, unlike array. In a particular linked list, the elements are linked with the next element by a pointer. In simple words; a linked list is a series of some data containers where we can find a path way or a reference link in those elements to the next node. There is a head pointer present as the first element in a linked list. If the first node of that particular list is empty then it points nothing or ... Read More

Minimum Changes to string to make all substrings distinct

Rudradev Das
Updated on 05-Apr-2023 17:54:16

653 Views

A string is a particular object, which represents a sequence and flow of data characters. The strings are the data container which always represented as a text format. It also used to concept, compare, split, join, replace, trim, length, intern, equals, comparison, substring operation. A substring() is a data refining process, which extracts the saved data of between two positions from start to end. A substring () does not change the original string. In a data set when we have different characters, they can be denoted as distinct data elements. For example: 'a' and 'r' are distinct while 'r' ... Read More

Function to copy string (Iterative and Recursive)

Rudradev Das
Updated on 05-Apr-2023 17:52:51

374 Views

In a C++ environment, iteration statement is a compound or cause statement which can be executed zero or more than one at a time. This process is subjected to a loop termination process. The statement executes in a particular order when there is a presence of break statement or the continuation of a statement. There are four types of iteration present in C++ - While Do For Range-based for Every loops mentioned here iterates a particular condition until its termination. The expression evaluates as zero when the statement. The iteration statements can't be considered as declaration. In ... Read More

Advertisements