public void Contains() { Multiset <string> multiset = new Multiset <string>(); multiset.Add("a"); Assert.IsTrue(multiset.Contains("a")); multiset.Add("a"); Assert.IsTrue(multiset.Contains("a")); multiset.Remove("a"); multiset.Remove("a"); Assert.IsFalse(multiset.Contains("a")); }
public void Contains() { Multiset<string> multiset = new Multiset<string>(); multiset.Add("a"); Assert.IsTrue(multiset.Contains("a")); multiset.Add("a"); Assert.IsTrue(multiset.Contains("a")); multiset.Remove("a"); multiset.Remove("a"); Assert.IsFalse(multiset.Contains("a")); }
private static void Multiset(ListNode<int> head) { Multiset<int> multiset = new Multiset<int>(); ListNode<int> previous = null; while(head != null) { if (multiset.Contains(head.Value)) previous.Next = head.Next; else { previous = head; multiset.Add(head.Value); } head = head.Next; } }
private static void Multiset(ListNode <int> head) { Multiset <int> multiset = new Multiset <int>(); ListNode <int> previous = null; while (head != null) { if (multiset.Contains(head.Value)) { previous.Next = head.Next; } else { previous = head; multiset.Add(head.Value); } head = head.Next; } }