Skip to content

Commit 8aba8e4

Browse files
authored
feat: Add BinaryHeap implementation and comprehensive tests and Update README files in English and Portuguese (#17)
* add size method * feat: Normalize Interfaces - Refined and standardized interface definitions across the project - Applied Single Responsibility Principle (SRP) to ensure each interface has a clear, singular purpose - Consistent naming conventions were implemented for better readability and maintainability - Added thorough documentation for each interface, including method descriptions and expected behaviors - Organized interfaces within appropriate namespaces to prevent naming collisions and maintain a logical structure - Ensured parameter names in interface methods are consistent with implementing classes - Avoided including constructors in interfaces to maintain flexibility These changes enhance the overall clarity, maintainability, and professional quality of the codebase. * Refactor and Normalize Collection Interface and Implementation - Refactored `Collection` interface for consistency and adherence to best practices. - Ensured all tests are comprehensive and validate the expected behavior. * feat: Add BinaryHeap implementation and comprehensive tests - Implemented BinaryHeap class with support for both min-heap and max-heap operations. - Methods include: add, poll, peek, size, isEmpty, heapifyUp, heapifyDown, swap, and compare. - Created unit tests for BinaryHeap class ensuring 100% coverage. - Tested all key operations: add, poll, peek, heapifyUp, heapifyDown, swap, and compare. - Included edge case tests for min-heap and max-heap scenarios. - Ensured compliance with type safety and PHP 8.0+ features. - Added comprehensive documentation and examples for BinaryHeap usage. This commit enhances the KaririCode Framework by providing a robust, type-safe, and efficient BinaryHeap data structure with extensive unit tests. * docs: Update README files in English and Portuguese - Enhanced the overview and key features sections for clarity and completeness. - Added detailed descriptions for all implemented data structures: - TreeSet - ArrayDeque - ArrayQueue - TreeMap - LinkedList - BinaryHeap - HashMap - Included complexity analysis and key methods for each data structure. - Provided usage examples for each data structure to demonstrate functionality. - Updated installation instructions and requirements. - Updated acknowledgments and roadmap sections. * style: Normalize code formatting and style
1 parent 2f73f20 commit 8aba8e4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/DataStructure/Structural/BPlusTreeCollection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
declare(strict_types=1);
44

5-
namespace KaririCode\Contract\DataStructure;
5+
namespace KaririCode\Contract\DataStructure\Structural;
66

77
use KaririCode\Contract\DataStructure\Behavioral\Sortable;
8-
use KaririCode\Contract\DataStructure\Structural\Collection;
8+
use KaririCode\Contract\DataStructure\Tree;
99

1010
/**
1111
* Interface BPlusTreeCollection.

tests/DataStructure/Structural/BPlusTreeCollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
declare(strict_types=1);
44

5-
namespace KaririCode\Tests\Contract\DataStructure;
5+
namespace KaririCode\Tests\Contract\DataStructure\Structural;
66

7-
use KaririCode\Contract\DataStructure\BPlusTreeCollection;
7+
use KaririCode\Contract\DataStructure\Structural\BPlusTreeCollection;
88
use PHPUnit\Framework\TestCase;
99

1010
final class BPlusTreeCollectionTest extends TestCase

0 commit comments

Comments
 (0)