
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 33676 Articles for Programming

2K+ Views
A virtual destructor is a destructor declared within the base class with a virtual keyword. In C++, destructors are special members of a class that frees memory occupied by an object when a memory leak occurs. Deleting a derived class object using a pointer to a base class, the base class should be defined with a virtual destructor. When to Use Virtual Destructor? Virtual destructorsare needed in scenarios where polymorphism and inheritance are involved, and instances of derived classes are managed by pointers to base classes. If our class has one or more virtual functions that are inherited from child ... Read More

1K+ Views
Virtual Functions in Derived ClassesA virtual function is declared using the virtual keyword in the base class and becomes a member function of the base class overridden by the derived class. It becomes virtual in every class which is derived from the base class. So, the keyword virtual is not necessary in the derived class while declaring redefined versions of the virtual base class function. When we use a pointer or reference to the base class to refer to a derived class object, we can call its virtual function. Syntax Following is the syntax of the virtual function in ... Read More

325 Views
Default Argument A default argument is a value provided during the function declaration that can be automatically assigned if no argument is provided when the function is called. If a value is passed at the time of the function call, this default value is overridden, and the argument becomes a parametrized Argument. Syntax The syntax below shows how we can define a default argument function: int fun(int x = 0){ // function body } Example of Default Argument The following C++ example shows the working of the default argument: #include using namespace std; //function defined with ... Read More

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 polymorphism means the function that will be executed is determined at runtime rather than at compile time. Characteristics of Virtual Function Following are the characteristics of the virtual function: Virtual function make sure the correct function is called for an object, regardless of the type ... Read More

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 linked list from the head node and continue until the link becomes null. Sorted Singly Linked List A singly linked list is supposed to be sorted when its elements are arranged in specific order (i.e., ascending or descending order), and each node contains data and a pointer (or reference) to ... Read More

2K+ Views
Sorted Doubly Linked List A sorted doubly linked list is a type of doubly linked list in which elements are arranged in a specific order, typically ascending or descending based on the data values. Where, insertion operation makes sure that the new node is placed in its correct sorted position. A doubly linked list is a two-way linked list in which a node is connected with two pointers, i.e., next and previous pointers, which are references to the next node and previous node, respectively. Characteristics of Sorted Doubly Linked List The following are the characteristics of the doubly linked ... Read More

551 Views
In data structure, Linked List is a linear collection of data elements. Each element or node of a list is comprising of two items - the data and a reference to the next node. The last node has a reference to null. Into a linked list the entry point is called the head of the list.Each node in the list stores the contents and a pointer or reference to the next node in the list, in a singly linked list. Singly linked list does not store any pointer or reference to the previous node.As it is a sorted singly linked ... Read More

825 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 sorted position. In Circular Doubly Linked List two consecutive elements are linked or connected by previous and next pointer and the last node points to first node by next pointer and the first node also points to last node by previous pointer. Characteristics of Sorted Circular Doubly Linked List ... Read More

7K+ 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 last node points to first node by next pointer and the first node also points to last node by previous pointer. Characteristics of Circular Doubly Linked List The following are the characteristics of the circular doubly linked list: Circular: The main feature is that ... Read More

363 Views
A subarray is a contiguous slice of an array, and maintains the order of elements naturally. (i.e., the elements of the subarray occupy consecutive positions). For example, the subarrays of an array {1, 2, 3} are {1}, {1, 2}, {1, 2, 3}, {2}, {2, 3}, and {3}. Input / Output Scenario Let's see the following input/output scenario: Input: arr[] = {1, 4, 5, 3, -1} Output: 13 Explanation: Subarray {1, 4, 5, 3} has the maximum sum 13. Input: arr[] = {1, 2, -3, 4, 5, -1} Output: 9 Explanation: Subarray {1, 2, -3, 4, 5} has the ... Read More