Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`replaceChild` method in BinaryTreeNode is not correct

Đang mở
#1,102 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

@DeoJin đang làm issue này rồi.

Từ ngày 17/3/2026.

  • #2117 của @DeoJin — đang mở
  • #2118 của @DeoJin — đang mở
  • #2222 của @LearnCodeZaid — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
backend

Hướng nghiên cứu

Start at the BinaryTreeNode.replaceChild method and inspect how its left and right child links are used. Confirm that a successful replacement also updates the replacement node's parent reference, then run the relevant BinaryTreeNode tests if available and verify both child positions and failure cases.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Missing update parent. It should be

    if (!nodeToReplace || !replacementNode) {
      return false;
    }

    if (this.left && this.left === nodeToReplace) {
      this.left = replacementNode;
      replacementNode.parent = this;
      return true;
    }

    if (this.right && this.right === nodeToReplace) {
      this.right = replacementNode;
      replacementNode.parent = this;
      return true;
    }

    return false;
  }
Ngôn ngữ chính
JavaScript
Star
197k
Fork
31k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của trekhleb/javascript-algorithms

Tất cả issue của trekhleb/javascript-algorithms

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.