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
Server Side Programming Articles - Page 2135 of 2650
390 Views
The binomial coefficient is a quotation found in a binary theorem which can be arranged in a form of pascal triangle it is a combination of numbers which is equal to nCr where r is selected from a set of n items which shows the following formulanCr=n! / r!(n-r)! or nCr=n(n-1)(n-2).....(n-r+1) / r!The sum of the square of Binomial Coefficient i.e (nC0)2 + (nC1)2 + (nC2)2 + (nC3)2 + ……… + (nCn-2)2 + (nCn-1)2 + (nCn)2Input :n=5 Output:252ExplanationIn this program first we have to find the binomial coefficient of r which is selected from n set then we have to ... Read More
3K+ Views
A binary number is a number that consists of only two digits 0 and 1. For example, 01010111.There are various ways to represent a given number in binary form.Recursive methodThis method is used to represent a number in its binary form using recursion.AlgorithmStep 1 : if number > 1. Follow step 2 and 3. Step 2 : push the number to a stand. Step 3 : call function recursively with number/2 Step 4 : pop number from stack and print remainder by dividing it by 2.Example Live Demo#include using namespace std; void tobinary(unsigned number){ if (number > 1) tobinary(number/2); cout
202 Views
A string is an array of characters. In this problem, we are given a string which has opening and closing brackets. And we will balance this string by removing extra brackets from the string.Let’s take an example, Input : “)Tutor)ials(p(oin)t(...)” Output : “Tutorials(p(oin)t(...))”To solve this problem, we will traverse through the string and check for matching brackets. For unmatched brackets eliminate the closing brackets.AlgorithmStep 1 : Traverse the string from left to right. Step 2 : For opening bracket ‘(’ , print it and increase the count. Step 3 : For occurence of closing bracket ‘)’ , print it only ... Read More
236 Views
The average of number in a stream means calculating the average after every insertion. But in this problem, we need to find the average of max K numbers in a stream i.e. only k numbers of the array are considered for calculating the average. When we add a number if it is greater than any of the numbers that contribute to the average then only it is considered otherwise the average remains the same.Let’s take an example to understand the concept better −Input : n = 4 , k = 3 , array = { 4, 9, 1 , 5} ... Read More
860 Views
Average of numbers is the sum of numbers divided by the total number of numbers.In this problem, we are given a stream of numbers. And we will print average of the number at every point.Let’s take an example of how it works −We have a stream of 5 number 24 , 76 , 29, 63 , 88The average at each point of the stream would be −24 , 50 , 43 , 48 , 56.For this we will find the average of the stream every time a number is added to the stream. So, we need to find the average ... Read More
3K+ Views
In c++ programming language, an associative array is a special type of array in which the index value can be of any data type i.e. it can be char, float, string, etc. These associative arrays are also known as maps or dictionaries. Also, the indexes are given a different name which is key and the data that is stored at the position of the key is value.So, we can define the associative array as a key-value pair.Let's define an associative array of bikes and their top speed.Bike top speed Ninja 290 S1000rr 310 Bullet 127 Duke 135 R1 286Example Live Demo#include ... Read More
2K+ Views
The integer is a data type used to define a number that contains all positive, negative or zero non-fractional values. These cannot have decimals.Float is a data type used to define a number that has a fractional value. These can have decimals also.Now, we will check what will be the value of float and integer return by the compiler when we input the same value for both.Example Live Demo#include using namespace std; int main(){ float f = 23; unsigned int x = 23; cout
2K+ Views
The array is a data structure in c++ that stored multiple data elements of the same data type in continuous memory locations.In c++ programming language, there are inbuilt functions to manipulate array types. Some functions can also be applied to multidimensional arrays. The array header file contains functions to manipulate arrays in c++ programming language.Some common methods to manipulate arrays in c++ are −is_array()This function is used to check if the variable passed to the function is of the type array or not. This method is strict in recognizing arrays that even std:: array is rejected in the check. The ... Read More
3K+ Views
A queue is a linear data structure in which the order of operation is FIFO (first in first out).The array is a data structure that contains elements of the same data type, stored in continuous memory location.In queue the insertion and deletion operations as done at opposite ends of the queue. The implementation is a bit more complex as compared to the stack.In array implementation of queue, we create an array queue of size n with two variables top and end.Now, initially, the array is empty i.e. both top and end are at 0 indexes of the array. And as ... Read More
454 Views
The array is a collection of elements of the same data type stored in continuous memory locations.C++ standard library contains many libraries that support the functioning of arrays. One of them is an array data() method.The array data() in c++ returns a pointer pointing to the first element of the object.Syntaxarray_name.data();ParameterThere are no parameters accepted by the function.Return typeA pointer to the first element of the array.ExampleProgram To Illustrate The Use Of Array Data() Method − Live Demo#include using namespace std; int main(){ array percentage = { 45.2, 89.6, 99.1, 76.1 }; cout