joowani / binarytree

Python Library for Studying Binary Trees
http://binarytree.readthedocs.io
MIT License
1.81k stars 171 forks source link

equality testing using zip #32

Closed waqarsaleem closed 3 years ago

waqarsaleem commented 3 years ago

Leverages __iter__ to iterate over the trees and zip to get corresponding pairs. zip is lazy so there is no wasted computation. zip_longest from itertools is used in case one tree is larger than the other. Checking will terminate at the first non-matching node.

I am very new to contributing so please feel free to point out any errors I made.

codecov-io commented 3 years ago

Codecov Report

Merging #32 (fd51e3f) into main (d53a4b2) will decrease coverage by 0.15%. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##              main      #32      +/-   ##
===========================================
- Coverage   100.00%   99.84%   -0.16%     
===========================================
  Files            2        2              
  Lines          636      627       -9     
===========================================
- Hits           636      626      -10     
- Misses           0        1       +1     
Impacted Files Coverage Δ
binarytree/__init__.py 99.83% <100.00%> (-0.17%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d53a4b2...fd51e3f. Read the comment docs.