 
 Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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 91 of 134
 
 
			
			1K+ Views
DFA stands for Deterministic Finite Automata. It is a finite state machine that accepts or a string based on its acceptor.Here, we are going to make a DFA that accepts a string that starts and ends with a. The input is from the set (a, b). Based on this we will design a DFA. Now, Let's discuss some valid and invalid cases that are accepted by a DFA.Strings that are accepted by DFA: ababba, aabba, aa, a.Strings that are not accepted by DFA: ab, b, aabab.ExampleThis program check for a string that starts and ends with a. This DFA will ... Read More
 
 
			
			244 Views
Here we will see one problem. We have one binary array. It has n elements. Each element will be either 0 or 1. Initially, all elements are 0. Now we will provide M commands. Each command will contain start and end indices. So command(a, b) is indicating that the command will be applied from element at position a to element at position b. The command will toggle the values. So it will toggle from ath index to bth index. This problem is simple. check the algorithm to get the concept.AlgorithmtoggleCommand(arr, a, b)Begin for each element e from index a ... Read More
 
 
			
			271 Views
Here we will see the area of the biggest square that can be inscribed in an equilateral triangle. The side of the triangle is ‘a’ and the side of the square is x.The side of the triangle ‘a’ is −So x is −Example#include #include using namespace std; float areaSquare(float a) { //a is side of triangle if (a < 0 ) //if a is negative, then this is invalid return -1; float area = a / (1 + 2/sqrt(3)); return area; } int main() { float a = 7; cout
 
 
			
			119 Views
Here we will see the area of biggest Reuleaux triangle inscribed within a square. The side of the square is ‘a’. And the height of the Reuleaux triangle is h.The height of the Reuleaux triangle is same as a. So a = h. So the area of Reuleaux triangle is −Example#include #include using namespace std; float areaReuleaux(float a) { //side of square is a if (a < 0) //if a is negative it is invalid return -1; float area = ((3.1415 - sqrt(3)) * (a) * (a))/2; return area; } int main() { float side = 8; cout
 
 
			
			127 Views
Here we will see the area of biggest Reuleaux triangle inscribed within a square, That square is inscribed inside one circle. The side of the square is ‘a’. The radius of the circle is ‘r’. As we know that the diagonal of the square is the diameter of the circle. So −2𝑟 = 𝑎√2 𝑎 = 𝑟√2And the height of the Reuleaux triangle is h.The height of the Reuleaux triangle is same as a. So a = h. So the area of Reuleaux triangle is −Example#include #include using namespace std; float areaReuleaux(float r) { //radius of ciecle is ... Read More
 
 
			
			123 Views
Here we will see the area of biggest Reuleaux triangle inscribed within a square, that square is inscribed inside one right angled triangle. The side of the square is ‘a’. The height of the Reuleaux triangle is x. The base of the triangle is b, height of the triangle is l, and the hypotenuse is h.We know that the side of square inscribed in a Right angled triangle with height l and base b is −The height of the Reuleaux triangle is same as a. So a = x. So the area of Reuleaux triangle is −Example#include #include ... Read More
 
 
			
			130 Views
Here we will see the area of biggest Reuleaux triangle inscribed within a square, that square is inscribed inside one ellipse. We know that the major axis length is 2a, and the minor axis length is 2b. The side of the square is ‘x’, and the height of the Reuleaux triangle is h.We know that the side of a square inscribed in an ellipse with major axis 2a and minor axis 2b is −The height of the Reuleaux triangle is same as a. So h = x. So the area of Reuleaux triangle is −.Example#include #include using namespace ... Read More
 
 
			
			121 Views
Here we will see the area of biggest Reuleax triangle inscribed within a square which is inscribed in a regular hexagon. Suppose ‘a’ is the side of the hexagon. The side of the square is x and the height of the Reuleaux triangle is h.From the formula of each side of inscribed square inside one hexagon is −𝑥 = 1.268𝑎The height of the Reuleaux triangle is the same as x. So x = h. So the area of the Reuleaux triangle is −Example#include #include using namespace std; float areaReuleaux(float a) { //side of hexagon is a if ... Read More
 
 
			
			164 Views
Here we will see the area of biggest Reuleax triangle inscribed within a square which is inscribed in an equilateral triangle. Suppose ‘a’ is the side of the triangle. The side of the square is x and the height of the Reuleaux triangle is h.The side of the triangle is −So the value of x is −𝑥 = 0.464𝑎The height of the Reuleaux triangle is the same as x. So x = h. So the area of the Reuleaux triangle is −Example#include #include using namespace std; float areaReuleaux(float a) { //side of triangle is a if (a ... Read More
 
 
			
			117 Views
Here we will see the area of biggest Reuleax triangle inscribed within a square which is inscribed in a semicircle. Suppose the radius of the semicircle is R, are side of the square is ‘a’ and the height of the Reuleax triangle is h.We know that the side of the square inscribed in a semicircle is −The height of the Reuleaux triangle is the same as a. So a = h. So the area of the Reuleaux triangle is −Example#include #include using namespace std; float areaReuleaux(float r) { //radius of the semicircle is r if (r < ... Read More