- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 7346 Articles for C++
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
222 Views
We shall develop a C++ program to find kth smallest element by the method of partitioning the Array.AlgorithmBegin Function CreatePartition() has an array a, and the lower l and upper limit h as arguments in := l and pi := h for i in range l to h, do if a[i] < a[pi], then exchange the values of a[i] and a[in] increase the in by 1 done exchange the values of a[pi] and a[in] return in End Begin ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
136 Views
Here is a C++ Program to Implement Double Order Traversal of a Binary Tree.In Double Order Traversal, the root of the subtree is will be traversed twice.AlgorithmBegin class BST has following functions: insert() = to insert items in the tree: Enter the root. Enter the value of the node, if it is greater than root then entered as right otherwise left. doubleOrder() = To perform inorder: If root = null Print tree is empty ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
291 Views
Here is a C++ Program to Implement Cartesian Tree.AlgorithmBegin class CarTree to declare the functions: min() = To find index of the minimum element in array: if (arr[i] < min) min = arr[i] minind = i inorder() = For inorder traversal of the tree: If tree is empty Then return inorder (node->l) Print the root as node->d inorder (node->r) EndExample Code#include #include #include using namespace std; struct nod//node declaration ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
3K+ Views
The B+ tree is a generalization of a binary search tree in that a node can have more than two children. It is basically a self-balancing tree data structure that maintains sorted data and allows sequential access, searches, insertions, and deletions in logarithmic time.It can be viewed as a B-tree in which each node contains only keys and to which an additional level is added at the bottom with linked leaves.AlgorithmBegin function insert() to insert the nodes into the tree: Initialize x as root. if x is leaf and having space for one more info ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
133 Views
We shall consider a C++ program to find the median of elements where elements are stored in 2 different arrays.AlgorithmBegin Function Median() has Two arrays a1[], a2[] and n = numbers of elements of the array as arguments: Initialize i and j by 0, and n1 and n2 by -1 for c in range 0 to n, do if i = n, then n1 := n2 n2 := a2[0] break the loop else if j = n, then ... Read More
![Nishtha Thakur](https://www.tutorialspoint.com/assets/profiles/13598/profile/60_104893-1512719058.jpg)
5K+ Views
The B-tree is a generalization of a binary search tree in that a node can have more than two children. It is basically a self-balancing tree data structure that maintains sorted data and allows sequential access, searches, insertions, and deletions in logarithmic time.Here is a C++ program to implement B tree of order 6.AlgorithmBegin function insert() to insert the nodes into the tree: Initialize x as root. if x is leaf and having space for one more info then insert a to x. else if x is not leaf, do Find ... Read More
![Anvi Jain](https://www.tutorialspoint.com/assets/profiles/13591/profile/60_98631-1512716973.jpg)
2K+ Views
Here is a C++ program to Implement a Binary Search Tree using Linked Lists.Functions and pseucodesAlgorithmBegin Take the nodes of the tree as input. Create a structure nod to take the data d, a left pointer l and a right r as input. Create a function create() to insert nodes into the tree: Initialize c = 0 as number of nodes. Perform while loop till c < 6: Enter the root. Enter the value of the node, if it is greater than root ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
666 Views
Count inversion means the number of switches required to make an array sorted. Inversion count = 0, when array is sorted. Inversion count = maximum, when the array sorted in reverse order.Let us develop a C++ program to count Inversion in an Array.AlgorithmBegin Function CountInversionArray has arguments a[], n = number of elements. initialize counter c := 0 for i in range 0 to n-1, do for j in range (i + 1) to n, do if a[i] > a[j], then increase the count ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
203 Views
In C++, Exception Handling is a process to handle runtime errors. Exception is an event which is thrown at runtime in C++. All exceptions are derived from std::exception class. It is a runtime error which can be handled. It prints exception message and terminates the program, if we don't handle the exception.Exceptions are defined in C++ standard as class that we can use inside our programs. The arrangement of parent-child class hierarchy has been shown below −Common exception classes in C++ are −Sr.No.Exception & Description1std::exceptionThis is an exception and parent class of all the standard C++ exceptions.2std::bad_castIt is an ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
595 Views
In this section we will see what is the Chrono library in C++. This Chrono library is used for date and time. Timers and clocks are different in different systems. So if we want to improve time over precision we can use this library.In this library, it provides precision-neutral concept, by separating the durations and point of time.The duration objects are used to express time span by means of a count like minute, two hours or ten minutes. For example, 30 seconds is represented by a duration consisting of 30 ticks of unit of 1 seconds.Example Code#include #include ... Read More