Skip to content

Ch 4. Trees and Graphs / 4.2_Minimal_Tree.cpp syntax error #98

@ndomx

Description

@ndomx

The code declares a pointer in line 10, but doesn't use pointer notation to access it

TreeNode* newNode = new TreeNode(arr[mid]);
newNode.left = createMinBST(arr, start, mid - 1);  // Should be newNode->left
newNode.right = createMinBST(arr, mid + 1, end); // Should be newNode->right

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions