Category: Data Structure

How to Define / Create C++ Structure

The structure is one of the most important building block in understanding objects and classes using C++. Typically, structures are used for file processing. A file is a collection of related records. A record is a bundle of related elements (or fields or data items) of same or different data types. In C++, structure is […]

Tree Data Structure In C++

A tree is a non-linear data structure. It is a set of nodes connected by edges. Each node is a data structure consisting of a value together with a list of nodes (the “children”). In a tree, no node is duplicated. In a linked list, each node has a link which points to next node […]

C++ Linked List Data Structure (with examples)

Linked list is a linear data structure. It is a list or chain of nodes where each node stores data as well as points to the next node (and previous node also for double linked list) in the list. It means that each node contains the data and also the location of the next node. […]

C++ Recursion – Recursive Function

Recursion is a powerful programming technique in which either a single function calls itself again and again (direct recursion) or two functions call each other again and again (indirect recursion) till the final calculation of the result. Involved function(s) in the recursion, is called recursive function. The number of times a function is called  recursively […]

C++ Push and Pop Operation

When a data item is added or inserted into a stack at its top position, the operation is called push operation.  Before pushing a data item into the stack, it is ensured that there is an available location in the stack to store the data item. If there is no room, no further value is […]

Queue in C++ Programming

In programming, queue is a linear data structure in which new items are inserted from one end, whereas existing items are removed from other end. The end at which the items are inserted is called Tail or Back or Rear of the queue. The end from where items are removed is called Head or Front […]