
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7241 Articles for C++

97 Views
Array insertion and reversal are one of the most common array manipulation techniques. Array manipulation aims to modify an array's contents to get a desired outcome. Problem Statement Given an input array A[]. The task is to insert the elements of the given array into an existing array where a reversal of the output array follows each insertion. Sample Example 1 − Input: A[] = {1, 2, 3, 4, 5} Output: R[] = {5, 3, 1, 2, 4} Explanation Initially, the output array R[] is empty. Insertion of 1 : R[] = {1} Insertion of 2 : ... Read More

220 Views
A string is a data structure consisting of a sequence of characters. The end of the string is marked by a special character, called a null character, which is usually represented by the ASCII code 0. Problem Statement Given a string s of a certain length, the task at hand is to print adjacent repeating characters along with the frequency of their repetition. For Example Input: s = “committee” Output: [[m, 2], [t, 2], [e, 2]] Explanation The character m occurs consecutively twice. Similarly the character t and e also occur twice consecutively. Therefore we return the vector ... Read More

258 Views
A subsequence refers to a sequence that can be obtained from another sequence by removing zero or more elements, without altering the order of the remaining elements. In simpler terms, a subsequence is derived by selecting elements from the original sequence, while preserving their relative order. For example, consider the sequence [1, 2, 3, 4]. Some possible subsequences of this sequence are: [1, 2], [1, 3, 4], [2, 4], [1, 2, 3, 4], [3], and [4]. Problem Statement The objective is to determine the minimum number of character removals from string s1 in order to eliminate any occurrence of ... Read More

204 Views
A subarray of an array is a contiguous part of the array in which we take a group of consecutive elements while also maintaining the relative ordering of elements as present in the original array. Example − Some valid subarrays are − etc. A prefix subarray is a special type of subarray that begins with the first element of the array and ends at some ith index where 0

169 Views
A matrix is a two-dimensional data structure made up of rows and columns set out like a grid of squares. Grids, multidimensional arrays, and tabular data are frequently represented using it. Problem Statement We are given a matrix of dimensions and the task is to check whether each row of the matrix consists of every number from 1 to n. The order of the numbers in the row do not matter. Return true if this statement holds true else return false. For Example Input: mtx = [[1, 2, 3], [3, 2, 1], [2, 1, 3]] Output: True ... Read More

83 Views
A binary string is a string that only has two characters, usually the numbers 0 and 1, and it represents a series of binary digits. Problem Statement Now, in this problem, we are given a binary string comprising zeros and ones. We have two conditions to keep in mind while solving the problem. First, one digit can delete another digit that is a ‘1’ can delete a ‘0’ and vice versa. Secondly, if at any moment the entire string consists of only 0’s and 1’s then the corresponding digit is printed. Here, a binary string will be the input given ... Read More

4K+ Views
Recently, graph-based representations have gained enormous popularity for simulating real-world data. Cliques are a key issue in graph theory that is used to solve numerous mathematical issues and create graphs. Cliques are extensively researched in the field of computer science, with the clique problem assessing if a clique having a certain size within a graph is NP-complete. Yet, in spite of all complexities, there has been research into several techniques for finding cliques. What Are Cliques? In all undirected graphs G = (N, E), a clique, is a "subset of the nodes", so that all pairs of distinct nodes is ... Read More

525 Views
How Do Graphs Work? A group of things that are connected is referred to as a graph. They may represent anything at all, from based on merely mathematical ideas, to real-life objects, events and occurrences. For instance, a graph represents a list of individuals with a family connection. Similarly, a network of metropolitan areas is linked together by roadways. Typically, we describe the elements of the network as nodes or vertices, while the links among them are referred to as edges or arcs. Pic 1 − Visual Representation of a Graph with Nodes and Edges Unweighted Graph: What Is ... Read More

401 Views
Even with limitless time, algorithms are unable to resolve all computer problems. The answer to NP-complete problems remains unknown. It's worth noting that when single NP-complete issue is able to be answered in polynomial time, then all others may be resolved as well. Dense Subgraph A dense subgraph is one that has numerous edges for each vertex in the theory of graphs and computer science. Clique A clique constitutes a subsection of a graph in which every vertex is linked to every other vertex, making the "subgraph" a full graph. "Maximal Clique Problem" aims for locating the largest clique in ... Read More

1K+ Views
There is no solution to "NP-complete" problems. So far, there hasn't been a polynomial time method developed for any NP-complete problem, nor has anyone shown that there isn't one. There is an intriguing fact about NP-complete problems: if one manages to be resolved under polynomial time, all are within reach. In this post, we'll prove that a problem comprising an independent set and clique is NP-Complete. Clique A clique refers to a "subgraph" of a graph in which every node is connected to one another, implying that the subsection is a complete graph. NP-Class The NP in the NP class ... Read More