Skip to content

Commit

Permalink
vs-vs: fix table header
Browse files Browse the repository at this point in the history
  • Loading branch information
soygul committed Apr 16, 2020
1 parent fde9215 commit b909251
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit b909251

Please sign in to comment.