Skip to content

Binary Tree isBalanced() method not accepted#1

Open
wawraf wants to merge 1 commit intostagingfrom
fix/data-structures-issue
Open

Binary Tree isBalanced() method not accepted#1
wawraf wants to merge 1 commit intostagingfrom
fix/data-structures-issue

Conversation

@wawraf
Copy link
Owner

@wawraf wawraf commented Jul 12, 2018

Requirement "The isBalanced method returns true if the tree is a balanced binary search tree." in this particular case will be always false, becuse assert for this challenge returns test.isBalanced() which will be negative and therefore assert itself as well.

Commit should fix the problem.

Pre-Submission Checklist

  • Your pull request targets the staging branch of freeCodeCamp.
  • Branch starts with either fix/, feature/, or translate/ (e.g. fix/signin-issue)
  • You have only one commit (if not, squash them into one commit).
  • All new and existing tests pass the command npm test. Use git commit --amend to amend any fixes.

Type of Change

  • Small bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds new functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Add new translation (feature adding new translations)

Checklist:

  • Tested changes locally.
  • Addressed currently open issue (replace XXXXX with an issue no in next line)

Closes #XXXXX

Description

By default in Data Structures: Find the Minimum and Maximum Height of a Binary Search Tree challenge, method isBalanced() for provided data will return FALSE.

In data-structures.json, assert for this particular test contains `return test.isBalanced()' which will return FALSE by default for this data and test will fail.

Change from test.isBalanced() to !test.isBalanced() should fix it.

Requirement "The isBalanced method returns true if the tree is a balanced binary search tree." in this particular case will be always false, becuse assert for this challenge returns test.isBalanced() which will be negative and therefore assert itself as well.

Commit should fix the problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant