Header Ads

[DSA] Exercises for doubly linked list


  1. Write a C program that inserts a node at a given index in the doubly linked list.
  2. Write a C program that reverses the order of the elements in a doubly linked list.
  3. Write a C program that removes the first occurrence of a given element from the doubly linked list.
  4. Write a C program that removes all occurrences of a given element from the doubly linked list.
  5. Write a C program that returns the middle element of a doubly linked list.
  6. Write a C program that merges two sorted doubly linked lists into a single sorted doubly linked list.
  7. Write a C program that sorts a doubly linked list in ascending order.
  8. Write a C program that computes the intersection of two doubly linked lists.
  9. Write a C program that computes the union of two doubly linked lists.
  10. Write a C program that checks if a doubly linked list is a palindrome.
  11. Write a C program that deletes the last node of a doubly linked list.
  12. Write a C program that finds the second last node of a doubly linked list.
  13. Write a C program that rotates a doubly linked list by a given number of nodes.
  14. Write a C program that splits a doubly linked list into two halves.
  15. Write a C program that deletes all nodes of a doubly linked list.
  16. Write a C program that deletes nodes from the doubly linked list which are less than a given value.
  17. Write a C program that removes duplicates from a doubly linked list.
  18. Write a C program that finds the kth node from the end of a doubly linked list.
  19. Write a C program that swaps two nodes in a doubly linked list.
  20. Write a C program that inserts a node at the beginning of a doubly linked list.
  21. Write a C program that adds two doubly linked lists of the same length.
  22. Write a C program that adds a doubly linked list and a singly linked list.
  23. Write a C program that adds a node at the end of a doubly linked list.
  24. Write a C program that checks if a doubly linked list is sorted in descending order.
  25. Write a C program that deletes a node from a doubly linked list given its index.
  26. Write a C program that removes all nodes from a doubly linked list that are greater than a given value.
  27. Write a C program that sorts a doubly linked list in descending order.
  28. Write a C program that computes the sum of all elements in a doubly linked list.
  29. Write a C program that computes the average of all elements in a doubly linked list.
  30. Write a C program that returns the maximum and minimum elements in a doubly linked list.
  31. Write a C program that finds the longest consecutive sequence of nodes with consecutive data values in a doubly linked list.
  32. Write a C program that finds the median element of a doubly linked list.
  33. Write a C program that performs a binary search on a sorted doubly linked list.
  34. Write a C program that creates a doubly linked list from an array.
  35. Write a C program that rotates a doubly linked list by a given number of positions in a single pass.
  36. Write a C program that removes all nodes from a doubly linked list except the ones at odd positions.
  37. Write a C program that removes all nodes from a doubly linked list except the ones at even positions.
  38. Write a C program that removes nodes from a doubly linked list such that no two adjacent nodes have the same value.
  39. Write a C program that finds the sum of all elements in a doubly linked list between two given indices.
  40. Write a C program that finds the product of all elements in a doubly linked list between two given indices.
  41. Write a C program that finds the maximum subarray sum in a doubly linked list.
  42. Write a C program that reverses every k nodes of a doubly linked list.
  43. Write a C program that merges two sorted doubly linked lists.
  44. Write a C program that deletes every nth node from a doubly linked list.
  45. Write a C program that checks if a doubly linked list is a palindrome.
  46. Write a C program that removes all nodes from a doubly linked list that appear more than once.
  47. Write a C program that removes all nodes from a doubly linked list that are not part of any increasing subsequence.
  48. Write a C program that removes all nodes from a doubly linked list that are not part of any decreasing subsequence.
  49. Write a C program that deletes all nodes from a doubly linked list that are not divisible by a given number.
  50. Write a C program that finds the length of the longest palindromic subsequence in a doubly linked list.
  51. Write a C program that performs a quicksort on a doubly linked list.
  52. Write a C program that finds the kth smallest element in a doubly linked list.
  53. Write a C program that inserts a node in a sorted doubly linked list in its correct position.
  54. Write a C program that removes all nodes from a doubly linked list that have duplicates.
  55. Write a C program that reverses the order of a doubly linked list.
  56. Write a C program that checks if a doubly linked list is a circular linked list.
  57. Write a C program that rotates a doubly linked list by k positions to the left.
  58. Write a C program that removes all nodes from a doubly linked list that are not part of any strictly increasing subsequence.
  59. Write a C program that removes all nodes from a doubly linked list that are not part of any strictly decreasing subsequence.
  60. Write a C program that finds the kth largest element in a doubly linked list.
  61. Write a C program that finds the longest increasing subsequence in a doubly linked list.
  62. Write a C program that deletes all nodes from a doubly linked list that are not part of any non-decreasing subsequence.
  63. Write a C program that inserts a node in a sorted doubly linked list in such a way that the list remains sorted.
  64. Write a C program that finds the length of the longest common subsequence between two doubly linked lists.
  65. Write a C program that merges k sorted doubly linked lists into a single sorted doubly linked list.
  66. Write a C program that deletes every node from a doubly linked list that is equal to a given value.
  67. Write a C program that checks if a doubly linked list is a palindrome without using extra space.
  68. Write a C program that finds the kth element from the end of a doubly linked list.
  69. Write a C program that removes all nodes from a doubly linked list that are not part of any non-increasing subsequence.
  70. Write a C program that finds the maximum sum subarray in a doubly linked list.
  71. Write a C program that finds the median of a sorted doubly linked list.
  72. Write a C program that finds the longest palindrome subsequence in a doubly linked list.
  73. Write a C program that removes all nodes from a doubly linked list that have a value outside a given range.
  74. Write a C program that finds the largest subarray with equal number of 0s and 1s in a doubly linked list.
  75. Write a C program that merges two sorted doubly linked lists into a single sorted doubly linked list in descending order.
  76. Write a C program that converts a binary tree to a doubly linked list in inorder traversal.
  77. Write a C program that checks if a doubly linked list is a rotation of another doubly linked list.
  78. Write a C program that finds the largest subarray with distinct elements in a doubly linked list.
  79. Write a C program that removes all nodes from a doubly linked list that have a value equal to the average of the values of its neighbors.
  80. Write a C program that finds the length of the longest subarray with alternating positive and negative elements in a doubly linked list.


Không có nhận xét nào

Được tạo bởi Blogger.