Prove that Every 2-Connected Graph Contains at least One Cycle

In this post, we will be show how every 2-connected graph contains atleast one cycle. First, we will discuss what exactly is a 2-connected graph. A connected graph is said to be 2-connected if it contains more than 2 vertices and the graph remains connected if fewer than 2 vertices are removed from the graph. … Read more Prove that Every 2-Connected Graph Contains at least One Cycle

C/C++ Program to count the number of articles in a string

Write a program to count the number of articles in a string in C/C++. Example, Input An apple a day keeps the doctor away Output Number of “a” = 1 Number of “an” = 1 Number of “the” = 1 There are 3 articles in the English language – “a”, “an” and “the”. The problem … Read more C/C++ Program to count the number of articles in a string

C/C++ Program to count the number of vowels and consonants in a string using pointers

Write a program in C/C++ to count the number of vowels and consonants in a string using pointers. Example, Input MyNameIsJohnSmith Output Consonants: 12 Vowels: 5 Steps Let str[] be the input string. Initialize c1 = 0 and c2 = 0. c1 stores the number of consonants and c2 stores the number of vowels. Read … Read more C/C++ Program to count the number of vowels and consonants in a string using pointers

C Program to count the number of unique characters in a string

Write a program to count the number of distinct characters in a string in C/C++. Example, Input Willingly Output 6 Before we move further, we should know that there is a total of 128 characters in C/C++. Each character is represented by a unique integer value in the range [0, 127]. This numeric value is … Read more C Program to count the number of unique characters in a string

C Program to swap the first and last character of a string

Write a program to swap the first and last character of a string in C. Example, Input: HelloWorld Output: delloWorlH Let str[] be the input string of size n. The first character of str[] is given by str[0]. The last character of str[] is given by str[n-1]. We can find the value of n using … Read more C Program to swap the first and last character of a string