diff --git a/algorithms/primitives/subarray-vs-substring-vs-subsequence-vs-subset/README.md b/algorithms/primitives/subarray-vs-substring-vs-subsequence-vs-subset/README.md index 60a984d..8175d68 100644 --- a/algorithms/primitives/subarray-vs-substring-vs-subsequence-vs-subset/README.md +++ b/algorithms/primitives/subarray-vs-substring-vs-subsequence-vs-subset/README.md @@ -39,12 +39,11 @@ A set is subset of another set if all its elements are contained by that set. Th * Note on Sets: Unlike arrays, strings, and sequences, sets do not allow duplicate elements. As a result, `{1, 2, 1}` would not be a valid set. ## Comparison Table --|Subarray|Substring|Subsequence|Subset ----|---|---|---|--- -Contiguous|Yes|Yes|No|No -Elements Ordered|Yes|Yes|Yes|No -As you can see in the table, subarrays and substrings need to be made up of contiguous sequence of elements of their parents, while subsequences and subsets do not have to be. In addition, all of subarrays, substrings and subsequences should preserve element order, meaning their elements should appear in the same order that they appear in their parents, while subsets can have their elements appear in any order. +| | Subarray | Substring | Subsequence | Subset | +|---|---|---|---|---| +| Contiguous | Yes | Yes | No | No | +| Elements Ordered | Yes | Yes | Yes | No | While memorizing all the details about these data structures is hard, learning them is not. And the best way to learn them is to use them in real life. Not everyone does algorithm-heavy programming, so my recommendation for most developers is to solve algorithm questions from time to time. They are not only good exercise to keep your computer science fundamentals sharp, but they will also help you to be familiar with new and improved problem-solving techniques. Computer science is a very active branch of science and existing algorithms are being improved every day, and new solutions for existing questions are being found. Solving an algorithm question once in a while is not only fun, but it is tremendously helpful in interview situations.