{"id":3763,"date":"2020-11-10T22:46:23","date_gmt":"2020-11-10T22:46:23","guid":{"rendered":"http:\/\/onlineclassesguru.com\/?p=3763"},"modified":"2020-11-10T22:46:33","modified_gmt":"2020-11-10T22:46:33","slug":"set-adt","status":"publish","type":"post","link":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/","title":{"rendered":"Set ADT"},"content":{"rendered":"<style type=\"text\/css\"><\/style><div class=\"css-tib94n\">\n<div class=\"css-w0lstx\">\n<div>Project Description: You are to implement a Set ADT using a singly linked list where your data structure in your class will look something like this: Note that this is a singly linked list with a dummy head node. Each node has two fields: the object and the link. You shouldn&#8217;t assume that data elements are integers. Instead, they should be objects. An element either belongs to a set or it does not. No duplicates are allowed. Here are the standard operations you must build into you set class. Note there are no exceptions raised. contain: returns Boolean value. Returns true if the given object is contained in the set and false otherwise. remove: returns Boolean value. Returns true if the node containing the object is removed from the set and false otherwise. addElement: returns Boolean value. Returns false if element not added because it is already in the set and true if the element is added. size: returns an integer equal to the number of distinct objects are in the Set. subsetOf: returns a Boolean value true if every element in set A is in set B and false otherwise. isEqual: returns true if both sets contain the same elements where order in either set does not count. union: if A, B, C are sets, has the form C = A.union(B). Union returns a Set that contains all the elements in set A and B, but only list duplicates once. intersection: if A, B, C are sets, has form C = A.intersection(B) and returns a set containing only elements that are common to both A and B, but no duplicates. complement: if A, B, C are sets, has form C = A.complement(B) and returns a set containing only elements that are in A but not in B. toString: displays a message that indicates an object&#8217;s state. An object&#8217;s state is the data that is stored in the object&#8217;s fields at any giving moment. Remember from your CS130 that the empty set is a set and the empty set is a subset of every set. If A={1, 3, 5, 7}, B={3, 4, 5}, D = {}, THEN if C=A.union(B): then C={1, 3, 4, 5, 7}; if C=A.intersection(B): then C={3, 5}; if C=A.complement(B): then C={1, 7}; D.subsetOf(A) returns true; D.subsetOf(B) returns true; D.subsetOf(C) returns true and; D.subsetOf(D) also returns true. A.subsetOf(B) returns false, but (A.intersection(B)).subsetOf(A) returns true You may implement the Set using either a Node outside the Set class with all its getters and setters or the way we covered in class where the node is a private class of set. You must write a test program to test you Set ADT. Remember that when you test subset, union, intersection and complement, test each method with at least the following five cases: Case 1: A and B are equal but distinct sets, for example, A = {1, 2, 3}, B = {2, 1, 3} Case 2: A and B are such that they have different sizes but one is a subset of the other, for example, A = {1}, B = {1, 2} Case 3: A and B are non-empty and different in size but have common elements, for example, A = {1, 2, 3}, B = {2, 3, 4, 5} Case 4: they are non-empty with nothing in common, for example, A = {1}, B = {2, 3}, and Case 5: one is non-empty and the other empty.<\/div>\n<\/div>\n<\/div>\n<div class=\"css-6a9esh\">\n<div class=\"css-eql546\"><\/div>\n<\/div>\n<div class=\"css-uockkt\"><\/div>\n<p><center><a href=\"http:\/\/onlineclassesguru.com\/orders\/ordernow\"><img decoding=\"async\" src=\"https:\/\/encrypted-tbn0.gstatic.com\/images?q=tbn:ANd9GcTyj99p60XCLyLk1htB7-1neRt8-2QdnenNlQ&usqp=CAU\"target=\"_http:\/\/onlineclassesguru.com\/orders\/ordernow\"\/><\/center><p>","protected":false},"excerpt":{"rendered":"<p>Project Description: You are to implement a Set ADT using a singly linked list where your data structure in your class will look something like this: Note that this is a singly linked list with a dummy head node. Each node has two fields: the object and the link. You shouldn&#8217;t assume that data elements&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3763","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v17.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Set ADT - onlineclassesguru<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Set ADT - onlineclassesguru\" \/>\n<meta property=\"og:description\" content=\"Project Description: You are to implement a Set ADT using a singly linked list where your data structure in your class will look something like this: Note that this is a singly linked list with a dummy head node. Each node has two fields: the object and the link. You shouldn&#8217;t assume that data elements...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/\" \/>\n<meta property=\"og:site_name\" content=\"onlineclassesguru\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-10T22:46:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-10T22:46:33+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin_admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/onlineclassesguru.com\/#website\",\"url\":\"https:\/\/onlineclassesguru.com\/\",\"name\":\"onlineclassesguru\",\"description\":\"Cheap Professional coursework and reaction papers help\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/onlineclassesguru.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/#webpage\",\"url\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/\",\"name\":\"Set ADT - onlineclassesguru\",\"isPartOf\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#website\"},\"datePublished\":\"2020-11-10T22:46:23+00:00\",\"dateModified\":\"2020-11-10T22:46:33+00:00\",\"author\":{\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\"},\"breadcrumb\":{\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/onlineclassesguru.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Set ADT\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742\",\"name\":\"admin_admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/onlineclassesguru.com\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g\",\"caption\":\"admin_admin\"},\"url\":\"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Set ADT - onlineclassesguru","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:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/","og_locale":"en_US","og_type":"article","og_title":"Set ADT - onlineclassesguru","og_description":"Project Description: You are to implement a Set ADT using a singly linked list where your data structure in your class will look something like this: Note that this is a singly linked list with a dummy head node. Each node has two fields: the object and the link. You shouldn&#8217;t assume that data elements...","og_url":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/","og_site_name":"onlineclassesguru","article_published_time":"2020-11-10T22:46:23+00:00","article_modified_time":"2020-11-10T22:46:33+00:00","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin_admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/onlineclassesguru.com\/#website","url":"https:\/\/onlineclassesguru.com\/","name":"onlineclassesguru","description":"Cheap Professional coursework and reaction papers help","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/onlineclassesguru.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/#webpage","url":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/","name":"Set ADT - onlineclassesguru","isPartOf":{"@id":"https:\/\/onlineclassesguru.com\/#website"},"datePublished":"2020-11-10T22:46:23+00:00","dateModified":"2020-11-10T22:46:33+00:00","author":{"@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742"},"breadcrumb":{"@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/onlineclassesguru.com\/index.php\/2020\/11\/10\/set-adt\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/onlineclassesguru.com\/"},{"@type":"ListItem","position":2,"name":"Set ADT"}]},{"@type":"Person","@id":"https:\/\/onlineclassesguru.com\/#\/schema\/person\/1831fa4d28e47b468621cf27932f5742","name":"admin_admin","image":{"@type":"ImageObject","@id":"https:\/\/onlineclassesguru.com\/#personlogo","inLanguage":"en-US","url":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/429c8d043f7a770af242b0031e8b9f2b?s=96&d=mm&r=g","caption":"admin_admin"},"url":"https:\/\/onlineclassesguru.com\/index.php\/author\/admin_admin\/"}]}},"_links":{"self":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3763"}],"collection":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/comments?post=3763"}],"version-history":[{"count":1,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3763\/revisions"}],"predecessor-version":[{"id":3764,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/posts\/3763\/revisions\/3764"}],"wp:attachment":[{"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/media?parent=3763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/categories?post=3763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/onlineclassesguru.com\/index.php\/wp-json\/wp\/v2\/tags?post=3763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}