{"id":476,"date":"2021-07-13T11:14:06","date_gmt":"2021-07-13T11:14:06","guid":{"rendered":"https:\/\/www.wikitechy.com\/interview-questions\/?p=476"},"modified":"2021-09-13T10:24:56","modified_gmt":"2021-09-13T10:24:56","slug":"how-to-remove-duplicates-from-a-sorted-linked-list","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/","title":{"rendered":"How to remove duplicates from a sorted linked list ?"},"content":{"rendered":"<div class=\"TextHeading\">\n<div class=\"hddn\">\n<h2 id=\"how-to-remove-duplicates-from-a-sorted-linked-list\" class=\"color-pink\" style=\"text-align: justify;\">How to remove duplicates from a sorted linked list ?<\/h2>\n<\/div>\n<\/div>\n<div class=\"Content\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<ul>\n<li>To write a removeDuplicates() function which takes a\u00a0<a href=\"https:\/\/www.wikitechy.com\/interview-questions\/latex\/what-are-the-list-of-latex\/\" target=\"_blank\" rel=\"noopener\">list<\/a>\u00a0sorted from the list any duplicate nodes to be deleted. The list should be traversed only once.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"TextHeading\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<h2 id=\"algorithm\" class=\"color-green\">Algorithm<\/h2>\n<\/div>\n<\/div>\n<div class=\"Content\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<ul>\n<li>Traverse the head (or start) node from the list. Compare each node with its next node while\u00a0<a href=\"https:\/\/www.wikitechy.com\/technology\/python-algorithm-circular-linked-list-traversal\/\" target=\"_blank\" rel=\"noopener\">traversing<\/a>.<\/li>\n<li>If same as the current node and data of next node to be delete that node. Before we delete a node, we need to store next pointer of the node.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"TextHeading\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<h2 id=\"implementation\" class=\"color-green\">Implementation<\/h2>\n<\/div>\n<\/div>\n<div class=\"Content\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<ul>\n<li><a href=\"https:\/\/www.wikitechy.com\/tutorials\/sql\/functions-in-sql\" target=\"_blank\" rel=\"noopener\">Functions<\/a>\u00a0other than removeDuplicates() are just to create a linked.<\/li>\n<li><a href=\"https:\/\/www.wikitechy.com\/tutorials\/java\/java-linked-list\" target=\"_blank\" rel=\"noopener\">Linked list<\/a>\u00a0to be tested and removeDuplicates() from the list.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<div class=\"ImageContent\">\n<div class=\"hddn\"><img decoding=\"async\" class=\"img-responsive center-block aligncenter\" src=\"https:\/\/cdn.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list.png\" alt=\" Remove Duplicate From a Sorting Linked List\" \/><\/div>\n<div>\n<h2 id=\"sample-code-in-java\" class=\"color-blue\" style=\"text-align: justify;\">Sample Code in Java<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-javascript code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-javascript code-embed-code\">class LinkedListExample <br\/>{ <br\/>\tNode head; \/\/ head of list <br\/><br\/>\t\/* Linked list Node*\/<br\/>\tclass Node <br\/>\t{ <br\/>\t\tint data; <br\/>\t\tNode next; <br\/>\t\tNode(int d) {data = d; next = null; } <br\/>\t} <br\/><br\/>\tvoid removeDuplicates() <br\/>\t{ <br\/>\t\t\/*Another reference to head*\/<br\/>\t\tNode current = head; <br\/><br\/>\t\t\/* Pointer to store the next pointer of a node to be deleted*\/<br\/>\t\tNode next_next; <br\/><br\/>\t\t\/* do nothing if the list is empty *\/<br\/>\t\tif (head == null)\t <br\/>\t\t\treturn; <br\/><br\/>\t\t\/* Traverse list till the last node *\/<br\/>\t\twhile (current.next != null) { <br\/><br\/>\t\t\t\/*Compare current node with the next node *\/<br\/>\t\t\tif (current.data == current.next.data) { <br\/>\t\t\t\tnext_next = current.next.next; <br\/>\t\t\t\tcurrent.next = null; <br\/>\t\t\t\tcurrent.next = next_next; <br\/>\t\t\t} <br\/>\t\t\telse \/\/ advance if no deletion <br\/>\t\t\tcurrent = current.next; <br\/>\t\t} <br\/>\t} <br\/>\t\t\t\t\t<br\/>\t\/* Utility functions *\/<br\/><br\/>\t\/* Inserts a new Node at front of the list. *\/<br\/>\tpublic void push(int new_data) <br\/>\t{ <br\/>\t\t\/* 1 & 2: Allocate the Node & <br\/>\t\t\t\tPut in the data*\/<br\/>\t\tNode new_node = new Node(new_data); <br\/><br\/>\t\t\/* 3. Make next of new Node as head *\/<br\/>\t\tnew_node.next = head; <br\/><br\/>\t\t\/* 4. Move the head to point to new Node *\/<br\/>\t\thead = new_node; <br\/>\t} <br\/><br\/>\t\/* Function to print linked list *\/<br\/>\tvoid printList() <br\/>\t{ <br\/>\t\tNode temp = head; <br\/>\t\twhile (temp != null) <br\/>\t\t{ <br\/>\t\t\tSystem.out.print(temp.data+&quot; &quot;); <br\/>\t\t\ttemp = temp.next; <br\/>\t\t} <br\/>\t\tSystem.out.println(); <br\/>\t} <br\/><br\/>\t\/* Drier program to test above functions *\/<br\/>\tpublic static void main(String args[]) <br\/>\t{ <br\/>\t\tLinkedListExample wikitechylist = new LinkedListExample(); <br\/>\t\twikitechylist.push(63); <br\/>\t\twikitechylist.push(50); <br\/>\t\twikitechylist.push(50); <br\/>\t\twikitechylist.push(42); <br\/>\t\twikitechylist.push(27); <br\/>\t\twikitechylist.push(27); <br\/>\t\t<br\/>\t\tSystem.out.println(&quot;LinkedList before removal of duplicates&quot;); <br\/>\t\twikitechylist.printList(); <br\/>\t\t<br\/>\t\twikitechylist.removeDuplicates(); <br\/>\t\t<br\/>\t\tSystem.out.println(&quot;LinkedList after removal of elements&quot;); <br\/>\t\twikitechylist.printList(); <br\/>\t} <br\/>} <\/code><\/pre> <\/div>\n<div class=\"Output\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<figure class=\"highlight\"><div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-markdown code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-markdown code-embed-code\">LinkedList before removal of duplicates<br\/>27 27 42 50 50 63 <br\/>LinkedList after removal of elements<br\/>27 42 50 63<\/code><\/pre> <\/div><\/figure>\n<\/div>\n<\/div>\n<div class=\"TextHeading\" style=\"text-align: justify;\">\n<div class=\"hddn\">\n<h2 id=\"time-complexity\" class=\"color-blue\">Time Complexity<\/h2>\n<\/div>\n<\/div>\n<div class=\"Content\">\n<div class=\"hddn\">\n<ul>\n<li style=\"text-align: justify;\">O(n) where n is number of nodes in the given linked list.<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Answer : To write a removeDuplicates() function which takes a list sorted&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3028],"tags":[195,3210,971,491,221,368,203,199,214,198,363,3057,205,3209,222,15934,484,3054,196,212,3189,3206,3205,3200,3202,3207,207,366,204,3213,3212,3208,3198,3201,206,972,3211,3197,3204,3203,200,3055,197,968,3056,285,969],"class_list":["post-476","post","type-post","status-publish","format-standard","hentry","category-data-structure","tag-accenture-interview-questions-and-answers","tag-algorithm-to-remove-duplicate-elements-from-linked-list","tag-altimetrik-india-pvt-ltd-interview-questions-and-answers","tag-applied-materials-interview-questions-and-answers","tag-bharti-airtel-interview-questions-and-answers","tag-bmc-software-interview-questions-and-answers","tag-capgemini-interview-questions-and-answers","tag-casting-networks-india-pvt-limited-interview-questions-and-answers","tag-cgi-group-inc-interview-questions-and-answers","tag-chetu-interview-questions-and-answers","tag-ciena-corporation-interview-questions-and-answers","tag-collabera-te-interview-questions-and-answers","tag-dell-international-services-india-pvt-ltd-interview-questions-and-answers","tag-find-duplicates-in-linked-list-java","tag-flipkart-interview-questions-and-answers","tag-geekyants-interview-questions-and-answers","tag-genpact-interview-questions-and-answers","tag-globallogic-india-pvt-ltd-interview-questions-and-answers","tag-ibm-interview-questions-and-answers","tag-indecomm-global-services-interview-questions-and-answers","tag-linked-list-algorithm","tag-linked-list-implementation-in-java","tag-linked-list-insertion","tag-linked-list-interview-questions","tag-linked-list-program-in-java","tag-merge-sort-linked-list","tag-mphasis-interview-questions-and-answers","tag-netapp-interview-questions-and-answers","tag-oracle-corporation-interview-questions-and-answers","tag-remove-duplicates-from-linked-list-java","tag-remove-duplicates-from-sorted-linked-list-java","tag-remove-duplicates-from-unsorted-linked-list","tag-reverse-a-linked-lis","tag-reverse-linked-list-java","tag-sap-labs-india-pvt-ltd-interview-questions-and-answers","tag-sapient-consulting-pvt-ltd-interview-questions-and-answers","tag-searches-related-to-remove-duplicates-from-unsorted-linked-list","tag-singly-linked-list","tag-sort-linked-list-java","tag-sort-linked-listmerge-two-sorted-linked-lists","tag-tech-mahindra-interview-questions-and-answers","tag-tracxn-technologies-pvt-ltd-interview-questions-and-answers","tag-unitedhealth-group-interview-questions-and-answers","tag-wipro-infotech-interview-questions-and-answers","tag-wm-global-technology-services-india-pvt-ltd-limited-wmgts-interview-questions-and-answers","tag-xoriant-solutions-pvt-ltd-interview-questions-and-answers","tag-yodlee-infotech-pvt-ltd-interview-questions-and-answers"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to remove duplicates from a sorted linked list ? - Data Structure<\/title>\n<meta name=\"description\" content=\"How to remove duplicates from a sorted linked list ? - Write a removeDuplicates() function which takes a list sorted from the list any duplicate nodes to be deleted.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to remove duplicates from a sorted linked list ? - Data Structure\" \/>\n<meta property=\"og:description\" content=\"How to remove duplicates from a sorted linked list ? - Write a removeDuplicates() function which takes a list sorted from the list any duplicate nodes to be deleted.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/\" \/>\n<meta property=\"og:site_name\" content=\"Wikitechy\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-13T11:14:06+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-13T10:24:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list.png\" \/>\n<meta name=\"author\" content=\"Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/\"},\"author\":{\"name\":\"Editor\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"headline\":\"How to remove duplicates from a sorted linked list ?\",\"datePublished\":\"2021-07-13T11:14:06+00:00\",\"dateModified\":\"2021-09-13T10:24:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/\"},\"wordCount\":577,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdn.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list.png\",\"keywords\":[\"Accenture interview questions and answers\",\"algorithm to remove duplicate elements from linked list\",\"Altimetrik India Pvt Ltd interview questions and answers\",\"Applied Materials interview questions and answers\",\"Bharti Airtel interview questions and answers\",\"BMC Software interview questions and answers\",\"Capgemini interview questions and answers\",\"CASTING NETWORKS INDIA PVT LIMITED interview questions and answers\",\"CGI Group Inc interview questions and answers\",\"Chetu interview questions and answers\",\"Ciena Corporation interview questions and answers\",\"Collabera Te interview questions and answers\",\"Dell International Services India Pvt Ltd interview questions and answers\",\"find duplicates in linked list java\",\"Flipkart interview questions and answers\",\"geekyants interview questions and answers\",\"Genpact interview questions and answers\",\"Globallogic India Pvt Ltd interview questions and answers\",\"IBM interview questions and answers\",\"Indecomm Global Services interview questions and answers\",\"linked list algorithm\",\"linked list implementation in java\",\"linked list insertion\",\"linked list interview questions\",\"linked list program in java\",\"merge sort linked list\",\"Mphasis interview questions and answers\",\"NetApp interview questions and answers\",\"Oracle Corporation interview questions and answers\",\"remove duplicates from linked list java\",\"remove duplicates from sorted linked list java\",\"remove duplicates from unsorted linked list\",\"reverse a linked lis\",\"reverse linked list java\",\"SAP Labs India Pvt Ltd interview questions and answers\",\"Sapient Consulting Pvt Ltd interview questions and answers\",\"Searches related to remove duplicates from unsorted linked list\",\"singly linked list\",\"sort linked list java\",\"sort linked listmerge two sorted linked lists\",\"Tech Mahindra interview questions and answers\",\"Tracxn Technologies Pvt Ltd interview questions and answers\",\"UnitedHealth Group interview questions and answers\",\"Wipro Infotech interview questions and answers\",\"WM Global Technology Services India Pvt.Ltd Limited (WMGTS) interview questions and answers\",\"Xoriant Solutions Pvt Ltd interview questions and answers\",\"Yodlee Infotech Pvt Ltd interview questions and answers\"],\"articleSection\":[\"Data Structure\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/\",\"name\":\"How to remove duplicates from a sorted linked list ? - Data Structure\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/cdn.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list.png\",\"datePublished\":\"2021-07-13T11:14:06+00:00\",\"dateModified\":\"2021-09-13T10:24:56+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\"},\"description\":\"How to remove duplicates from a sorted linked list ? - Write a removeDuplicates() function which takes a list sorted from the list any duplicate nodes to be deleted.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list\\\/#primaryimage\",\"url\":\"https:\\\/\\\/cdn.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list.png\",\"contentUrl\":\"https:\\\/\\\/cdn.wikitechy.com\\\/interview-questions\\\/data-structure\\\/how-to-remove-duplicates-from-a-sorted-linked-list.png\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#website\",\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/\",\"name\":\"Wikitechy\",\"description\":\"Interview Questions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/#\\\/schema\\\/person\\\/4d5a581fb5470d1560324bddc5e8b757\",\"name\":\"Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g\",\"caption\":\"Editor\"},\"url\":\"https:\\\/\\\/www.wikitechy.com\\\/interview-questions\\\/author\\\/editor\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to remove duplicates from a sorted linked list ? - Data Structure","description":"How to remove duplicates from a sorted linked list ? - Write a removeDuplicates() function which takes a list sorted from the list any duplicate nodes to be deleted.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/","og_locale":"en_US","og_type":"article","og_title":"How to remove duplicates from a sorted linked list ? - Data Structure","og_description":"How to remove duplicates from a sorted linked list ? - Write a removeDuplicates() function which takes a list sorted from the list any duplicate nodes to be deleted.","og_url":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/","og_site_name":"Wikitechy","article_published_time":"2021-07-13T11:14:06+00:00","article_modified_time":"2021-09-13T10:24:56+00:00","og_image":[{"url":"https:\/\/cdn.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list.png","type":"","width":"","height":""}],"author":"Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Editor","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/#article","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/"},"author":{"name":"Editor","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"headline":"How to remove duplicates from a sorted linked list ?","datePublished":"2021-07-13T11:14:06+00:00","dateModified":"2021-09-13T10:24:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/"},"wordCount":577,"commentCount":0,"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list.png","keywords":["Accenture interview questions and answers","algorithm to remove duplicate elements from linked list","Altimetrik India Pvt Ltd interview questions and answers","Applied Materials interview questions and answers","Bharti Airtel interview questions and answers","BMC Software interview questions and answers","Capgemini interview questions and answers","CASTING NETWORKS INDIA PVT LIMITED interview questions and answers","CGI Group Inc interview questions and answers","Chetu interview questions and answers","Ciena Corporation interview questions and answers","Collabera Te interview questions and answers","Dell International Services India Pvt Ltd interview questions and answers","find duplicates in linked list java","Flipkart interview questions and answers","geekyants interview questions and answers","Genpact interview questions and answers","Globallogic India Pvt Ltd interview questions and answers","IBM interview questions and answers","Indecomm Global Services interview questions and answers","linked list algorithm","linked list implementation in java","linked list insertion","linked list interview questions","linked list program in java","merge sort linked list","Mphasis interview questions and answers","NetApp interview questions and answers","Oracle Corporation interview questions and answers","remove duplicates from linked list java","remove duplicates from sorted linked list java","remove duplicates from unsorted linked list","reverse a linked lis","reverse linked list java","SAP Labs India Pvt Ltd interview questions and answers","Sapient Consulting Pvt Ltd interview questions and answers","Searches related to remove duplicates from unsorted linked list","singly linked list","sort linked list java","sort linked listmerge two sorted linked lists","Tech Mahindra interview questions and answers","Tracxn Technologies Pvt Ltd interview questions and answers","UnitedHealth Group interview questions and answers","Wipro Infotech interview questions and answers","WM Global Technology Services India Pvt.Ltd Limited (WMGTS) interview questions and answers","Xoriant Solutions Pvt Ltd interview questions and answers","Yodlee Infotech Pvt Ltd interview questions and answers"],"articleSection":["Data Structure"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/","url":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/","name":"How to remove duplicates from a sorted linked list ? - Data Structure","isPartOf":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/#primaryimage"},"image":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list.png","datePublished":"2021-07-13T11:14:06+00:00","dateModified":"2021-09-13T10:24:56+00:00","author":{"@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757"},"description":"How to remove duplicates from a sorted linked list ? - Write a removeDuplicates() function which takes a list sorted from the list any duplicate nodes to be deleted.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list\/#primaryimage","url":"https:\/\/cdn.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list.png","contentUrl":"https:\/\/cdn.wikitechy.com\/interview-questions\/data-structure\/how-to-remove-duplicates-from-a-sorted-linked-list.png"},{"@type":"WebSite","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#website","url":"https:\/\/www.wikitechy.com\/interview-questions\/","name":"Wikitechy","description":"Interview Questions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wikitechy.com\/interview-questions\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.wikitechy.com\/interview-questions\/#\/schema\/person\/4d5a581fb5470d1560324bddc5e8b757","name":"Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e9531079fe7e07841b7b156c04d65e5f39d4adfd18b6ffe3edfff8ca5aab85b5?s=96&d=mm&r=g","caption":"Editor"},"url":"https:\/\/www.wikitechy.com\/interview-questions\/author\/editor\/"}]}},"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/476","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/comments?post=476"}],"version-history":[{"count":4,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/476\/revisions"}],"predecessor-version":[{"id":3532,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/posts\/476\/revisions\/3532"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/media?parent=476"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/categories?post=476"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/interview-questions\/wp-json\/wp\/v2\/tags?post=476"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}