Skip to content

Precourse1 Done - #2430

Open
PavanKaushikAduri wants to merge 6 commits into
super30admin:masterfrom
PavanKaushikAduri:master
Open

Precourse1 Done#2430
PavanKaushikAduri wants to merge 6 commits into
super30admin:masterfrom
PavanKaushikAduri:master

Conversation

@PavanKaushikAduri

Copy link
Copy Markdown

No description provided.

@PavanKaushikAduri PavanKaushikAduri changed the title Precourse Done Precourse1 Done Jul 28, 2026
@super30admin

Copy link
Copy Markdown
Owner

Exercise_1 (myStack using Python list):

  • Correctness: The implementation is correct. All operations (push, pop, peek, isEmpty, size, show) work as expected for a stack data structure.
  • Time Complexity: The analysis is accurate. Push is O(1) amortized, pop and peek are O(1), and show is O(n) due to slicing.
  • Space Complexity: O(n) is correct.
  • Code Quality: Good use of comments explaining the approach. However, using del self.stack[-1] is less Pythonic than self.stack.pop() which is both clearer and more efficient.

Exercise_2 (Stack using Linked List):

  • Correctness: The implementation is correct. Push and pop operations at the head are properly implemented with O(1) time complexity.
  • Time Complexity: Correctly identified as O(1) for both operations.
  • Space Complexity: O(n) is correct.
  • Code Quality: Clean implementation with good vertical thinking explanation. The interactive driver code is a nice touch for testing.

Exercise_3 (SinglyLinkedList):

  • Correctness: The implementation is correct. Append, find, and remove operations work properly. The remove method correctly handles the edge case of removing the head node.
  • Time Complexity: Correctly identified - append is O(n), find is O(n), remove is O(n).
  • Space Complexity: O(n) is correct.
  • Code Quality: Well-structured with clear comments. The two-pointer approach for remove is well explained.

Areas for Improvement across all exercises:

  1. Could add type hints for better code documentation
  2. The interactive input handling in Exercise_2 could be more robust with error handling
  3. Consider adding docstrings to classes and methods for better documentation

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.

3 participants