Articles on Trending Technologies

Technical articles with clear explanations and examples

C++ Program to find out how many movies an attendee can watch entirely at a Film festival

Arnab Chakraborty
Arnab Chakraborty
Updated on 20-Oct-2021 554 Views

Suppose there is a film festival going on that showcase various movies from various countries. Now, an attendee wants to attend the maximum number of movies that do not overlap with each other and we have to help them to find out how many movies they can attend.There is a structure Movie that has the following members βˆ’The beginning time of the movie.The duration of the movie.The ending time of the movie.There is another structure Festival with the following members βˆ’The number of movies at the festival.An array of type Movie whose size is similar to the number of movies ...

Read More

Units and Significance of Synchronizing Power Coefficient

Manish Kumar Saini
Manish Kumar Saini
Updated on 19-Oct-2021 2K+ Views

Units of Synchronizing Power Coefficient (𝑷𝐬𝐲𝐧)Generally, the synchronizing power coefficient is expressed in Watts per electrical radian, i.e., $$\mathrm{𝑃_{syn} =\frac{𝑉 𝐸_{𝑓}}{𝑋_{𝑠}}cos\:𝛿 \:\:Watts/electrical\:radian …(1)}$$$$\mathrm{∡ \:πœ‹\:radians = 180\:degrees}$$$$\mathrm{\Rightarrow\:1\:radian =\frac{180}{πœ‹}\:degrees}$$$$\mathrm{∡ \:𝑃_{syn}=\frac{𝑑𝑃}{𝑑𝛿}\:\:Watts/ \left(\frac{180}{πœ‹}\:degrees \right)}$$$$\mathrm{\Rightarrow\:𝑃_{syn}=\left( \frac{𝑑𝑃}{𝑑𝛿}\right)\left(\frac{πœ‹}{180}\right)\:\:Watt/electrical\:degree …(2)}$$If p is the total number of pole pairs in the machine, then$$\mathrm{πœƒ_{electrical} = 𝑝 \cdot πœƒ_{mechanical}}$$Therefore, the synchronizing power coefficient per mechanical radian is given by, $$\mathrm{𝑃_{syn} = 𝑝 \cdot\left( \frac{𝑑𝑃}{𝑑𝛿}\right)\:\:Watts/mech. radian …(3)}$$And, the synchronizing power coefficient per mechanical degree is given by, $$\mathrm{𝑃_{syn} =\left( \frac{𝑑𝑃}{𝑑𝛿}\right)\left(\frac{𝑝\:πœ‹}{180}\right)\:Watts/mech.degree …(4)}$$Significance of Synchronizing Power CoefficientThe synchronizing power coefficient ($𝑃_{syn}$) is the measure of the stiffness of the electromagnetic coupling between the stator ...

Read More

Program to express a positive integer number in words in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 19-Oct-2021 461 Views

