binary search tree impelementation and java

前端 未结 6 695
离开以前
离开以前 2021-01-03 09:10

I am trying to implement BST algorithm using Cormen\'s pseudo code yet having issue.

Here is my Code for Node:

public class Node {
    Node left;
            


        
6条回答
  •  旧巷少年郎
    2021-01-03 09:36

    I'll have to side with Anon and go for the rewrite. The null pointers come from your getParent function (which explicitly returns nulls along other things). So I would start there and fix the function(s) so that they return one thing and one thing only at the end of the function.

提交回复
热议问题