Data Structure
 Networking
 RDBMS
 Operating System
 Java
 MS Excel
 iOS
 HTML
 CSS
 Android
 Python
 C Programming
 C++
 C#
 MongoDB
 MySQL
 Javascript
 PHP
- Selected Reading
 - UPSC IAS Exams Notes
 - Developer's Best Practices
 - Questions and Answers
 - Effective Resume Writing
 - HR Interview Questions
 - Computer Glossary
 - Who is Who
 
Programming Articles - Page 2403 of 3366
 
			
			313 Views
C++ programming language defines a container in c++ standard Template Library named as bitset. This bitset container is used in order to work on elements at the bit level i.e. each bit of the variable the bits i.e. binary conversion of the given value.1. Bitset is like an string − Bitset is a container of bits ( only 0 and 1 are valid ). You can create a bitset with any set of bits specified by start index value of the bitset and the number of elements that are considered i.e. you can create a bitset with 2 elements starting ... Read More
 
			
			547 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
 
			
			203 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 Live Demo#include int isSafe(int x, int ... Read More
 
			
			852 Views
_Generic keyword in C is used to define MACRO for different data types. This new keyword was added to the C programming language in C11 standard release. the _Generic keyword is used to help the programmer use the MACRO in a more efficient way.this keyword translate the MACRO based on the type of the variable. let's take an example ,#define dec(x) _Generic((x), long double : decl, \ default : Inc , \ float: incf )(x)The above syntax is how to declare any MACRO as generic for different methods.Let's take an example code, this code will define a MACRO that will ... Read More
 
			
			488 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
 
			
			316 Views
An adapter pattern is used to convert the interface of a class into an interface that is expected by the client. An adapter helps the programmer to make its classes work together and make sure the user requirement is fulfilled by making incompatible interfaces completable.let's understand a bit more about the adapter pattern. The concept of adapter is taken from the real world. as in the real world We use adapters to connect things that are incompatible with each other. let's take an example, in modern day smartphones the 3.5 mm jack for earphones is missing, so the brands have ... Read More
 
			
			597 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
 
			
			539 Views
A set is a data structure that is used to store distinct values (meaning no two elements can have the same value) in ascending or descending order. Set for User-defined Data TypesWe can directly use sets for built-in data types, but for user-defined data types, values cannot be directly stored, because a set compares the elements to maintain order, but for user-defined data types such as array or struct, the compiler will not be able to perform a comparison between them. The set container is defined under the header file. So to use user-defined datatypes into a stack, we ... Read More
 
			
			146 Views
The basic_string c_str function that returns a pointer to an array of characters that is terminated using null character. It is an inbuilt method that has the value of a string that has null character termination.Syntax to define a c_str function in C++ −const Char ptr* c_str() constAbout the functionIt is an inbuilt method for the c++ STL library. No parameters can be passed to the method. It returns a char pointer. This pointer points to NULL terminated character array.Example Live Demo#include #include using namespace std; int main() { string s = "I Love Tutorials Point"; int ... Read More
 
			
			398 Views
Serializing a Map in Java is the process of converting a Map object into a format that can be easily stored or transmitted, such as JSON or XML. We will use the Flexjson library to serialize a map in Java. We can serialize a Map using the serialize() method of the JSONSerializer class, which performs a shallow serialization of the target instance. Example of Serializing a Map We will take a map and see the output after serialization. Map map = new HashMap(); map.put("name", "Ansh"); map.put("age", "23"); map.put("city", "Mumbai"); map.put("country", "India"); After serialization, the map will look like this: {"name":"Ansh", ... Read More