Programming Articles

Page 1726 of 2547

Minimum characters required to be removed to sort binary string in ascending order

Siva Sai
Siva Sai
Updated on 27-Oct-2023 305 Views

In computer science, string manipulation is an essential topic that involves operations such as concatenation, substring, reversing, and more. One common problem related to string manipulation is to remove all 0s from a binary string. In this article, we will discuss an algorithm to solve this problem using a minimum number of non-adjacent pair flips. Problem Statement Given a binary string, we have to remove all 0s from the string using the minimum number of non-adjacent pair flips. A flip is defined as selecting two adjacent characters and swapping them. In other words, we need to find the minimum number ...

Read More

Minimize swaps of same-indexed characters to make sum of ASCII value of characters of both the strings odd

Siva Sai
Siva Sai
Updated on 27-Oct-2023 231 Views

In this article, we delve into a fascinating problem of string manipulation and character encoding in computer science. The task at hand is to minimize the number of swaps between same-indexed characters of two strings to make the sum of ASCII values of characters in both strings odd. A robust and versatile programming language favored by many software developers. Understanding ASCII ASCII, short for American Standard Code for Information Interchange, is a character encoding standard for electronic communication. ASCII codes represent text in computers, telecommunications equipment, and other devices that use text. Problem Statement We are given two strings of ...

Read More

What is Electrical Conductivity? – Principle, Formula and Applications

Manish Kumar Saini
Manish Kumar Saini
Updated on 26-Oct-2023 2K+ Views

Electrical Conductivity is an important term used in electrical engineering to understand the behavior of a material and electric current flowing through it. Electric conductivity is the property of a material that provides ease in the flow of electric current through the material. Read this article to get a detailed understanding of "electric conductivity", from its definition to principle and its applications. Let us start with the basic definition of electrical conductivity. What is Electrical Conductivity? Electrical conductivity is defined as the property that provides ease in the flow of electric current (movement of electrons) through a material. Electrical conductivity ...

Read More

Root Mean Square Error (RMSE) in MATLAB

Manish Kumar Saini
Manish Kumar Saini
Updated on 26-Oct-2023 1K+ Views

Root Mean Square Error (RMSE) is an error estimation technique used to calculate the difference between estimated values and actual values. This method provides the average value of errors as a single value. We can use MATLAB to calculate the root mean square error. For this, MATLAB provides various built-in functions. In this tutorial, I will explain how to calculate the Root Mean Square Error (RMSE) in MATLAB. What is Root Mean Square Error (RMSE)? The root mean square error (RMSE) is a method of measuring error or accuracy of a predictive tool or model. It is calculated by finding ...

Read More

Page-wise matrix multiplication in MATLAB

Manish Kumar Saini
Manish Kumar Saini
Updated on 26-Oct-2023 522 Views

When we multiply two N-dimensional matrices along each dimension or page of the two matrices, then it is called page-wise matrix multiplication. Page-wise matrix multiplication is mainly performed in the case of 3-dimensional matrices. Go through this tutorial to learn the methods of performing page-wise matrix multiplication using MATLAB. What is Page-Wise Matrix Multiplication? When two N-dimensional matrices are multiplied along each dimension of the two matrices, then this type of matrix multiplication is called the page-wise matrix multiplication. It is basically the element wise multiplication of two 3D matrices along a specific dimension or page in a 3D matrix. ...

Read More

Matplotlib legends in subplot

Rishikesh Kumar Rishi
Rishikesh Kumar Rishi
Updated on 26-Oct-2023 29K+ Views

To add legends in a subplot, we can take the following Steps −Using numpy, create points for x, y1, y2 and y3.Create a figure and a set of subplots, using the subplots() method, considering 3 subplots.Plot the curve on all the subplots(3), with different labels, colors. To place the legend for each curve or subplot adding label.To activate label for each curve, use the legend() method.To display the figure, use the show() method.Exampleimport numpy as np from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True x = np.linspace(-2, 2, 100) y1 = np.sin(x) y2 = np.cos(x) y3 ...

Read More

How to Use & and && Operators in MATLAB?

Manish Kumar Saini
Manish Kumar Saini
Updated on 25-Oct-2023 756 Views

In MATLAB, there are various types of operators used to perform different operations. Two such operators are "&" and "&&". The "&" and "&&" operators are the logical operators used to perform element wise logical AND operations. However, they are absolutely different from each other on the basis of their behavior. Read this article to understand the basics of "&" and "&&" operators in MATLAB along with their applications in MATLAB programming. What is & Operator in MATLAB? In MATLAB, the "&" operator is an element-wise operator used to perform logical AND operation between two arrays. If we use ...

Read More

How to Use Tex (LaTeX Math Mode) Symbols in Legends and Labels in MATLAB Figures?

Manish Kumar Saini
Manish Kumar Saini
Updated on 25-Oct-2023 490 Views

MATLAB is a powerful tool to perform various mathematical tasks such as performing operations, plotting charts and figures, manipulating matrices, and more. In digital mathematical tools like MATLAB, there is a typesetting system called "TeX" which is used to communicate and publish mathematical equations and structures. This typesetting system was developed by Donald Knuth. In this tutorial, I will explain the TeX system in LaTeX math mode and the use of TeX symbols in legends and labels in a plot or figure in MATLAB. What is TeX in MATLAB? TeX is a typesetting system used to publish mathematical equations and ...

Read More

How to Write Data to Excel Spreadsheets in MATLAB?

Manish Kumar Saini
Manish Kumar Saini
Updated on 25-Oct-2023 880 Views

MATLAB provides various built-in functions that enable us to write data in the form of tables, matrices, cell arrays, etc. to an Excel file. Read this article to learn the process of writing data to Excel spreadsheets in MATLAB. The following are some commonly used methods to write data to excel spreadsheets using MATLAB − Using the "writetable" Function Using the "xlswrite" Function Using the "writematrix" Function Using the "writecell" Function Let us discuss each of these methods in detail with the help of examples. Using "writetable" Function in MATLAB In MATLAB, the "writetable" is a built-in function ...

Read More

How to Validate the Number of Function Arguments in MATLAB?

Manish Kumar Saini
Manish Kumar Saini
Updated on 25-Oct-2023 314 Views

In MATLAB, the process of ensuring that a function is executed with the correct and expected input and output arguments is termed as validating the number of function arguments. Go through this tutorial to learn how you can validate the number of function arguments in MATLAB. Validate Number of Function Arguments in MATLAB In MATLAB, we can define functions that take a specific number of input and output arguments. We need to ensure that the functions use these input and output arguments properly and also detect errors if any. Therefore, MATLAB provides a way of validating the number of arguments ...

Read More
Showing 17251–17260 of 25,466 articles
Advertisements