Skip to content

PreCourse-1 Exercise 1, 2 & 3 assignment complete - #2440

Open
ankurgokhale05 wants to merge 1 commit into
super30admin:masterfrom
ankurgokhale05:master
Open

PreCourse-1 Exercise 1, 2 & 3 assignment complete#2440
ankurgokhale05 wants to merge 1 commit into
super30admin:masterfrom
ankurgokhale05:master

Conversation

@ankurgokhale05

Copy link
Copy Markdown

PreCourse-1 Exercise 1, 2 & 3 assignment complete

@super30admin

Copy link
Copy Markdown
Owner

Return ONLY the self-contained feedback in the correct format.

FE Exercise 1 (Stack using array):

  • Correctness: Correct implementation with proper bounds checking. Push raises OverflowError when full, pop raises IndexError when empty. Good.
  • Time Complexity: O(1) for all operations. Correct.
  • Space Complexity: O(n) where n is capacity. Correct.
  • Code Quality: Well-documented with docstrings and complexity analysis. The show() method is a nice addition for debugging.
  • Minor: The comment "Please read sample.java file before starting" is leftover from the original problem template and should be removed.

Exercise 2 (Stack using linked list):

  • Correctness: Correct implementation. Push inserts at head, pop removes from head. Both O(1).
  • Time Complexity: O(1) for push and pop. Correct.
  • Space Complexity: O(n) for the entire stack, O(1) per operation. Correct.
  • Code Quality: Good documentation. The interactive driver at the bottom is functional but could be wrapped in a if __name__ == "__main__": block for better practice.
  • Minor: The size attribute is tracked but never exposed via a method. Consider adding a size() method for completeness.

Exercise 3 (Singly linked list):

  • Correctness: All three operations (append, find, remove) are correctly implemented. Edge cases handled (empty list, head removal, tail removal, nonexistent key).
  • Time Complexity: O(n) for all three operations. Correct.
  • Space Complexity: O(1) auxiliary space. Correct.
  • Code Quality: Excellent. Includes comprehensive test cases that verify all edge cases. Well-documented with approach explanations.
  • Strength: The run_tests() function is a great addition that demonstrates thorough testing.

Overall:

  • All three exercises are correctly implemented with appropriate complexity analysis.
  • Code is well-structured, readable, and follows Python best practices.
  • The student has gone above and beyond by including test cases and detailed documentation.
  • Minor improvements: remove template comments, wrap interactive code in __main__ guard, expose size method.

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