Skip to content

Complete PreCourse-1 - #2433

Open
pcparagc wants to merge 2 commits into
super30admin:masterfrom
pcparagc:master
Open

Complete PreCourse-1#2433
pcparagc wants to merge 2 commits into
super30admin:masterfrom
pcparagc:master

Conversation

@pcparagc

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Exercise_1.py (List-based Stack):

  • Correctness: The implementation is correct with proper handling of edge cases (isEmpty check before pop/peek).
  • Time Complexity: O(1) for all operations is accurate.
  • Space Complexity: O(n) is correct.
  • Code Quality: Good implementation, but lacks docstrings and the comments about Leetcode are incomplete. The indentation of the complexity comments is inconsistent.

Exercise_2.py (Linked List-based Stack):

  • Correctness: Implementation is correct with proper head insertion for push and head removal for pop.
  • Time Complexity: O(1) for both push and pop is correct.
  • Space Complexity: O(n) is correct.
  • Code Quality: Well-structured with a separate Node class. The interactive driver code is helpful for testing. Could benefit from additional methods like peek(), isEmpty(), and size() for a complete stack implementation.

Exercise_3.py (Singly Linked List):

  • Correctness: Implementation is correct. The append, find, and remove methods work as expected.
  • Time Complexity: O(n) for all three methods is accurate.
  • Space Complexity: The comment claims O(1) but this is misleading - space complexity for the data structure itself is O(n) for storing n elements. O(1) auxilary space is more accurate.
  • Code Quality: Good use of docstrings explaining time complexity. The code is clean and readable. Consider adding a show() or traverse() method for debugging purposes.

General Observations:

  • All three files show good understanding of data structures.
  • The student consistently includes time/space complexity comments (though some are incomplete/misleading).
  • Code structure is clean with proper use of classes and methods.
  • Edge case handling is present but could be more comprehensive (e.g., handling None values in linked list operations).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants