Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
How can bar graphs be visualized using Bokeh?
Bokeh is a Python package that helps in data visualization. It is an open source project that renders plots using HTML and JavaScript, making it particularly useful for web-based dashboards and interactive applications. Bokeh can be easily used in conjunction with NumPy, Pandas, and other Python packages. Unlike Matplotlib and Seaborn which produce static plots, Bokeh creates interactive plots that respond to user interactions such as zooming, panning, and hovering. Installation Install Bokeh using pip or conda ? pip install bokeh Or using Anaconda ? conda install bokeh Creating ...
Read MoreProgram to find two pairs of numbers where difference between sum of these pairs are minimized in python
Suppose we have a list of numbers called nums and we want to select two pairs of numbers from it such that the absolute difference between the sum of these two pairs is minimized. So, if the input is like nums = [3, 4, 5, 10, 7], then the output will be 1, as we can select these pairs (3 + 7) - (4 + 5) = 1. Approach To solve this problem, we will follow these steps − Create all possible pairs and calculate their absolute differences ...
Read MoreCheck if a number is Primorial Prime or not in Python
A primorial prime is a prime number that can be expressed in the form pN# + 1 or pN# − 1, where pN# represents the primorial (product of the first N prime numbers). For example, if N=3, the primorial is 2×3×5 = 30, so 29 (30−1) and 31 (30+1) are potential primorial primes if they are also prime. Let's implement a solution to check if a given number is a primorial prime ? Algorithm Steps To solve this problem, we will − Use the Sieve of Eratosthenes to find all prime numbers up to a ...
Read MoreHow can Bokeh be used to visualize different shapes of data points in Python?
Bokeh is a Python package that helps in data visualization. It is an open source project that renders plots using HTML and JavaScript, making it useful for web-based dashboards. It helps in communicating quantitative insights to the audience effectively through interactive visualizations. Bokeh converts the data source into a JSON file, which is used as input to BokehJS, a JavaScript library written in TypeScript that renders visualizations on modern browsers. Unlike Matplotlib and Seaborn which produce static plots, Bokeh creates interactive plots that respond to user interactions. Installation Install Bokeh using pip or conda : ...
Read MoreHow to access Python objects within objects in Python?
In Python, it's common to have objects within objects, creating nested data structures. To access objects within objects, you can use the dot notation, which allows you to chain attribute access. Basic Object Composition Let's start with a simple example where a Person class contains an Address object ? class Person: def __init__(self, name, age): self.name = name self.age = age self.address = Address("123 Main St", "Anytown", "USA") ...
Read MoreCheck if frequency of characters are in Recaman Series in Python
Suppose we have a lowercase string s. We have to check whether the occurrences of alphabets in s, after rearranging in any possible manner, generates the Recaman's Sequence (ignoring the first term). The Recaman's sequence is defined as follows: a₀ = 0 aₙ = aₙ₋₁ - n (if aₙ₋₁ - n > 0 and not already present in sequence) aₙ = aₙ₋₁ + n (otherwise) Some of the items of Recaman's Sequence are [0, 1, 3, 6, 2, 7, 13, 20, 12, 21, 11, 22, 10, 23, 9, 24, ...]. The first term (0) is ...
Read MoreCheck if frequency of character in one string is a factor or multiple of frequency of same character in other string in Python
When working with two strings, we sometimes need to check whether the frequency of each character in one string is a factor or multiple of the frequency of the same character in another string. This means for each common character, one frequency should be divisible by the other. So, if the input is like s = "xxyzzw" and t = "yyyxxxxzz", then the output will be True because: Frequency of 'x' in s is 2, and in t is 4 (4 is multiple of 2) Frequency of 'y' in s is 1, and in t is 3 ...
Read MoreCheck if frequency of all characters can become same by one removal in Python
Sometimes we need to check if removing exactly one character from a string can make all remaining characters have equal frequencies. This problem tests our understanding of frequency counting and pattern matching. So, if the input is like s = "abbc", then the output will be True as we can delete one 'b' to get string "abc" where frequency of each character is 1. Approach To solve this, we will follow these steps ? Count frequency of all characters in the string Check if frequencies are already equal (removing any character would work) Try removing ...
Read MoreHow can Bokeh be used to generate scatter plot using Python?
Bokeh is a Python package that helps in data visualization. It is an open source project that renders plots using HTML and JavaScript, making it useful for web-based dashboards. Bokeh converts the data source into a JSON file which is used as input to BokehJS, a JavaScript library written in TypeScript that renders visualizations on modern browsers. Unlike Matplotlib and Seaborn which produce static plots, Bokeh produces interactive plots that change when users interact with them. Plots can be embedded in Flask or Django web applications and rendered in Jupyter notebooks. Installation Install Bokeh using pip or ...
Read MoreCheck If every group of a is followed by a group of b of same length in Python
Suppose we have a lowercase string s with only two characters a and b. We have to check whether every group of consecutive a's is followed by group of consecutive b's of equal length. So, if the input is like s = "abaaabbbaabbaabbab", then the output will be True, as all groups are (ab), (aaabbb), (aabb), (aabb), (ab). Algorithm To solve this, we will follow these steps − Initialize a_count to 0 and get the length of string s Set index i to 0 While i ...
Read More