Found 34494 Articles for Programming

Boundary Level order traversal of a Binary Tree

Shubham Vora
Updated on 25-Aug-2023 15:49:41

110 Views

In this problem, we will traverse each boundary of the given binary tree in the given order. We will use the recursive approach to traverse each boundary of the binary tree one by one. However, we will also learn the iterative approach using a stack to traverse the binary tree's boundary and increase the code's performance. Problem Statement We have given a binary tree, and we need to traverse each boundary of the tree in the given order. Traverse left boundary in top to bottom manner. Traverse bottom boundary from left to right. Traverse the right boundary from bottom ... Read More

Python – Check for float String

Pranavnath
Updated on 25-Aug-2023 16:06:02

401 Views

The strings consist of characters and to transform them into float data type, Python facilitates us with various methods using the inbuilt function. With the help of these inbuilt functions, we can check for the float strings easily. In this article, the user will learn how to check whether a string contains a float value. To achieve this, three strategies are demonstrated to verify float string. Isdigit() method is also used to check if the given string has only digits. Then the count() and replace() are used to check if the string contains decimal values and other characters of the ... Read More

Blackman in Python Numpy

Pranavnath
Updated on 25-Aug-2023 15:58:19

164 Views

Introduction In signal processing and spectral analysis, window functions play a vital part in forming and modifying signals. The Blackman window is a commonly utilized window function in signal processing that makes a difference decrease spectral leakage effects. It is actualized in Python utilizing the effective NumPy library, which gives effective cluster operations and scientific capacities. In this article, we'll investigate three distinctive examples to execute the Blackman window in Python using the powerful NumPy library. Each approach will be went with by detailed calculations, step-by-step clarifications, of the Python syntax, and code cases with their respective outputs. Blackman ... Read More

How to Append suffix/prefix to strings in a Python list?

Pranavnath
Updated on 25-Aug-2023 15:55:21

1K+ Views

Introduction In this article, the users will understand how to append suffix/prefix to strings in a Python list. A List would store elements of different data types within these “[]” brackets. The string manipulation would be possible in the Python language. Various inbuilt string method are available in Python to append suffix/prefix to strings in a Python list like reduce(), map(), and so on. The two approaches are demonstrated in the article to append the specified character either in the starting or the rear side to the string. The methods to do this can be varying and some may be ... Read More

Python – Aggregate values by tuple keys

Pranavnath
Updated on 25-Aug-2023 15:50:19

165 Views

Introduction In the current world, handling data is the most challenging task for organizations with a high volume of data and with the development of data science and machine learning it has become easier to access. And the Python language plays a vital role in dealing with this data, as the data present can be relevant or irrelevant to each other. When they have some relevancy, it can be stored combinable with the other data or simply the aggregating of the data. In this, it combines the elements with similar characteristics and attributes they belong to. To do this process, ... Read More

Python – Check for descending Sorted list

Pranavnath
Updated on 25-Aug-2023 15:45:15

751 Views

A List is a type of data structure in Python language that can store elements of different data types within these “[]” brackets. The order in which data can be sorted will be either ascending or descending. In a list when the preceding element is greater than the next element then it follows descending order and on the other hand, when the preceding element is less than the next element then it follows ascending order. Utilizing three distinct approaches, the ways are given verifying for descending Sorted list in python. Approaches Approach 1 − Using iteration method Approach 2 ... Read More

Python – Append K characters N times

Pranavnath
Updated on 25-Aug-2023 15:37:39

242 Views

Introduction In this article, the user will focus on how to Append K characters N times in python. In the Python Language, append() function is used to add a character to the existing list, but to add K characters in N number of times different approach is utilized. The first approach utilize the join() method, the second approach utilize the textwrap() method and the last approach utilize the reduce() method to add the character to the existing string. Append K characters N times The methods to do this can be varying and some may be simple loop iteration on the ... Read More

Python – All Possible N combination tuples

Pranavnath
Updated on 25-Aug-2023 15:34:17

316 Views

Introduction In Python, a tuple is one of the types of data structures. The tuples are composed of items or elements and look more like lists. It has elements which cannot be changed after declaration. To return all the possible combinations of the tuple primarily the itertool library is used. The iteration or repetition process through the tuples is done using the iterator object containing various items. For the purpose of returning all possible combinations in a tuple, we can use many functions like combination(), chain(), product() and concatenation method. All Possible N combination tuples Tuple is a data structure ... Read More

Character Encoding in Python

Pranavnath
Updated on 25-Aug-2023 14:54:04

204 Views

Introduction Python has got a remarkable place in the field of handling data with the technologies like data science and machine learning. In the 21st century handling data is the most challenging task for organizations with a high volume of data and with the development of data science and machine learning it has become easier to access. In the Python language, Unicode is used and is represented as UTF (Universal Coded Character Set plus Transfer Format)-8. To encode the characters, there are two main possibilities of characters one is an ASCII character and the other is a non-ASCII ... Read More

Python – Bitwise OR among list elements

Pranavnath
Updated on 25-Aug-2023 14:38:11

245 Views

Introduction Python Language comes under the OOPS concept and it runs the code immediately without checking for errors. This language was discovered by Guido Rossum in 1989 and was globally launched in the year 1991. Python is a versatile and high-level language that can be understood easily by the user. In the current world, handling data is the most challenging task for organizations with a high volume of data and with the development of data science and machine learning it has become easier to access. Bitwise OR among list elements The Operator used for representing the bitwise operator is “|”. ... Read More

Advertisements