- 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 7347 Articles for C++
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
154 Views
Given a sorted doubly linked list containing integer values. The goal is to find triplets whose product is equal to the given value x. If input linked list is 3−4−1−2 and x is 6 then count will be 1 (triplet (3, 1, 2))For ExampleInputlinked list: [ 200−4−16−5−10−10−2 ] x=200OutputCount of triplets in a sorted doubly linked list whose product is equal to a given value x are: 3ExplanationTriplets will be: (4, 5, 10), (4, 5, 10) and (10, 10, 2)Inputlinked list: [ 4−3−1−5−2−4−2] x=12OutputCount of triplets in a sorted doubly linked list whose product is equal to a given value ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
93 Views
Given an array arr[] containing integer elements and an integer num. The goal is to find the average of each element arr[i] and num and print the count of the number of times that average appeared in the original array.If array arr[] is [ 5, 2, 3 ] and num is 2. Averages will be [ 3, 2, 2 ] occurrences in arr[] is [ 1, 1, 1 ]For ExampleInputarr[] = { 1, 6, 4, 3, 6, 4 } num=2Output1 2 1 0 2 1Count of occurrences of the average of array elements with a given number are − 5ExplanationThe ... Read More
![Sunidhi Bansal](https://www.tutorialspoint.com/assets/profiles/124656/profile/60_131452-1581053210.jpg)
5K+ Views
Given a string str, a character and a positive integer N. The string str is repeated indefinitely. The goal is to find the count of occurrences of character in str in first N characters of repetitions.If str is “abac”, character is ch=‘b’ and N is 10.In first 10 characters of “abacabacabacabac…….” b occurs twice.Note − Take str and character ch within the same case.Let us understand with examples.For ExampleInputstr = "TPTTTT" ch = 'T' n = 12OutputCount of occurrences of a character in a repeated string are: 10ExplanationThe number of ‘T’ in str is 5. Length of str is 6. ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
680 Views
Suppose, we are given a set of intervals that consists of values (time1, time2) where time1 represents the starting time, and time2 represents the ending time of an event. Our task is to check whether any of these intervals overlap any other interval in this set. If any of the intervals overlap, we return the result as True, otherwise we return False.So, if the input is like [(4, 7), (5, 11), (7, 11), (5, 8)] then the output will be True.To solve this, we will follow these steps −sort the list inputArrfor i in range 1 to size of inputArr, ... Read More
![Arnab Chakraborty](https://www.tutorialspoint.com/assets/profiles/123881/profile/60_2940367-1661162113.png)
210 Views
Suppose we have an array nums of unique elements from 1 through n. We have to check whether it is stack-sortable or not. An array is stack sortable when it can be stored in some other array using a temporary stack.To solve this, we can use any of these operations on the array −Delete the starting element of array and push that item into the stack.Delete the top element of the stack and insert it to the end of second array.Now if all the element of the given array is transferred to the second array by these operations so the ... Read More
![Hafeezul Kareem](https://www.tutorialspoint.com/assets/profiles/120468/profile/60_159160-1581501828.jpg)
1K+ Views
In this tutorial, we are going to learn how to delete all prime nodes from a singly linked list.Let's see the steps to solve the problem.Write struct with data and next pointer.Write a function to insert the node into the singly linked list.Initialize the singly linked list with dummy data.Iterate over the singly linked list.Delete alternate node by maintaining the previous node.Write a function to delete the node. Consider the following three cases while deleting the node.If the node is head node, then move the head to next node.If the node is middle node, then link the next node to ... Read More
![Hafeezul Kareem](https://www.tutorialspoint.com/assets/profiles/120468/profile/60_159160-1581501828.jpg)
2K+ Views
In this tutorial, we are going to learn how to delete all prime nodes from a singly linked list.Let's see the steps to solve the problem.Write struct with data and next pointer.Write a function to insert the node into the singly linked list.Initialize the singly linked list with dummy data.Iterate over the singly linked list. Find whether the current node data is greater than x or not.If the current data is greater than x, then delete the node.Write a function to delete the node. Consider the following three cases while deleting the node.If the node is head node, then move ... Read More
![Hafeezul Kareem](https://www.tutorialspoint.com/assets/profiles/120468/profile/60_159160-1581501828.jpg)
84 Views
In this tutorial, we are going to learn how to delete all prime nodes from a doubly linked list.Let's see the steps to solve the problem.Write struct with data, prev and next pointers.Write a function to insert the node into the doubly linked list.Initialize the doubly linked list with dummy data.Iterate over the doubly linked list. Find whether the current node data is greater than given value or not.If the current data is greater than the given value, then delete the node.Write a function to delete the node. Consider the following three cases while deleting the node.If the node is ... Read More
![Hafeezul Kareem](https://www.tutorialspoint.com/assets/profiles/120468/profile/60_159160-1581501828.jpg)
200 Views
In this tutorial, we are going to learn how to delete all prime nodes from a doubly linked list.Let's see the steps to solve the problem.Write struct with data, prev and next pointers.Write a function to insert the node into the doubly linked list.Initialize the doubly linked list with dummy data.Iterate over the doubly linked list. Find whether the current node data is less than given value or not.If the current data is less than the given value, then delete the node.Write a function to delete the node. Consider the following three cases while deleting the node.If the node is ... Read More
![Hafeezul Kareem](https://www.tutorialspoint.com/assets/profiles/120468/profile/60_159160-1581501828.jpg)
722 Views
In this tutorial, we are going to learn how to delete all prime nodes from a doubly linked list.Let's see the steps to solve the problem.Write struct with data, prev and next pointers.Write a function to insert the node into the doubly linked list.Initialize the doubly linked list with dummy data.Iterate over the doubly linked list. Find whether the current node data is even or not.If the current data is even, then delete the node.Write a function to delete the node. Consider the following three cases while deleting the node.If the node is head node, then move the head to ... Read More