
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
Found 26504 Articles for Server Side Programming

689 Views
In this tutorial, we are going to learn about automating testing in Python. After writing code, we have to test them by giving different types of input and check whether the code is working correctly or not.We can do it manually or automatically. Doing manual testing is very hard. So, we are going to learn about automated testing in Python. Let's start.We have a module called unittest, which is used to test the code automatically. We are going to work with this module in this tutorial. It's straightforward for a beginner to get started with the unittest module for testing. ... Read More

356 Views
Here we will see how to find the frequency of smallest element in an array. Suppose the array elements are [5, 3, 6, 9, 3, 7, 5, 8, 3, 12, 3, 10], here smallest element is 3, and the frequency of this element is 4. So output is 4.To solve this we will find the smallest element of the list, then we count the occurrences of first numbers, and that will be the result.Example#include using namespace std; int min_element(int arr[], int n){ int min = arr[0]; for(int i = 1; i

264 Views
We know that the excel column numbers are alphabetic. It starts from A, and after Z, it will AA, AB, to ZZ, then again AAA, AAB, to ZZZ and so on. So column 1 is A, column 27 is Z. Here we will see how to get the column letter if number of column is given. So if the column number is 80, then it will be CB.Suppose we have a number n, and its value is 28, then we need to take reminder with 26. If the remainder is 0, then the number is 26, 52 and so on. ... Read More

174 Views
Suppose we have two arrays A and B. There are few elements. We have to find those elements that are present in set A, but not in set B. If we think that situation, and consider A and B as set, then this is basically set division operation. The set difference between A and B will return those elements.Example#include #include #include #include using namespace std; void setDiffResults(int A[], int B[], int An, int Bn) { sort(A, A + An); sort(B, B + Bn); vector res(An); vector::iterator it; vector::iterator it_res = set_difference(A, A + An, B ... Read More

328 Views
Consider we have to find a list of n elements. But we have the XOR value of two consecutive elements of the actual array. Also the first element of the actual is given. So if the array elements are a, b, c, d, e, f, then the given array will be a^b, b^c, c^d, d^e and e^f.As the first number is given, named a, that can help us to find all numbers. If we want to find the second element of the actual array, then we have to perform b = a ^ arr[i], for second element c = b ... Read More

187 Views
Suppose we have a list with 6 different numbers. Only one number is repeated five times. So there are total 10 elements in the array. Find duplicate numbers using only two comparisons. If the list is like [1, 2, 3, 4, 4, 4, 4, 4, 5, 6], so output is 4.As there are only 10 numbers, then for any type of duplicate numbers, the range of numbers will be placed from index 3 to 5. By checking these indices, we can find the result.Example#include using namespace std; int getDuplicate(int array[]) { if (array[3] == array[4]) return array[3]; else if (array[4] == array[5]) return array[4]; else return array[5]; } int main() { int a[] = {1, 2, 3, 4, 4, 4, 4, 4, 5, 6}; cout

156 Views
In this tutorial, we will be discussing a program to print the nodes present at the odd levels of a given binary tree.In this program, the level for the root node is considered as 1 and simultaneously the alternative level is the next odd level.For example, let us say we are given with the following binary treeThen the nodes at the odd levels of this binary tree will be 1, 4, 5, 6.Example#include using namespace std; struct Node { int data; Node* left, *right; }; //printing the nodes at odd levels void print_onodes(Node *root, bool is_odd = ... Read More

327 Views
Suppose we have a list of numbers from 0 to n-1. A number can be repeated as many as possible number of times. We have to find the repeating numbers without taking any extra space. If the value of n = 7, and list is like [5, 2, 3, 5, 1, 6, 2, 3, 4, 5]. The answer will be 5, 2, 3.To solve this, we have to follow these steps −for each element e in the list, do the following steps −sign := A[absolute value of e]if the sign is positive, then make it negativeOtherwise it is a repetition.Example#include ... Read More

396 Views
In this tutorial, we will be discussing a program to print the longest path that exists from a leaf node to another leaf node in a given binary tree.In other words, we have to print all the nodes that appear in the diameter of the Binary tree. Here, diameter (or width) for a particular binary tree is defined as the number of nodes in the longest path from one end node to another.To solve this, we calculate the diameter of the binary tree using the height function. Then we find the longest path in the left portion of the binary ... Read More

422 Views
Here we will see how to get the cubic root of a number. Suppose a number is say 27, then the cubic root of this number is 3. To solve this problem, we will define our own logic without using some library functions. We will use the binary search approach. We have to follow these steps to solve this problem.Suppose we have threshold value like threshold = 0.000001Start the left value as 0, and right value as numbercalculate mid := (left + right)/2if the absolute value of (number – mid3) is less than threshold, then return mid as answerif mid3 ... Read More