Skip to content

Conversation

@varnika-98
Copy link

Implemented stack using Python list. Added time and space complexity.

@varnika-98 varnika-98 changed the title Completed Exercise 1 Completed PreCourse 1 Jan 13, 2026
@super30admin
Copy link
Owner

  1. Correctness:

    • Exercise_1.py: The stack implementation appears correct with proper push, pop, peek, isEmpty, size, and show operations. The isEmpty check before pop and peek is good practice.
    • Exercise_2.py: The stack implementation using linked list is mostly correct, but the pop method doesn't handle the case where the stack is empty (it calls isEmpty but doesn't return anything in that case). Also, the isEmpty method is not implemented.
    • Exercise_3.py: The singly linked list implementation is correct with proper append, find, and remove operations. Edge cases are handled well.
  2. Time Complexity:

    • The student has correctly identified time complexities for all operations in each exercise.
    • For Exercise_2.py, the isEmpty operation would be O(1) if implemented.
  3. Space Complexity:

    • Space complexities are correctly identified for all exercises.
  4. Code Quality:

    • Code is generally well-structured and readable.
    • In Exercise_2.py, the isEmpty method should be implemented for completeness.
    • In Exercise_3.py, the docstrings could be placed before the method implementations rather than after for better readability.
    • The test cases in Exercise_3.py are a good addition.
  5. Efficiency:

    • The implementations are efficient for the given problems.
    • In Exercise_2.py, the pop method could be simplified by directly returning None if the stack is empty rather than having an empty return.

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