Showcases my work on learning data structures and algorithms
I will be using the roadmap provided on neetcode.io/roadmap to work through some simple data structures and algorithms. While I took an algorithms course during my master's, it focused on proving the time complexity and correctness of algorithms, not the implementation of and operations you would perform on certain data structures. The class also covered common algorithms like breadth-first search and depth-first search, but the focus was on using them in pseudocode as part of proofs, not implementing them in actual code to solve hypothetical problems.
- Completed naive approach of O(n^2) on Level 1 - Problem 01 (Contains Duplicates) and learned how to perform unit tests in Python
- Completed solution to same problem using dictionary, but that only beats 11% of Python3 users
- Found a solution very quickly for Level 1 - Problem 02 (Valid Anagram) that beats 58.57% of Python3 users on time.
- Learned how to read most optimal solutions and that the set function and counter functions are highly optimized.
- Found a solution very quickly for Level 1 - Problem 03 (Two Sum) that beats 85% of Python3 submissions on time. There were no clearly better answers.
- I was reminded to move a little bit slower if I don't want to have to debug the code. I referenced the integer I was looping with instead of the key of a dictionary that matched the integer.
- I was unable to find a solution to Level 1 - Problem 04 (Group Anagrams) within an hour, so I analyzed the best Python3 solution.
- I learned a bit more about defaultdict and the intuition behind solving medium array and hashing problems.
- I very quickly found a solution to Level 1 - Problem 05 (Top K Frequent Elements), but I had to look up how to sort a defaultdict by values.
- I learned a bit more about the possible answers to the Top K Frequent Elements problems, heaps, sorting algorithms, QuickSelect, and partitioning schemes by reading the editorial.
- Thought I had a quick answer for Level 1 - Problem 06 (Encode and Decode Strings), but I was incorrect. I was trying to use an ASCII delimiter which was likely to appear in a string. I should have used a non-ASCII delimiter, chunked transfer encoding, or escape characters.
- Made an attempt on Level 1 - Problem 07, but I need to brush up on accessing elements in a,dictionary. The issue is probably that dictionaries are built in for Python3, so I need to learn how they're implemented in other languages to better understand them.
- I read the editorial, and it had a very clever use of the associative property of multiplication to form an answer.
- Made an attempt on Level 1 - Problem 08. I still need to work on my basic data structures. I was trying to solve the problem perfectly the first time instead of finding a solution and iterating. I also didn't think to use floor division.
- I set up a new folder to cover the basics of simple data structures. I'll be adding information soon related to lists and dictionaries.
- Worked on basic functions in lists, tuples, and dicts to help implement solutions more quickly in the future.
- Complete Level 1 - Problem 09 in 40 minutes today. I still have a series of small issues, but I will work them out over time.
- Completed my first stack question in about fifteen minutes, but I made three mistakes first. I need to start considering all the potential wrong answers before trying to code an answer, so basically, I need to do TDD.
- Added a series of algorithms and data structures to practice over the last four weeks, trying to prepare for technical interviews and reviewing basics.