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 2437 of 3366
2K+ Views
An algorithm is a set of instructions that are performed in order to solve the given problem. Here, we will discuss the reversal algorithm for array rotation and create a program for a reversal algorithm.Now, let's get to some terms that we need to know to solve this problem −Array − A container of elements of the same data type. The size (number of elements) of the array is fixed at the time of the declaration of the array.Array rotation − Rotating an array is changing the order of the elements of the array. Increasing the index of the element ... Read More
13K+ Views
A circle is a closed figure. All the points of the circle are equidistant from a point that lies inside in circle. The point at the center is known as the center of the circle. The distance of points from the center is known as the radius.The area is the quantitative representation of the span of the dimensions of a closed figure.The area of circle is the area enclosed inside the dimensions of a circle.The formula for calculating the area of a circle, Area = π*r*rTo calculate the area we are given the radius of the circle as input and ... Read More
595 Views
Problem statement − A program to find the number of ways in which a train will stop in r stations out of n stations so that no two stopping stations are consecutive.Problem ExplanationThis program will calculate the number of ways i.e. permutations in which the train will stop. Here, the train will travel from point X to Y. Between these points, there are n stations. The train will stop on r stations of these n stations given the conditions that while stopping on r stations the train should not stop in two consecutive stations.This permutation can be found using the ... Read More
3K+ Views
A function is a block of code that is defined to perform a specific piece of work in a program. It is used to ease the work of the programmer by defining a commonly occurring piece of code so that it can be reused when required.The address is the memory location where the entity is stored. Every block of code in the program has its own memory location in the program. Which means like any variable or object methods and functions also have memory address.To get the memory address of a function you need to use the pointer of the ... Read More
27K+ Views
Adding two Polynomials using a Linked List in C++ Linked list is a data structure that stores each element as an object in a node of the list. Every node contains two parts data node and links to the next node. A polynomial is a mathematical expression that consists of variables and coefficients. For example, x^2 - 4x + 7. In the Polynomial linked list, the coefficients and exponents of the polynomial are defined as the data node of the list. For example, if the given Polynomial equation is: 4x7 + 12x2 + 45. Its representation in a linked list looks like: ... Read More
238 Views
Array − An array is a container of elements of the same data type, whose elements are 0 indexed.In this problem, we will use an array of integers. And check if all the elements are greater than the given number or not. Here we will check if all elements of the array are greater than or equal to a given number k. If not then we will add two minimum elements of the array and treat this sum as a single element. And then again check for the same condition for the new array. If the condition comes out to ... Read More
33K+ Views
Converting a list to a JSON array is one of the common tasks in Java. Let's see how to convert a list to a JSON array in Java. If you do not know what JSON is, then you can read the JSON tutorial. The following are various ways to convert a list to a JSON array in Java: Manual construction of JSON array Using Jackson library Using Gson library Using org.json library Let's learn the process of each of them one by ... Read More
759 Views
In this problem, we are given two unsigned numbers, and we need to add them using bits in C++. Bits are binary digits that can be either 0 or 1. Unsigned numbers are positive numbers represented by these bits. To add two unsigned numbers, we add their bits one by one using binary addition rules. Binary addition works like decimal addition, but with simpler rules: 1 + 0 = 1 0 + 1 = 1 0 + 0 = 0 1 + 1 ... Read More
887 Views
Adding two numbers is a basic arithmetic operation, where we simply combine their values to get the total. The given task is to add two numbers using the "++" operator in C++. Let's understand this with an example: Scenario 1 // Adding two numbers using '+' operator Input: a = 7, b = 3 Output: 10 Explanation: a + b => 7 + 3 = 10 Scenario 2 // Adding two numbers using '++' operator Input: a = 7, b = 3 Output: 10 Explanation: a + b => 7 + 1 + ... Read More
2K+ Views
A number represented by the array is stored in such a form that each digit of the number is represented by an element of the array. For example, Number 234 in array is {2, 3, 4}.To add to such numbers we will first add number at the least significant digit and if the sum is greater than 10 propagate the carry. After this, we will go for the next consecutive digits of the array doing the same procedure and finding the sum.Let’s take an example to add two numbers −a = {2, 9, 6} b = {6, 3, 8} Output: ... Read More