Aman Kumar has Published 94 Articles

Virtual Functions and Runtime Polymorphism in C++

Aman Kumar

Aman Kumar

Updated on 22-May-2025 18:11:33

6K+ Views

In C++, both virtual functions and runtime polymorphism are key features that enable dynamic behavior and code flexibility. Virtual Functions A virtual function is the member function that is declared in the base class using the keyword virtual and is overridden in the derived class. The virtual function enables runtime ... Read More

C++ Program to Implement Sorted Singly Linked List

Aman Kumar

Aman Kumar

Updated on 22-May-2025 18:10:45

3K+ Views

A singly linked list is a type of linear data structure where each node contains two items: The data and a link to the next node in the list. Where, first node is called as head node and the last node is called the tail. So, you can traverse the ... Read More

C++ Program to Implement Double Order Traversal of a Binary Tree

Aman Kumar

Aman Kumar

Updated on 21-May-2025 14:47:09

217 Views

Double Order Traversal Double order traversal means each node in a tree is traversed twice in a particular order. A binary tree is a non-linear data structure where each node contains at most two children (i.e, left and right). Therefore, suppose we have a given binary tree, and the task ... Read More

C++ Program to Construct an Expression Tree for a given Prefix Expression

Aman Kumar

Aman Kumar

Updated on 21-May-2025 14:45:41

5K+ Views

What is Expression Tree?An expression tree is a binary tree used to represent expressions. In an expression tree, internal nodes correspond to operators, and each leaf node corresponds to an operand. Let's see an expression and construct a tree for [5 + ((4+3)*2)]. Constructing an Expression TreeOur task is ... Read More

C++ Program to Implement Circular Doubly Linked List

Aman Kumar

Aman Kumar

Updated on 21-May-2025 14:43:08

6K+ Views

Circular Doubly Linked ListA circular linked list is called a circular doubly linked list in which each node has two links connecting it to the previous node and the next node. In Circular Doubly Linked List two consecutive elements are linked or connected by previous and next pointer and the ... Read More

C++ Program to Implement Sorted Circularly Doubly Linked List

Aman Kumar

Aman Kumar

Updated on 21-May-2025 14:37:29

813 Views

Sorted Circular Doubly Linked ListA sorted circular doubly linked list is a type of circular doubly linked list in which elements are arranged in a specific order, typically ascending or descending based on the data values. The insertion operation makes sure that the new node is placed in its correct ... Read More

Program to Find Area of an Ellipse using C++

Aman Kumar

Aman Kumar

Updated on 21-May-2025 14:30:43

547 Views

An ellipse is the locus on all those points in a plane such that the sum of their distance from two fixed points in the plane is constant. Where the fixed point is known as foci, which are sounded by the curve, the fixed line is a directrix, and the ... Read More

C++ Program to Implement Queue Using Two Stacks

Aman Kumar

Aman Kumar

Updated on 21-May-2025 14:27:32

2K+ Views

Stack The stack is a linear data structure that follows the Last-In-First-Out (LIFO) operation. Where the element will be added and removed from the top. Following are the stack operations: push (int data): Insertion at top int pop(): Deletion from top Queue The queue is also a linear ... Read More

C++ Program to Implement Nearest Neighbour Algorithm

Aman Kumar

Aman Kumar

Updated on 21-May-2025 14:25:59

2K+ Views

In this article, we will see a C++ program to implement the nearest neighbour algorithm: The nearest neighbour algorithm is a greedy algorithm used to find the approximate solution to the Travelling Salesman Problem (TSP) by computing the minimum cost required to visit all the nodes by traversing across the ... Read More

What is a virtual base class in C++?

Aman Kumar

Aman Kumar

Updated on 20-May-2025 19:30:46

2K+ Views

Virtual Base ClassVirtual base classes are used in virtual inheritance. It is a way of preventing multiple instances of given classes occurs in the inheritance hierarchy when using multiple inheritance. Why We Use Virtual Base Class? The use of a virtual base class ensures that ... Read More

Advertisements