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
C++ Articles - Page 662 of 719
9K+ Views
To compare two strings in C++, we can use various inbuilt functions and approaches that are already discussed in the previous sections. However, there are some cases where we need to compare two strings case-insensitively, meaning that we need to ignore the case of the characters in the strings while comparing them. In this article, we will focus on learning how to compare two strings case-insensitively in C++. Here is a list of approaches for case-insensitively string comparison, which we will be discussing in this article with stepwise explanation and complete example codes. ... Read More
3K+ Views
The string library provides several functions to manipulate and match strings. In this article, we will see how the various functions of string library functions can be used to match strings in C++. String Matching in C++ String matching is a process of locating one string in another string. Meaning, here we will find the position of a string inside another string. The string matching functions will return the position of the first occurrence of the substring in the main string. If the substring is not found, it will return a special value such as -1 or string::npos. ... Read More
491 Views
Here, we will see how to use Wagner and Fisher algorithm for string matching in C++. Using this algorithm, we can find how many minimum changes are required to match those strings. Wagner Fisher Algorithm Wagner Fisher is a dynamic programming algorithm that is used to find the minimum edit distance or levenshtein distance between two input strings. Levenshtein distance between two strings means the number of changes (ie, insertion, deletion or updation) required to convert one string into another. In simpler words, this algorithm will calculate a minimum number of changes required to convert ... Read More
5K+ Views
C++ provides multiple ways to concatenate strings. Macro string concatenation is one of such way. In this article, we will learn how to use C++ preprocessor macros to concatenate strings and tokens. Understanding Macros in C++ In C++, macros are small pieces of code that are defined using the preprocessor directive #define. Macros are generally used to define variables, constants, functions, and other code blocks. When the code is compiled, the preprocessor replaces every occurrence of the macro with its defined value before actual compilation begins. Let's see an example of a macro definition and its usage. // ... Read More
4K+ Views
The Depth-First Search (DFS) is a graph traversal algorithm that starts at root node and explores as far as possible along each branch before moving to next branch. In this article, we will discuss how to check the connectivity of a graph using DFS traversal algorithm. Understanding Connectivity of a Graph A graph is said to be connected if there is a path between every pair of vertices. To check connectivity of a graph, we will try to traverse all nodes using any traversal algorithm. After completing the traversal, if there is any node, which is not visited, then ... Read More
833 Views
The Breadth-First Search (BFS) algorithm is a graph traversal algorithm that starts at the tree root and explores all nodes at the present depth before moving to the nodes at the next level. In this article, we will discuss how to check the connectivity of a directed graph using BFS traversal algorithm. Understanding Connectivity of a Graph A graph is said to be connected if there is a path between every pair of vertices. To check connectivity of a graph, we will try to traverse all nodes using any traversal algorithm. After completing the traversal, if there is any ... Read More
1K+ Views
The Breadth-First Search (BFS) algorithm is a graph traversal algorithm that starts at the tree root and explores all nodes at the present depth before moving to the nodes at the next level. In this article, we will discuss how to check the connectivity of a graph using BFS traversal algorithm. Understanding Connectivity of a Graph A graph is said to be connected if there is a path between every pair of vertices. To check connectivity of a graph, we will try to traverse all nodes using any traversal algorithm. After completing the traversal, if there is any ... Read More
2K+ Views
What is Linked List? A linked list is a linear data structure which can store a collection of "nodes" connected together via links i.e. pointers. Linked lists nodes are not stored at a contiguous location, rather they are linked using pointers to the different memory locations. A linked list can be used for graph representations. In the graph representation: Each vertex has its own linked list that stores its adjacent vertices. This forms an adjacency list using linked lists instead of vectors or arrays. Graph The image below ... Read More
4K+ Views
What is Adjacency List? An adjacency list is a collection of unordered lists that are used to represent a finite graph. Each list in the collection represents one of the vertex of the graph and it will store the adjacent vertices of that vertex. Let's see an example: Graph The image below represent a simple undirected graph with 6 vertices and 8 edges. Adjacency List The adjacency list of the above graph is shown below. Algorithm The following are the steps to create (represent) a graph using an adjacency list: ... Read More
2K+ Views
What is incidence matrix? An incidence matrix is a mathematical representation of a graph that shows the relationship between vertices and edges. In other words, it is a matrix M of size v x e, where v = number of vertices and e = number of edges. For example, if the graph has an edge number n from vertex i to vertex j, then in the incidence matrix at ith row and nth column it will be 1. Graph The image below represent a simple undirected graph with 6 vertices and 8 edges. Incidence Matrix The incidence ... Read More