Skip to content

Completed PreCourse-1#2425

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

Completed PreCourse-1#2425
Athulyagr20 wants to merge 2 commits into
super30admin:masterfrom
Athulyagr20:master

Conversation

@Athulyagr20

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

The student has submitted three exercises implementing stack and linked list data structures in Java. Here's my evaluation:

Exercise_1 (Array-based Stack):

  • Correctness: The implementation is mostly correct with proper overflow/underflow checks
  • Issue: The push method doesn't update root (which doesn't exist in this class - should be top)
  • Time Complexity: O(1) ✓
  • Space Complexity: O(1) ✓

Exercise_2 (Linked List-based Stack):

  • Correctness: Has a critical bug - the push method creates a new node but never updates root to point to it. The new node is orphaned.
  • Time Complexity: O(1) ✓
  • Space Complexity: O(1) ✓
  • Issue: Missing root = newNode; in the push method

Exercise_3 (Singly Linked List):

  • Correctness: Correct implementation of linked list insertion and traversal
  • Time Complexity: O(n) for insertion (traversing to end) ✓
  • Space Complexity: O(n) for storing n nodes ✓
  • Good practice: Used static inner class appropriately

General Observations:

  • Good use of comments explaining time/space complexity
  • Proper handling of edge cases (empty stack checks)
  • Code is readable and well-structured
  • Exercise_2 has a functional bug that would cause push operations to fail silently

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