Release Notes v1.2.0
Overview
This release enhances the DoublyLinkedList and introduces a new Stack data structure, focusing on robust functionality and comprehensive testing. New methods (insert, remove, makeEmpty) have been added to DoublyLinkedList, and a foundational Stack implementation is included. Additionally, the Anki deck has been updated with new cards to support learning these data structures. These changes improve the usability and educational value of the project.
What's New
DoublyLinkedList Enhancements
- New Methods:
- insert(index, value): Inserts a node with the specified value at the given index. Optimizes edge cases by using
unshift(index 0) andpush(index equals length). Returnstrueon success,falsefor invalid indices. - remove(index): Removes the node at the specified index, returning the removed node. Uses
shiftandpopfor edge cases (head or tail). Returnsundefinedfor invalid indices. - makeEmpty(): Resets the list by setting head, tail, and length to null/0.
- insert(index, value): Inserts a node with the specified value at the given index. Optimizes edge cases by using
- Test Suite Additions:
- Comprehensive tests for
insertandremovemethods inEXERCISE-DLL-Insert.test.jsandEXERCISE-DLL-Remove.test.js. - Tests cover valid indices (randomized inputs) and invalid indices (-1, 4 for insert; -4, 4 for remove).
- Utility functions in
TESTS/Insert.jsandTESTS/Remove.jsvalidate internal structure, node values, and edge cases.
- Comprehensive tests for
Stack Implementation
- New Stack Class:
- Introduced
Stackclass with aconstructorinitializing a single node and tracking length. - Includes
Nodeclass withvalueandnextproperties.
- Introduced
- Test Suite:
- Added
EXERCISE-Stack-Constructor.jsandindex.test.jsto verify stack initialization. - Tests ensure
top,length, and node properties are correctly set.
- Added
Anki Deck Update
- Updated Anki Deck:
- Added new flashcards covering the
insertandremovemethods for DoublyLinkedList. - Included examples and edge cases for Stack constructor to reinforce understanding.
- Cards provide practical coding scenarios and explanations to aid learning.
- Added new flashcards covering the
Utility Functions
- New Utility:
checkStackInternalStructure.js: Validates Stack properties (top,length) and node structure (value,next).
- Refined Utilities:
- Relocated
toBeNullTests.jstoutils/tests/for shared use across data structures. - Added
toBeTests.jsfor consistent nested property comparisons. - Updated import paths in
TESTS/Set.jsto use shared utilities.
- Relocated
Codebase Improvements
- DoublyLinkedList:
- Integrated
insertandremovemethods intoindex.jsfor consistency. - Added tests for new methods in
index.test.js.
- Integrated
- Code Cleanup:
- Removed commented-out Circle class code in
js/index.jsfor clarity. - Ensured consistent file formatting (addressed missing newlines).
- Removed commented-out Circle class code in
- Testing Enhancements:
- Structured test suites with clear descriptions for better readability.
- Validated internal structure using
checkDLLInternalStructureandcheckStackInternalStructure.
Bug Fixes
- Fixed import path for
toBeNullTestsinTESTS/Set.jsto reference shared utility. - Corrected duplicate
head.next.valueentries inTESTS/Remove.jstest paths.
Breaking Changes
- None. The new methods and Stack implementation are additive and maintain backward compatibility.
Testing
- Test Coverage:
- 10 random test cases for valid
insertandremoveoperations. - Specific tests for invalid indices to ensure robust error handling.
- Stack constructor tests verify initial state and structure.
- 10 random test cases for valid
- Validation:
- All tests pass, confirming the reliability of DoublyLinkedList and Stack implementations.
- Internal structure checks ensure property consistency.
Contributors
- [Morteza Bakhshandeh/@BCFCODE] - Implemented new methods, tests, and Anki deck updates.
Feedback
We value your feedback! Please submit issues or pull requests on our GitHub repository.
License
This project is licensed under the MIT License.