Skip to content

Instantly share code, notes, and snippets.

@akarsh
Created August 15, 2018 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akarsh/0bca4b8f07492332518695c7f5af5c8e to your computer and use it in GitHub Desktop.
Save akarsh/0bca4b8f07492332518695c7f5af5c8e to your computer and use it in GitHub Desktop.
Swift data structures and algorithms usage
Where would data structures and algorithms are applied. Here are the quick examples:
- Diffing for UITableView / UICollection batchUpdate, using Longest Common Subsequence, or Edit Distance.
- Cache the value using Dictionary to perform search in O(1). (Which is the Hash-table and Dynamic Programming feature in CS)
- Traverse Tree will be used when you would like to traverse whole view hierarchy.
- You would need Trie data-structure to have a cached experience for @mention in Chat app / Dictionary.
- And how do you find the path between 2 points in Map app, Transport app without using Graph? ( Or you could use WebView and leave the hard thing for other engineers )
- How do you structure a rich text Document without understand Tree data structure?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment