Found 27104 Articles for Server Side Programming

How to Check if a given Matrix is a Markov Matrix using Python?

Aditya Varma
Updated on 17-Aug-2023 18:45:04

123 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

How to check Idempotent Matrix in Python?

Aditya Varma
Updated on 17-Aug-2023 18:41:56

73 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

Check Horizontal and Vertical Symmetry in the Binary Matrix using Python

Aditya Varma
Updated on 17-Aug-2023 18:39:16

191 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

Python - K difference index Pairing in List

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:23:22

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

Python - Filter Tuples with All Even Elements

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:14:59

167 Views

The problem statement allows us to determine the position of the desired string in the list, which can be useful for various purposes, such as accessing or manipulating elements at that specific index. In Python, we have some built-in functions like reduce(), str(), filter(), lambda, and, all() that will be used to Find Index Containing String in List. Syntax The following syntax is used in the examples- reduce() This function is defined under the functools module str() This is a built-in method in Python that can convert the specified value into a string. filter() The ... Read More

Program to check if a String in Java contains only whitespaces

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:10:38

2K+ Views

The whitespaces of JAVA represent either an empty string or an escape sequence character. In Java, we have some built-in functions such as isEmpty(), lenThe whitespaces of JAVA represent either an empty string or an escape sequence character. In Java, we have some built-in functions such as isEmpty(), length(), isWhitespace(), and, charAt() that will be used to check if a String in Java contains only whitespaces. The whitespaces in the program are only used for formatting purposes such as (new line), \t(horizontal tab), \v(vertical tab), etc. Syntax The following syntax is used in the examples- isEmpty() The built-in function ... Read More

Check if a Word is Present in a Sentence

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:05:20

594 Views

A sentence is a group of words that are present in a string. In this problem statement, we need to set a specific word and check whether the word is present in a given string or not. In C++, we have some pre-defined functions such as find(), npos(), and istringstream() will be used to Check if a word is present in a sentence. Using Standard library Function The program uses a standard library function that allows the programmer to use pre-existing functions of the C compiler such as find() and npos() to perform certain tasks. Syntax The following syntax is ... Read More

Check if a number with even number of digits is palindrome or not

Tapas Kumar Ghosh
Updated on 17-Aug-2023 18:02:54

186 Views

The palindrome refers to same number when the digits are reversed. In this program, we need to set the condition and operation based on an even number of digits to identify whether the given input satisfied for palindrome or not. In C++, we have STL(Standard template library) functions such as to_string(), length(), rbegin(), rend(), and, push_back() will be used to Check if a number with an even number of digits is palindrome or not. For example- 2662, 42124, 44, 888, etc are satisfied for even digit palindrome numbers. Using for loop and if-else statement The program uses for loop to ... Read More

Python - K List Dictionary Mesh

Tapas Kumar Ghosh
Updated on 17-Aug-2023 17:58:41

68 Views

The term dictionary Mesh is defined by storing the value pair of every key set to dictionary. To include the K list in the dictionary means to insert the list as value pair. In Python, we have some built-in functions such as defaultdict() and lambda will be used to solve the K list dictionary Mesh. Let’s take an example of this. Given input list, list1 = [10, 20, 30] list2 = [40, 50] The final output becomes: {10: {40: [], 50: []}, 20: {40: [], 50: []}, 30: {40: [], 50: []}} Syntax The following syntax is used ... Read More

Python Tensorflow - tf.keras.Conv2D() Function

Parth Shukla
Updated on 17-Aug-2023 16:40:23

469 Views

Introduction In deep learning, computer vision is one of the most important fields which is used for many complex and advanced tasks related to image datasets. It is used for image analysis, object detection, segmentations, etc. This is mainly achieved with the combination of TensorFlow and Keras, which offers several inbuilt functions which automate and make the process of model training very easy. The Conv2D is also one of the most useful and powerful functions in the Keras library, which is used for applying convolutional operations to the image. In this article, we will discuss the Conv2D function ... Read More

Advertisements