Found 33676 Articles for Programming

Largest Component Size in a Graph Formed by Connecting Non-Co-Prime Nodes

Sonal Meenu Singh
Updated on 22-Aug-2023 17:12:55

165 Views

Introduction In this tutorial, we discuss the problem of finding the largest component size in a graph generated by connecting non-co-prime nodes through C++. Graphs are formed by nodes connected by edges. The components of the graph are a subset of values that form nodes. There is an array a[] which forms graph G. The components of the graph are a subset of values that form nodes. The non-coprime numbers are the numbers that have a HCF (Highest Common Factor) other than 1, that means they have some other common factors. We solve the problem statement in this tutorial using ... Read More

Introduction to the Probabilistic Data Structures

Sonal Meenu Singh
Updated on 18-Aug-2023 12:25:38

1K+ Views

Introduction In this tutorial, we will discuss probabilistic data structures in detail. This tutorial will cover the meaning of a Probabilistic Data Structure, its types, and its benefits. When dealing with large data sets or Big Data, basic data structures that use hashtables or HashSets would not be effective enough. As the data size increases, memory requirements increase with limited time for solving a query which restricts the functionality of deterministic basic data structures. Probabilistic data structures are approximate data structures that are collections of data structures. They are called so because they do not provide exact values. They ... Read More

Given a String and an Integer k, find the kth Substring when all the Substrings are Sorted According to the given Condition

Sonal Meenu Singh
Updated on 18-Aug-2023 12:23:25

225 Views

Introduction In this tutorial, we implement an approach to find the kth substring after sorting all the substrings according to some conditions for a given string and the value of k. The condition to sort the substring is that the substrings are alphabetical while producing the substring in the order of their occurrence of each character in the alphabet. The first alphabet generates all its substrings, then the second alphabet produces all its substrings, and so on. Consider an example: the input string is “abc”, the alphabetically sorted substrings are “a”, “ab”, “abc”, “b”, “bc”, “c”. Predefined the value of ... Read More

Generate all Permutations of a String that follow given Constraints

Sonal Meenu Singh
Updated on 18-Aug-2023 11:31:47

495 Views

Introduction In this tutorial, we implement two examples using C++ programming concepts to generate all permutations of an input string. Permutation of a string is the number of ways a string can be arranged by interchanging the position of characters. We also include some constraints or limitations. All permutations or arrangements of the input string ensure character B does not follow character A anywhere, meaning there is no AB combination in the string. To implement this task we use two approaches: Directly generate all combinations of the string while restricting AB. Using backtracking. Demonstration 1 String = ... Read More

Capitalize the First and Last Character of Each Word in a String

Sonal Meenu Singh
Updated on 18-Aug-2023 11:28:04

560 Views

Introduction In this tutorial, we implement an approach to capitalizing the first and last characters of each word in the input string. By iterating over the input string str, each word's starting and ending letters are capitalized. We implement this problem using C++ programming in two ways. Let's start this tutorial with some demonstrations. Demonstration 1 String = “coding world” Output CodinG WorlD In the above demonstration, consider the input string and the result after capitalizing the starting and ending character of each word of the string is CodinG WorlD. Demonstration 2 String = “`hello all” ... Read More

Find the text of the given tag using BeautifulSoup

Atharva Shah
Updated on 21-Aug-2023 16:10:10

5K+ Views

BeautifulSoup is a powerful tool that makes it easy to extract information from HTML and XML documents primarily developed in Python for the purpose of web scraping and web data extraction. One of the most useful features of BeautifulSoup is the ability to find specific tags within a document. In this blog, we will explore how to use BeautifulSoup to find the text of a given tag along with a few examples. Installation and Syntax Installing BeautifulSoup is necessary before using it so use the Python package manager and run the following command right inside your terminal. pip install beautifulsoup4 ... Read More

Find the tag with a given attribute value in an HTML document using BeautifulSoup

Atharva Shah
Updated on 21-Aug-2023 15:17:58

544 Views

Extracting data from HTML pages is a typical activity during web scraping. Many tags and characteristics found in HTML pages aid in locating and extracting pertinent data. A well-known Python module named BeautifulSoup may be used to parse HTML texts and extract useful information. In this tutorial, we'll concentrate on utilizing BeautifulSoup to locate a tag that has a specific attribute value. Installation and Setup In order to start, we must install BeautifulSoup. Pip, Python's package installer, may be used for this. The following command should be entered into a command window or terminal − pip install beautifulsoup4 After ... Read More

Find the sum and product of a NumPy array elements

Atharva Shah
Updated on 21-Aug-2023 15:13:05

564 Views

A Python package called NumPy is employed in scientific computing and to handle large-scale numerical data. It provides support for multi-dimensional arrays and matrices, as well as a large library of mathematical functions to manipulate them. In this tutorial, we will focus on two of the most commonly used NumPy functions: sum() and prod(). These functions are used to calculate the sum and product of all the elements in a NumPy array, respectively. Installation Get the numpy package installed using pip inside your terminal pip install numpy Import it as highlighted after successful installation − import numpy as np ... Read More

How to add Site Header, Site Title, Index Title in a Django Project?

Atharva Shah
Updated on 21-Aug-2023 15:10:42

823 Views

To make it simple for people to browse and comprehend the goal of the site, it's critical to have a clear and succinct site header, site title, and index title when constructing a Django project. You must specify the site header, site title, and index title in your Django application's HTML templates in order to add them to the site. Every page of your website will have these components, making it simpler for visitors to browse and comprehend the goal of your project. These additions are especially helpful for complicated, huge websites that users may have trouble navigating. We will ... Read More

How to add RSS Feed and Sitemap to Django project?

Atharva Shah
Updated on 21-Aug-2023 15:09:35

185 Views

Introduction The incorporation of web components like Sitemaps and RSS (Really Simple Syndication) Feeds can provide a multitude of benefits such as enhancing user accessibility, augmenting website content consumption, and improving search engine performance. Developers can leverage Django to streamline the process of constructing web applications, resulting in the creation of websites that are exceptionally effective and user-friendly. What is RSS and Sitemap? RSS Feeds are XML files that include summaries of the material on a website, like article headlines and descriptions. Users may simply get the material without visiting the website by reading these files using RSS readers. On ... Read More

Advertisements