Skip to content

Add PreCourse-1 PR submission - #2428

Open
agk-s30 wants to merge 1 commit into
super30admin:masterfrom
agk-s30:master
Open

Add PreCourse-1 PR submission#2428
agk-s30 wants to merge 1 commit into
super30admin:masterfrom
agk-s30:master

Conversation

@agk-s30

@agk-s30 agk-s30 commented Jul 27, 2026

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Exercise_1.py

  • Strengths: Clean implementation using Python list, correct handling of edge cases (empty stack returns None), all operations are O(1) as stated.
  • Areas for Improvement: The comment "Please read sample.java file before starting" is unnecessary for a Python solution. Consider adding docstrings to methods for better documentation.

Exercise_2.py

  • Strengths: Proper linked list-based stack implementation with O(1) push/pop operations. Good error handling when popping from empty stack.
  • Areas for Improvement: The comment about EOF errors appears twice unnecessarily. The pop() method returns None but the main code doesn't handle the case where int(do[1]) might fail if input is malformed. Consider adding a peek() method for completeness.

Exercise_3.py

  • Strengths: Well-documented linked list with clear docstrings explaining time complexities. Correctly handles edge cases (empty list, head removal, element not found).
  • Areas for Improvement: The remove() method could benefit from returning a boolean to indicate success/failure. Consider adding a size() method for utility. The find() method returns the node, but typically users might want just the data.

General Observations:

  • All three exercises correctly implement their respective data structures
  • Time/space complexities are accurately stated
  • Code is readable and well-structured
  • Edge case handling is appropriate throughout

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