
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

7K+ Views
A vector in C++ is a dynamic array that stores elements of the same data type and can change its size when needed. In this article, we are given a vector and our goal is to find the maximum (largest) element using different STL methods in C++. Let's understand this with an example: // Example 1 std::vector vec1 = {11, 13, 21, 45, 8}; The largest element is 45. // Example 2 std::vector vec2 = {1, 9, 2, 5, 7}; The largest element is 9. Finding Maximum Element of a Vector Using STL in ... Read More

788 Views
In this tutorial, we will be discussing a program to understand how to create an unordered set of user defined class or struct in C++.For this we will create a structure type and then compare two structure types with the function defined by the user to store the hash function.Example#include using namespace std; //defined structure struct Test { int id; bool operator==(const Test& t) const{ return (this->id == t.id); } }; //defined class for hash function class MyHashFunction { public: size_t operator()(const Test& t) const{ ... Read More

607 Views
In this tutorial, we will be discussing a program to understand how to create an unordered map of user defined class in C++.To create an unordered map from a user defined class, we will pass the hash function as the class method being the third argument.Example Live Demo#include using namespace std; //objects of class to be used as key values struct Person { string first, last; Person(string f, string l){ first = f; last = l; } bool operator==(const Person& p) const{ return first == p.first && ... Read More

927 Views
In this tutorial, we will be discussing a program to understand how to create an unordered map of pairs in C++.Unordered maps are the ones that don't contain hash function for the pairs by default. If we want a hash value for a particular pair, it needs to be passed on explicitly.Example Live Demo#include using namespace std; //to hash any given pair struct hash_pair { template size_t operator()(const pair& p) const{ auto hash1 = hash{}(p.first); auto hash2 = hash{}(p.second); return hash1 ^ hash2; } }; int main(){ ... Read More

253 Views
In this tutorial, we will be discussing a program to understand how to create a List with constructor in C++ STL.List are data structures to store elements in memory in a non-contiguous fashion. They are insertion and deletion quick as compared to vectors.Example Live Demo#include #include using namespace std; //printing the list void print_list(list mylist){ list::iterator it; //printing all the elements for (it = mylist.begin(); it != mylist.end(); ++it) cout

2K+ Views
In this tutorial, we will be discussing a program to understand how to add “graphics.h” C/C++ library to gcc compiler in Linux.To do this we are required to compile and install the libgraph package.This includes install build-essential and some external packages>>sudo apt-get install build-essential >>sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-2.0 guile-2.0-dev libsdl1.2debian libart-2.0-dev libaudiofile-dev libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev libxext-dev x11proto-xext-dev libfreetype6 libaa1 libaa1-dev libslang2-dev libasound2 libasound2-devThen setting the path in the extracted files>>sudo make install >>sudo cp /usr/local/lib/libgraph.* /usr/libExample#include #include #include int main(){ int gd = DETECT, gm; initgraph(&gd, &gm, NULL); circle(40, 40, 30); delay(40000); ... Read More

3K+ Views
In this tutorial, we will be discussing a program to understand how vectors work in C/C++.A vector data structure is an enhancement over the standard arrays. Unlike arrays, which have their size fixed when they are defined; vectors can be resized easily according to the requirement of the user.This provides flexibility and reduces the time requirement with arrays to copy the previous elements to the newly created array.Example Live Demo#include #include using namespace std; int main(){ vector myvector{ 1, 2, 3, 5 }; myvector.push_back(8); //not vector becomes 1, 2, 3, 5, 8 for (auto x : myvector) cout

195 Views
The Python dictionary has key and value pairs. In some situation we will need the items of the dictionary to be sorted according to the keys. In this article we'll see the different ways to get a sorted output from the items in the dictionary.Using Operator ModuleThe Operator module has itemgetter function which can take 0 as the index of input parameter for the keys of the dictionary. We apply the sorted function on top of itemgetter and get the sorted output.Example Live Demodict = {12 : 'Mon', 21 : 'Tue', 17: 'Wed'} import operator print("Given dictionary", str(dict)) print ("sorted order ... Read More

1K+ Views
Tkinter is the GUI building library of python. In this article we will see how we can create a collapsible pane. They are usefult when we have some large amount of data to be displayed over a GUI canvas but we do not want to be displayed always. It is made collapsible so that it can be displayed as and when needed.The below program creates the collapsible pane where we see the result both after expanding and contracting the arrow. The code comments indicate the approach we take at each step.Examplefrom tkinter import * import tkinter as tk from tkinter ... Read More

1K+ Views
Many times we use a method called data smoothing to make the data proper and qualitative for statistical analysis. During the smoking process we define a range also called bin and any data value within the range is made to fit into the bin. This is called the binning method. Below is an example of binning. Then we will see how we can achieve the binning method using a Python program.Binning ExampleLet’s take a series of numbers. Find the maximum and minimum values. Decide on the number of bins we need depending on how many data points the analysis needs. ... Read More