- 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)
961 Views
Virtual functions in C++ use to create a list of base class pointers and call methods of any of the derived classes without even knowing the kind of derived class object. Virtual functions are resolved late, at the runtime.If A virtual function in a base class declared as once a member function, it becomes virtual in every class derived from that base class. So, use of the keyword virtual is not necessary in the derived class while declaring redefined versions of the virtual base class function.Example Code#include using namespace std; class B { public: virtual void ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
5K+ Views
Virtual functions in C++ use to create a list of base class pointers and call methods of any of the derived classes without even knowing kind of derived class object. Virtual functions are resolved late, at runtime.The main use of virtual function is to achieve Runtime Polymorphism. Runtime polymorphism can be achieved only through a pointer (or reference) of base class type. Also, a base class pointer can point to the objects of base class as well as to the objects of derived class. In above code, base class pointer ‘b’ contains the address of object ‘d’ of derived class.Example ... Read More
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
2K+ 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.Developing a C++ program to implement sorted ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
1K+ Views
In data structure Link 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.A doubly linked list consists of a set of sequentially linked records called nodes. Each node contains three fields: one data field and two link fields; references to the previous and to the next node in the sequence of nodes field.In case of sorted doubly ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
390 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
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
608 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.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.In sorded circularly doubly linked list, ... Read More
![Vrundesha Joshi](https://www.tutorialspoint.com/assets/profiles/13566/profile/60_88163-1512715024.jpg)
5K+ Views
In data structure Link 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. In a linked list the entry point is called the head of the list.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.AlgorithmBegin We shall create a ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
257 Views
We shall develop a C++ program to find the maximum subarray sum O(n^2) time (naive method).AlgorithmBegin Take the array elements as input. Make a loop for the length of the sub-array from 1 to n, within this loop, Make another loop nested with the previous one, calculate the sum of first sub-array of that length. For remaining sub-array sum, add the next element to the sum and subtract the first element of that sub-array. Compare it with the global max and update if found out to be more. Print the max sub-array and their ... Read More
![Nitya Raut](https://www.tutorialspoint.com/assets/profiles/13573/profile/60_92249-1512715559.jpg)
128 Views
We shall develop a C++ program to find the median of two sorted arrays using Binary Search approach.AlgorithmBegin Function median() with both the arrays and the start and end indexes of each array, which have two arrays and their respective elements as argument. A) first calculate the array length as e1 - s1, here e1 nd s1 are the end and start indices. B) If the length is 2 or 1, calculate the median of arrays according to even or odd length, print the result. C) Check if both the ... Read More