C++ Articles

Page 63 of 597

Deepest left leaf node in a binary tree in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 340 Views

In this tutorial, we are going to find the deepest left leaf node in the binary tree. Let's see the binary tree.   A       B    C D       E       F                      GLet's see the steps to solve the problem.Write a Node struct with char, left, and right pointers.Initialize the binary tree with dummy data.Write a recursive function to find the deepest left node in the binary function. It takes three argument root node, isLeftNode, and result pointer to store the deepest node.If the ...

Read More

Delete a Doubly Linked List node at a given position in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 2K+ Views

In this tutorial, we are going to learn how to delete a node in doubly linked list with the given position.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.Initialize the position to delete the node.Iterate over the linked list and find the node with the given position to 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

Delete a Linked List node at a given position in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 4K+ Views

In this tutorial, we are going to learn how to delete a node in singly linked list with the given position.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.Initialize the position to delete the node.Iterate over the linked list and find the node with the given position to 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 next ...

Read More

Delete all Non-Prime Nodes from a Singly Linked List in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 224 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 prime or not.If the current data is not prime, 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

Delete all Prime Nodes from a Doubly Linked List in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 247 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 prime or not.If the current data is prime, 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

Delete all Prime Nodes from a Singly Linked List in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 589 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 prime or not.If the current data is prime, 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 next ...

Read More

Delete all the even nodes from a Doubly Linked List in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 964 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

Delete all the nodes from a doubly linked list that are smaller than a given value in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 327 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

Delete all the nodes from the doubly linked list that are greater than a given value in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 219 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

Delete all the nodes from the list that are greater than x in C++

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 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
Showing 621–630 of 5,962 articles
« Prev 1 61 62 63 64 65 597 Next »
Advertisements