Ad
  • Custom User Avatar

    I really enjoyed this kata, but i would suggest improving the sample tests to include decoding a factorial base number that has a letter in it. With the current sample tests I could completely ignore the letters and still pass the samples but fail the full tests.

  • Custom User Avatar

    you're not checking the structure of the tree, there. Only the structure of a Node. I mean: the only reason why my solution got invalidated is the very first line of your new function. Otherwise, since you just check that the root node is compliant with the structure of a bst, but without checking that the BST itself actually holds the values he's supposed to hold... Well, my code returning an empty root still satisfiies the other tests.

    Note: you're making the things far worse, since you introduces now Node.val without saying anything in the description... And while you STILL didn't tell anything about the contract for the Node class.....

  • Custom User Avatar

    No, you have to build a reference tree, and check whether the user's tree is identical. But this will require enforcing an exactly same approach as you use which sounds bad for a purely algorithmic kata. Alternatively, you could turn the task into "implement a BST", and check that an in-order traversal results in a correct sorted list, but this may lead to people imitating a BST just good enough to pass the tests.

    I think whoever upvoted this kata should have let it die, because this is likely to turn into a huge mess, and still none of the issues raised earlier have been addressed...

  • Custom User Avatar

    okay, now i check the structure of the tree along with the result of the traverse method. This is still not perfect but is it better?

  • Custom User Avatar

    na, you're trying to go the wrong way around. What you should do is to avoid totally any list-like approach. Your class methods are the weak points, here. What you shoul do is actually to test the structure of the tree, NOT the result of it. You're currently testing that the user is going from Berlin to LA hoping he'll go by sea, except only a very strong checking would forbid him to use a plane. Meaning you're "attacking" the problem neither from the correct side nor with the correct tools.

  • Custom User Avatar

    for example this kata prevents users from using any eval related functions and I want to do the same with mine but with any sorting related function

  • Custom User Avatar

    Thanks for the feedback, i am trying to prevent users from extending lists and from using any built in sorting functions but im still learning so this will be improved. I know there is way to test if a certain function is used i just don't know exactly how, I am still trying to figure it out.

  • Custom User Avatar

    Hi,

    Sorry to say so, but... your requirements are just like your tests: full of holes x)
    This should never pass the tests. You're trying to do too much things at the same time while not testing any behavior properly.

  • Custom User Avatar

    You can access the source code at /home/codewarrior/solution.txt.

  • Custom User Avatar

    You check its existance, but not behavior.

  • Custom User Avatar

    The description says nothing about the requirement of left, right, or val.

  • Custom User Avatar

    Now I test that the BST has a left, a right, and all the necessary methods

  • Custom User Avatar

    The "sorting" is the same as in-order traversal, so this part is a duplicate. Idk if there're katas about implementing a BST (I think I saw one in Beta, but not sure whether an approved one exists), so this kata could be a duplicate overall.

  • Custom User Avatar

    I want to prevent uses from using the sorted() method but I don't know how

  • Custom User Avatar

    you're right, i just noticed that, i'll fix it

  • Loading more items...