Skip to content

v1.2.0

Latest

Choose a tag to compare

@BCFCODE BCFCODE released this 02 Jun 10:30
· 391 commits to main since this release

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) and push (index equals length). Returns true on success, false for invalid indices.
    • remove(index): Removes the node at the specified index, returning the removed node. Uses shift and pop for edge cases (head or tail). Returns undefined for invalid indices.
    • makeEmpty(): Resets the list by setting head, tail, and length to null/0.
  • Test Suite Additions:
    • Comprehensive tests for insert and remove methods in EXERCISE-DLL-Insert.test.js and EXERCISE-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.js and TESTS/Remove.js validate internal structure, node values, and edge cases.

Stack Implementation

  • New Stack Class:
    • Introduced Stack class with a constructor initializing a single node and tracking length.
    • Includes Node class with value and next properties.
  • Test Suite:
    • Added EXERCISE-Stack-Constructor.js and index.test.js to verify stack initialization.
    • Tests ensure top, length, and node properties are correctly set.

Anki Deck Update

  • Updated Anki Deck:
    • Added new flashcards covering the insert and remove methods for DoublyLinkedList.
    • Included examples and edge cases for Stack constructor to reinforce understanding.
    • Cards provide practical coding scenarios and explanations to aid learning.

Utility Functions

  • New Utility:
    • checkStackInternalStructure.js: Validates Stack properties (top, length) and node structure (value, next).
  • Refined Utilities:
    • Relocated toBeNullTests.js to utils/tests/ for shared use across data structures.
    • Added toBeTests.js for consistent nested property comparisons.
    • Updated import paths in TESTS/Set.js to use shared utilities.

Codebase Improvements

  • DoublyLinkedList:
    • Integrated insert and remove methods into index.js for consistency.
    • Added tests for new methods in index.test.js.
  • Code Cleanup:
    • Removed commented-out Circle class code in js/index.js for clarity.
    • Ensured consistent file formatting (addressed missing newlines).
  • Testing Enhancements:
    • Structured test suites with clear descriptions for better readability.
    • Validated internal structure using checkDLLInternalStructure and checkStackInternalStructure.

Bug Fixes

  • Fixed import path for toBeNullTests in TESTS/Set.js to reference shared utility.
  • Corrected duplicate head.next.value entries in TESTS/Remove.js test 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 insert and remove operations.
    • Specific tests for invalid indices to ensure robust error handling.
    • Stack constructor tests verify initial state and structure.
  • 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.