You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/solutions/data/dictionary.md
+7-6Lines changed: 7 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,8 +26,6 @@ tags:
26
26
27
27
## Problem
28
28
29
-
SDictionary_solution
30
-
31
29
#. Consider the implementation of "simple" dictionary `SDictionary` below:
32
30
33
31
```{download="./code/projects/SDictionary.zip"}
@@ -80,7 +78,8 @@ SDictionary_solution
80
78
81
79
<details>
82
80
<summary>Solution</summary>
83
-
"Lora" would be inserted at index `2`: `10`, `0` and `1` being taken, `Add` goes to the next available index, `2`. This is not expected, since a dictionary should reject
81
+
"Lora" would be inserted at index `2`: `10`, `0` and `1` being taken, `Add` goes to the next available index, `2`. This is not expected, since a dictionary should reject entering *two* values with the same key.
82
+
</details>
84
83
85
84
#. Write a `ToString` method for the `SDictionary` class, that returns a `string` containing all the keys and values stored in the dictionary.
!include`snippetStart="// Delete method:", snippetEnd="// End of Delete method."` code/projects/SDictionary_solution/SDictionary/SDictionary.cs
104
+
```
104
105
105
106
Complete the series of instructions below such that `demo.Delete(error)` would return `false` even though the string `error` *is* the key of a value present in the `demo` dictionary object.
106
107
@@ -121,6 +122,6 @@ SDictionary_solution
121
122
The solution is to be in a position where the `error` value is "hidden after" a `null` value:
!include`snippetStart="// Exhibiting Delete incorrect behavior:", snippetEnd="// Done: the program will believe that the "` code/projects/SDictionary_solution/SDictionary/SDictionary.cs
125
+
!include`snippetStart="// Exhibiting Delete incorrect behavior:", snippetEnd="// Done: the program will believe that the "` code/projects/SDictionary_solution/SDictionary/Program.cs
0 commit comments