From 1374ebd3b406c0fd637032f3c9ba7ab72c262f81 Mon Sep 17 00:00:00 2001 From: Rajesh Balaraman Date: Mon, 23 Jul 2018 22:34:00 -0700 Subject: [PATCH] Replaced Dictionary with HashSet and changed the corresponding methods. --- Ch 02. Linked Lists/Q2_01_Remove_Dups.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Ch 02. Linked Lists/Q2_01_Remove_Dups.cs b/Ch 02. Linked Lists/Q2_01_Remove_Dups.cs index b68d7f9..9107c98 100644 --- a/Ch 02. Linked Lists/Q2_01_Remove_Dups.cs +++ b/Ch 02. Linked Lists/Q2_01_Remove_Dups.cs @@ -24,12 +24,12 @@ private void Tap(int i) private void DeleteDupsA(LinkedListNode node) { - var table = new Dictionary(); + var table = new HashSet(); LinkedListNode previous = null; while (node != null) { - if (table.ContainsKey(node.Data)) + if (table.Contains(node.Data)) { if (previous != null) { @@ -38,7 +38,7 @@ private void DeleteDupsA(LinkedListNode node) } else { - table.Add(node.Data, true); + table.Add(node.Data); previous = node; }