Publish reusable code, track complexity impact, and grow your engineering playbook.
A focused workspace for sharing real-world code.
Curated picks from the community this week.
test 2
@test
Heap Sort sử dụng Max Heap để sắp xếp mảng tăng dần: Các bước: Xây dựng Max Heap từ mảng đầu vào. Lặp lại: Hoán đổi phần tử đầu (arr[0], lớn nhất) với phần tử cuối chưa được sắp xếp. Giảm kích thước heap (loại bỏ phần tử đã xếp). Heapify lại cây từ gốc để duy trì tính chất max-heap. Kết thúc khi heap còn 1 phần tử.
Casey Liu
@caseyl
Maximum subarray sum using Kadane's approach.
Casey Liu
@caseyl
Heap-based solution to retrieve the k most frequent integers.
Popular topics and languages right now.
Fresh snippets from the community.
Heap Sort sử dụng Max Heap để sắp xếp mảng tăng dần: Các bước: Xây dựng Max Heap từ mảng đầu vào. Lặp lại: Hoán đổi phần tử đầu (arr[0], lớn nhất) với phần tử cuối chưa được sắp xếp. Giảm kích thước heap (loại bỏ phần tử đã xếp). Heapify lại cây từ gốc để duy trì tính chất max-heap. Kết thúc khi heap còn 1 phần tử.
Maximum subarray sum using Kadane's approach.
Binary search implementation over sorted arrays.
Heap-based solution to retrieve the k most frequent integers.