Hafeezul Kareem

Hafeezul Kareem

259 Articles Published

Articles by Hafeezul Kareem

Page 11 of 26

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

Hafeezul Kareem
Hafeezul Kareem
Updated on 11-Mar-2026 212 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 235 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 577 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 949 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 312 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 198 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

Delete alternate nodes of a Linked List in C++

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

Find three integers less than or equal to N such that their LCM is maximum - C++

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

In this tutorial, we are going to write a program that is based on the concepts of LCM. As the title says, we have to find three numbers that are less than or equal to the given number whose LCM is maximum.Let's see an example.Before diving into the problem let's see what LCM is and write program for it.LCM is the least common multiple of a number. It is also known as Least common divisor. For two positive number a and b, the LCM is the smallest integer that is evenly divisible by both a and b.If the given integers ...

Read More

Find time taken for signal to reach all positions in a string - C++

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

In this tutorial, we are going to write a program that computes the time taken for a signal to reach all positions in a string. Let me explain it with an example.We will have a string that contains only s and p characters. s is a signal and p is a position in the string. A signal starts at s and travels in both left and right directions. We are assuming it takes one unit of time to travel to the next position in the string. Our task is to compute the time needed to convert all positions into signals.Let's ...

Read More
Showing 101–110 of 259 articles
« Prev 1 9 10 11 12 13 26 Next »
Advertisements