- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 34494 Articles for Programming
42 Views
In Python, a set is an unordered collection of unique elements, represented by {}. It allows efficient membership testing and eliminates duplicate values, making it useful for tasks such as removing duplicates or checking for common elements between sets. In this article, we will learn how to access the K element in a set without deletion in python. Example Assume we have taken an input set and K element. We will now find the index of that K element in an input set using the above methods. Input inputSet = {3, 9, 5, 1, 2, 8} k=5 Output The ... Read More
163 Views
String consonants refer to the non-vowel sounds produced when pronouncing a string of characters or letters. In this article, we are going to study how to reverse only the consonants in a string without affecting the position of other elements using the following 2 methods in Python: Using append() and join() functions Using pop() function and string concatenation Example Before Reversing : tutorialspoint After Reversing: tunopiaslroitt Algorithm (Steps) Following are the Algorithm/steps to be followed to perform the desired task –. The function checkConsonant(char) is defined to check if a character is a consonant ... Read More
127 Views
In this article we are going to learn how to check whether the input matrix is a Markov Matrix using nested for loops and sum() function. Before that let us understand what is Markov Matrix with an example? The matrix is said to be a Markov matrix if the sum of each row is equal to 1. Example [ [ 0, 1, 0 ], [ 0, 0.3, 0.7 ], [ 0, 0, 1 ]] In the above example, the sum of each row is 1. Hence the above matrix is an example of a Markov ... Read More
80 Views
If a matrix produces the same matrix when multiplied by itself, it is said to be an idempotent matrix. If and only if M * M = M, the matrix M is considered to be an idempotent matrix. Where M is a square matrix in the idempotent matrix. Matrix M: 1 0 0 0 1 0 0 0 0 Performing M*M 1 0 0 * 1 0 0 = 1 0 0 0 1 0 0 1 0 ... Read More
203 Views
A binary matrix is a rectangular grid in which each element is either 0 or 1, indicating true or false states. It is widely employed to represent relationships, connectivity, and patterns across various disciplines Assume we have taken a 2D binary input matrix containing N rows and M columns. T. We will now check whether the input matrix is horizontal or vertically symmetric or both using the below method. If the first row matches the last row, the second row matches the second last row, and so on, the matrix is said to be horizontally symmetric. If the first ... Read More
118 Views
BigDecimal is a class in Java's java.math package that provides arbitrary-precision decimal arithmetic. It allows precise decimal calculations without the loss of precision that can occur with floating-point arithmetic. BigDecimal objects are immutable, so any arithmetic operation on them creates a new object with the result of the operation. Primitive data types in Java are the basic building blocks of data in the language. They include int, double, Boolean, char, and others, and represent simple values like integers, floating-point numbers, and boolean values. They are stored directly in memory and are not objects, so they have lower memory overhead ... Read More
75 Views
The K is the special number that set the sum of the difference values starting with 0th index. For example, if k = 3 it means the 0th index added with K and finds the exact pairs. In Python, we have some built-in functions such as str(), len(), and append() will be used to solve the K difference index pairing in list. Let’s take an example of list. The given list, [“A”, “B”, “C”, “D”, “E”, “F”] Then the K value set to 1 The final output pair the index as [“AC”, “BD”, “CE”, ... Read More
81 Views
In Java, a matrix can be represented using a two-dimensional array. Matrices are used for storing and manipulating data that have a tabular structure. Matrices have several properties and operations associated with them, such as addition, subtraction, multiplication, transposition, and determinant calculation. As per the problem statement we have to add sum of all individual rows and columns. Then we need to perform the difference between these added rows and columns and display the result. Let's start! For instance Suppose the original matrix is: {4, 2, 1}, {3, 5, 6}, {8, 9, 7} After performing ... Read More
112 Views
The N number is the special number of integer type that calculates the individual digit of sum. So, this sum will be divisible by its own number. Let’s take an example of this. The given integer number, N = 36 The sum of each digit, 3 + 6 = 9 Therefore, 36 is successfully divisible by 9 and it verifies for N divides it. Algorithm The following steps are- Step 1: We will start the program by mentioning the header file iostream. Step 2: Common Matches:- Then used the function definition digit_sum() that accepts the parameter a variable n ... Read More
2K+ Views
Python’s Pandas DataFrame defines the two-dimensional structure that consists of rows and columns. The main feature of pandas is an easier way of handing the given data. In Python, we have some in-built functions such as to_datetime(), sorted(), lambda, and, sort_value() will be Sort a Pandas DataFrame by Date. Syntax The following syntax is used in the examples- to_datetime() The to_datetime() is an in-built function in Python that convert string dates into date-time objects. sorted() The built-in function sorted() of Python states that the list can be sort as specified iterable objects. lambda This lambda function in ... Read More