Suppose we are given a positive integer number. We have to spell the number in words; like if a number "56" is given as input the output will be "Fifty-Six". The range of conversion is up to a billion.So, if the input is like input = 5678, then the output will be Five Thousand Six Hundred Seventy-Eight.To solve this, we will follow these steps βˆ’Define an array β€˜numbers’ that contain pairs such as βˆ’ {{"Billion", 1000000000}, {"Million", 1000000}, {"Thousand", 1000}, {"Hundred", 100}, {"Ninety", 90}, {"Eighty", 80}, {"Seventy", 70}, {"Sixty", 60}, {"Fifty", 50}, {"Forty", 40}, {"Thirty", 30}, {"Twenty", 20}, {"Nineteen", 19}, ...

Read More

Program to find out the k-th smallest difference between all element pairs in an array in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 19-Oct-2021 492 Views

Suppose we are given a list containing several integer numbers. We have to find out the difference between each pair of values in the array and find out the k-th smallest difference number. The index starts at 0 and the value k is given to us as input.So, if the input is like numbers = {2, 6, 4, 8}, k = 2, then the output will be 2.The differences between the pairs are βˆ’(2, 6) = 4(2, 4) = 2(2, 8) = 6(6, 4) = 2(6, 8) = 2(4, 8) = 4If we sort the values, it becomes 2, 2, ...

Read More

Program to decode a given message in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 19-Oct-2021 1K+ Views

Suppose we are given an encoded message that is a string of integer numbers. Now, these integer numbers can be mapped to a specific letter in the alphabet. a is mapped to 1, b is mapped to 2, c is mapped to 3, and so on. There is also a character '*' that can be in the message and that can be mapped to any of the numbers from 1 to 9. So given a message 'input', we have to find out how many ways it can be decoded.So, if the input is like input = "18", then the output ...

Read More

Program to find out the cost to merge an array of integers into a single value in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 19-Oct-2021 258 Views

Suppose we are given an array arr that contains n positive integer numbers. We are also given an integer number j. The task we have to perform is to merge j numbers into a single number by adding them. The cost of merging is equal to the addition of the j numbers we have selected. We have to find out the minimum possible cost for this merging operation.So, if the input is like arr = [2, 5, 6, 2, 3, 1, 3], j = 4, then the output will be 31.Cost to merge 2, 3, 1, 3 is equal to ...

Read More

Program to find out the number of non-zero submatrices in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 16-Oct-2021 580 Views

Suppose we are given a matrix that contains only two values; 1s and 0s. We have to find out the number of submatrices in the given matrix that contains all 1s. We print the value as output.So, if the input is like0010010001011101then the output will be 12.To solve this, we will follow these steps βˆ’n := size of matrixm := size of matrix[0]Define an array add of size: n+1 x m+1.for initialize i := 0, when i < n, update (increase i by 1), do βˆ’for initialize j := 0, when j < m, update (increase j by 1), do ...

Read More

Program to find minimum cost to connect each Cartesian coordinates in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 16-Oct-2021 406 Views

Suppose we have a list of 2D Cartesian coordinate points (x, y). We can connect (x0, y0) and (x1, y1), whose cost is |x0 - x1| + |y0 - y1|. If we are allowed to connect any number of points, we have to find the minimum cost necessary such that every point is connected by a path.So, if the input is like points = [[0, 0], [0, 2], [0, -2], [2, 0], [-2, 0], [2, 3], [2, -3]], then the output will be 14 because, from (0, 0) to (0, 2), (0, -2), (2, 0), (-2, 0), costs are 2, ...

Read More

Pitch Factor, Distribution Factor, and Winding Factor for Harmonic Waveforms

Manish Kumar Saini
Manish Kumar Saini
Updated on 13-Oct-2021 4K+ Views

When the flux density distribution in the alternator is non-sinusoidal, the induced voltage in the winding will also be non-sinusoidal. Thus, the pitch factor or coil span factor, distribution factor and winding factor will be different for each harmonic voltage.Pitch Factor for nth HarmonicAs the electrical angle is directly proportional to the number of poles and the angle between the adjacent slots, i.e., $$\mathrm{πœƒ_{𝑒} =\frac{𝑃}{2}πœƒ_{π‘š} … (1)}$$The chording angle increases with an increase in the order of the harmonics (n). In a short pitch coil, the chording angle is Ξ±Β° (electrical) for the fundamental flux wave. For the nth harmonic, ...

Read More

C++ program to demonstrate function of macros

Arnab Chakraborty
Arnab Chakraborty
Updated on 12-Oct-2021 605 Views

Suppose we are given a integer array that contains several integer values. We have to find out the difference between the smallest value and the largest value in the array. To solve this problem, we have to use macros. The inputs are taken from stdin, and the result is printed back to stdout.So, if the input is like array = {120, 589, 324, 221, 234}, then the output will be The answer is : 469The difference between the largest value 589 and the smallest value 120 is 469.To solve this, we will follow these steps βˆ’mini := infinitymaxi := negative ...

Read More
Showing 48061–48070 of 61,299 articles
Advertisements