sudhir sharma

sudhir sharma

975 Articles Published

Articles by sudhir sharma

Page 69 of 98

Angular Sweep Algorithm in C++

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 665 Views

The algorithm to find the maximum number of points that can be enclosed in a circle of a given radius. This means that for a circle of radius r and a given set of 2-D points, we need to find the maximum number of points that are enclosed (lying inside the circle not on its edges) by the circle.For, this is the most effective method is the angular sweep algorithm.AlgorithmThere are nC2 points given in the problem, we need to find the distance between each of these points.Take an arbitrary point and get the maximum number of points lying in ...

Read More

New ways to Assign values to Variables in C++ 17 ?

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 538 Views

In C++ 17, there are introduced two new ways by which a programmer can assign values to a variable or declared them. In this update, elser then the classical way of assigning values to a variable the following two ways to initialise values.Classical methodInitially the assignment operator ‘=’ is used for assignment and declaration of a variable. assignment of a variable using = looks like, datatype variable_name = value;Example, int val = 243;New methodUniform initialisationIn uniform initialisation of variables we do not use the ‘=’ operator. the value is enclosed inside a pair of curly braces ' {} '. Value ...

Read More

A matrix probability question in C?

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 227 Views

The matrix probability question Calculates the probability that whether an element will be inside the given matrix after taking N steps and any direction. This means we need to find what is the probability of an element not going out of the scope of the matrix even after moving N positions in any direction.In this problem, we are free to move the matrix element in all four directions (left, right, up, down). And the probability of moving elements is same 0.25 or 1/4.The program will return 0 if the element steps out otherwise not.Example#include int isSafe(int x, int y, ...

Read More

C++ bitset and its application ?

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 588 Views

A bitset is a dataset that stores multiple boolean values but takes lesser memory space as compared to other data sets that can store a sequence of bits like a boolean array or boolean vector.Bitsets stores the binary bits in a form that takes less memory space, it stores them in compressed from. Accessing any element is same as others i.e. by using its index value i.e. bitset_name[index]. But the indexing of elements in a bitset is reverse. Let’s take an example, for bitset {01101001} the element at 0th index is 1 and so on. So 0’s are at index ...

Read More

C++ Stream Classes Structure

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 28K+ Views

In C++ stream refers to the stream of characters that are transferred between the program thread and i/o.Stream classes in C++ are used to input and output operations on files and io devices. These classes have specific features and to handle input and output of the program.The iostream.h library holds all the stream classes in the C++ programming language.Let's see the hierarchy and learn about them, Now, let’s learn about the classes of the iostream library.ios class − This class is the base class for all stream classes. The streams can be input or output streams. This class defines members that ...

Read More

10 Essential Web Scraping Tools for Data Collection in 2025

sudhir sharma
sudhir sharma
Updated on 08-Aug-2025 438 Views

Data is more than just a business asset – it's a strategic advantage. Whether you're monitoring competitors, tracking product prices, gathering SEO insights, or creating machine learning models, relevant and structured web data is the modern gold. That’s where web scraping can become your winning strategy. Web scraping is the extraction of digital data and information from websites. Most businesses use it for market research, lead generation, brand monitoring, and much more. But scraping the modern web is way different nowadays, with dynamic content, anti-bot systems, and ever-changing layouts making it more difficult by the day. Depending on your needs, ...

Read More

How to compare float and double in C++?

sudhir sharma
sudhir sharma
Updated on 31-Jul-2025 958 Views

In C++, floating-point numbers are used to represent decimal values. The most commonly used floating-point types are float and double. These data types differ in their size, precision, and use cases. Understanding how to use and compare them correctly is important for accurate computations. Understanding Float and Double Precision The float is a 32-bit single-precision floating-point type that can store approximately 7 decimal digits, while double is a 64-bit double-precision type that offers about 15 to 16 digits of precision. Due to these differences, double is generally preferred for higher accuracy in scientific and financial calculations. Example: Printing ...

Read More

Delete Node in a Linked List in Python

sudhir sharma
sudhir sharma
Updated on 31-Jul-2025 4K+ Views

A linked list is a linear data structure where each element is a separate object, commonly referred to as a node. Each node contains two fields: the data and a pointer to the next node in the list. In this article, we'll learn how to delete a node from a singly linked list using Python. Suppose we have a linked list with a few elements. Our task is to delete a specific node, given only access to that node - not the head of the list. For example: Input: 1 → 3 → 5 → 7 → ...

Read More

Amazing hacks of Python

sudhir sharma
sudhir sharma
Updated on 14-Jul-2025 282 Views

Python is one of the programming languages known for its simple syntax, readability. Whether working on development, data analysis, or automation, Python provides the tools to get the task done with less effort. But beyond the basics, Python has some hacks that make the code not only shorter but also more efficient. These are not bugs or workarounds, but the smart ways of using the Python built-in features and functions to solve tasks in a faster manner. In this article, we are going to learn about the amazing hacks of Python. Performing a Swap Without a ...

Read More

Sum of the Series 1 + x/1 + x^2/2 + x^3/3 + .. + x^n/n in C++

sudhir sharma
sudhir sharma
Updated on 01-Jul-2025 2K+ Views

In this article, we are given a mathematical series. Our task is to write a program to find the sum of the series 1 + x/1 + x^2/2 + x^3/3 + .. + x^n/n. This can also be represented as: $$ 1+\displaystyle\sum\limits_{k=1}^n \left(\frac{x^k}{k}\right) $$ This series without starting 1 is known as the Taylor Expansion Series for -ln(1-x) where ln is the natural log. Example Here is an example of calculating the value of the given series: Input: x = 7, n = 4 Output: 747.08 ...

Read More
Showing 681–690 of 975 articles
« Prev 1 67 68 69 70 71 98 Next »
Advertisements