/data_structures_and_algorithms

Contains various data structures and algorithms I use when leetcoding

Primary LanguageGoDo What The F*ck You Want To Public LicenseWTFPL

Data Structures and Algorithms

ci_badge go_version_badge license_badge

About

Standard go library is pretty weak and inconvenient for leetcoding, so I've decided to write a good go library myself. I've defined all the generic data structures and generic misc functions in src, then with leetcode_library_template_builder I concatenate all the files to leetcode_library.template, which I later copy-paste to every leetcode solution, enjoying the library I deserve...

Also, I have all the algorithm and data structures explained in docs directory, check it out! Those explanations contain some code snippets I haven't included in leetcode_library.template, because I think you should quickly code them yourself, and don't rely on the library heavily.

Why standard go library is not enough for leetcode

  • No generics support - I've manually defined too much Max, Min, Abs, ... functions in my solutions.
  • Awful heap interface. It doesn't work out of the box - you need to define a lot of error-prone code, and it's inconvenient to use afterwards.
  • Not enough data structures. There is no AVL tree, Trie, Union-find, ...

Project structure