Hafeezul Kareem has Published 344 Articles

Deleting a binary tree using the delete keyword in C++ program

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Jan-2021 12:11:35

2K+ Views

In this tutorial, we are going to learn how to delete a binary tree using the delete keyword.We are going to use a destructor member function to delete the binary. The destructor member function is invoked automatically when the object goes out of the scope or it is destroyed by ... Read More

Delete N nodes after M nodes of a linked list in C++ program

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Jan-2021 12:08:51

744 Views

In this tutorial, we are going to learn how to delete N nodes after M nodes in a linked list.Let's see the steps to solve the problem.Write a struct Node for the linked list node.Initialize the linked list with the dummy data.Write a function to delete N nodes after M ... Read More

Delete middle of linked list in C++ program

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Jan-2021 12:06:58

3K+ Views

In this tutorial, we are going to learn how to delete the middle node in a linked list.The solution to the problem is straightforward. We will have two pointers one moves one node at a time and the other one moves two nodes at a time. By the time the ... Read More

Delete leaf nodes with value k in C++ program

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Jan-2021 12:05:33

74 Views

In this tutorial, we are going to learn how to delete the leaf nodes from a tree with the given value.Let's see the steps to solve the problem.Write a struct Node for a binary tree.Write a function to traverse (inorder, preorder, postorder) through the tree and print all data.Initialize the ... Read More

Delete leaf nodes with value as x in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Jan-2021 12:02:19

952 Views

In this tutorial, we are going to learn how to delete the leaf nodes from a tree with the given value.Let's see the steps to solve the problem.Write a struct Node for a binary tree.Write a function to traverse (inorder, preorder, postorder) through the tree and print all data.Initialize the ... Read More

Delete array element in given index range [L – R] in C++ Program

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Jan-2021 12:01:58

20K+ Views

In this tutorial, we are going to learn how to delete elements from the given range. Let's see the steps to solve the problem.Initialize the array and range to delete the elements from.Initialize a new index variable.Iterate over the array.If the current index is not in the given range, then ... Read More

Delete an element from array using two traversals and one traversal in C++ program

Hafeezul Kareem

Hafeezul Kareem

Updated on 27-Jan-2021 12:01:37

340 Views

In this tutorial, we are going to learn how to delete an element with two loops and on loop. We don't need to delete the element. We will just replace the deleting element with the next elements.Two TraversalsLet's see the steps to delete an element from the array using two ... Read More

Delete alternate nodes of a Linked List in C++

Hafeezul Kareem

Hafeezul Kareem

Updated on 30-Dec-2020 07:01:21

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 ... Read More

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

Hafeezul Kareem

Hafeezul Kareem

Updated on 30-Dec-2020 06:59:33

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 ... 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 30-Dec-2020 06:57:36

83 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 ... Read More

Advertisements