Skip to content

kafkas/algorithms-part1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Solutions to Algorithms, Part I

This repo contains my solutions to Algorithms, Part I, the online Princeton course by Robert Sedgewick and Kevin Wayne. All 5 solutions score 100% in correctness, timing and memory. More importantly, I have taken extra care to ensure the code is clean and that it reads like well-written prose.

My coding style can be summarised as:

  • Use small functions that do one thing only and have no hidden side effects
  • Have one level of abstraction per function (with small violations)
  • Each function should take at most 4 non-related arguments (more work to be done on this)
  • Prefer long, descriptive, intention-revealing names over comments
  • Avoid comments if names are self-explanatory (including javadocs)
  • Declarations of functions used in each function should be found as fast as possible below that function
  • Conceptually linked functions should stay together

When I clean the code according to these rules, I can read it from top to bottom like a poem. I have found that not only is this visually pleasing but it also helps me understand the algorithms much better.

Assignment pages

  1. Percolation (playground)

  2. Queues

  3. Collinear Points

  4. Slider Puzzle

  5. Kd-trees

Contributions

All PRs, even the ones with tiniest improvements, are welcome.

About

Solutions to Algorithms, Part I.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages