- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 7404 Articles for C++
307 Views
Pathfinding algorithms are based on graph search techniques that study paths between nodes, starting with one node and progressing via connections until the objective is attained. In this post, we'll talk about weighted graphs and how to calculate the monotonic shortest route between source and end node in a directed weighted graph. What Are Weighted Graphs? A weighted graph combines a graph with a weight function. That is, it assigns an integer weight to every edge. There are multiple uses for edge weights for a graph − Network Connection Latency Road Network Distances The Strength of a social network interaction ... Read More
68 Views
Algorithms concerning graph search algorithms traverse a graph in pursuit of broad discovery or targeted search. These algorithms cut pathways across the network, but no one expects those paths to be computationally optimum. Pathfinding algorithms are assembled on graph search techniques as well as these investigate pathways amongst vertices, beginning at a specific node and going via connections till the goal is visited. What Are Graphs? Graphs are data structures that reflect "connections" among sets of components. These items are known as nodes. Edges are the connections between nodes. Shortest Path The Shortest Path algorithms locate the shortest paths or ... Read More
254 Views
In this article, we'll examine a C++ procedure for ascendingly sorting an array of numerical string values. Sorting is a basic operation that entails organizing elements in a predetermined order. Because they are character-based strings that represent numbers, and these numerical strings provide a special set of challenges when it is related to sorting. The issue statement, a method and algorithm for solving it, a C++ implementation, a complexity reasoning of the provided approach, and a summary of the main points will all be covered. Problem Statement Consider a vector containing numerical strings, the aim is to arrange them in ... Read More
70 Views
This article offers a thorough method for creating a lexicographically short N−length number string, where each digit must have an odd count. We offer an in−depth explanation of the problem statement, suggest a successful algorithmic strategy, and put it into practice using C++. The efficiency of the solution is revealed by the complexity analysis, and the accuracy and efficacy of the method are illustrated by an explanation using a test scenario Problem Statement Given a positive integer N, the task is to generate the smallest numeric string of size N which follows the lexicographical order, where each digit in the ... Read More
63 Views
Finding the largest number that can be produced by concatenating K numbers from a given array is an exciting problem in the area of numerical manipulation and algorithmic difficulties. The sequence of concatenation must be carefully considered in this challenge because it affects the largest number's value. The complexity of the "Maximum Possible Number with Concatenations of K Numbers from a Given Array" problem is explored in this article. We will investigate a step-by-step method, and look at the C++ algorithmic implementation. By the end of this article, readers will have a thorough understanding of how to approach this issue ... Read More
66 Views
When dealing with string manipulation problems, it's common to encounter scenarios where we need to transform a given string into a specific pattern or format. One such problem is making a palindrome binary string with a certain number of '0's and '1's while replacing wildcard characters represented by '?'. In this article, we will explore an efficient algorithmic approach to solve this problem using C++. We'll discuss the problem statement, and its approach, and analyze the time and space complexity of the algorithm. Problem Statement Given a string consisting of '0's, '1's, and wildcard characters '?', we need to convert ... Read More
46 Views
The analysis and manipulation of strings are fundamental operations in many applications of computer programming. Counting subsequences with the pattern "01" in a string formed by repetitively concatenating a given numeric string poses an interesting challenge. The primary question is determining the total count of such subsequences in the resulting string. This article discusses a useful C++ approach to solve this issue successfully and offers a solid answer to deal with this particular work. Concept of Subsequence A subsequence is a sequence of characters that is derived from some other sequence by eliminating zero or more characters without altering the ... Read More
108 Views
In order to find the single−digit sum of the alphabetical values of a string, we will explore the alphabetical values of a string and assign numerical values to letters of the alphabet. We will jump into the concept and an example to illustrate the steps involved, the algorithm behind this process, an example code implementation in C++, and finally a brief conclusion involving the significance of this technique. Concept The idea rotates around associating numerical values with each letter and performing arithmetic operations to calculate the single−digit sum i.e. 'A'=1 or 'a'=1, 'B'=2 or 'b'=2, and so on. By converting ... Read More
49 Views
In this problem, we will count the maximum number of 10 and 01 pairs that can be formed using the given binary string. To solve the problem, we can check the number of 10 and 01 pairs we can form using adjacent characters without sharing any characters in two pairs. Problem Statement We have given a bin_str binary string. We need to count the maximum number of 10 and 01 pairs we can make using the adjacent characters only. Also, we can use one character in any single pair. Two pairs can't share a single character. Sample Examples Input ... Read More
37 Views
In this problem, we will find the index value for each pair such that the resultant pair's average value is just greater than the current pair's average value. To solve the problem, we will use the sorting algorithm and binary search technique. We will use a sorting algorithm to sort the array based on the pair's average value and a binary search algorithm to search a pair with a greater average value from the sorted array. Problem Statement We have given a pairs[] array containing the N pairs of positive integers. It is also given that the first element of ... Read More