Skip to content

Latest commit

 

History

History
14 lines (10 loc) · 460 Bytes

README.md

File metadata and controls

14 lines (10 loc) · 460 Bytes

JSON Diffing Algorithm

Arrays

  1. If an array is a Set (of unique primitives), transform it into a hashTable and compare keys
  2. If an array is not a Set (contains primitives duplicates ):
  • Trim it (common head and tail)
  • Test for singular Insertion / Deletion
  • If it doesn't solve the problem, test for TwoEdits
  • If it doesn't solve the problem, apply the LCS algorithm

https://neil.fraser.name/writing/diff/