C-Sharp icon indicating copy to clipboard operation
C-Sharp copied to clipboard

Added Circular Linked List Data Structure

Open mohit-gogitter opened this issue 1 year ago • 2 comments

Circular Linked List

A Circular Linked List Data Structure is a variation of the linked list where the last node points back to the first node, forming a circular structure. In this implementation, I've created a circular linked list where each node contains data and a reference to the next node.

Here's a summary of key operations and their time complexities in this implementation:

  1. Insert at the Beginning: Adds a new node at the start of the list and links the new node to the existing nodes, ensuring the circular connection is maintained. (Time Complexity: O(1))
  2. Insert at the End: Adds a new node at the end of the list by finding the last node and updating its pointer to the new node, which is then linked back to the first node. (Time Complexity: O(n))
  3. Insert After a Given Node: Searches for a specific node in the list and inserts a new node after it while maintaining the circular connection. (Time Complexity: O(n))
  4. Delete a Node: Removes a node from the list by updating the pointers of the surrounding nodes. (Time Complexity: O(n))

Where It Can Be Used:

  • Operating Systems: In process scheduling where tasks are selected in a circular fashion.
  • Multimedia Applications: To manage looping playlists for audio and video playback.
  • Networking: In token-passing protocols for network communication.
  • Simulation or Game Development: For player turns in multiplayer games, simulating continuous cycles of events.

CheckList

  • [X] I have performed a self-review of my code
  • [X] My code follows the style guidelines of this project
  • [X] I have added tests that prove my fix is effective or that my feature works
  • [X] New and existing unit tests pass locally with my changes
  • [X] Comments in areas I changed are up to date
  • [X] I have added comments to hard-to-understand areas of my code
  • [X] I have made corresponding changes to the README.md

mohit-gogitter avatar Oct 12 '24 05:10 mohit-gogitter

Codecov Report

Attention: Patch coverage is 98.82353% with 1 line in your changes missing coverage. Please review.

Project coverage is 95.13%. Comparing base (93febae) to head (7580b7a). Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...inkedList/CircularLinkedList/CircularLinkedList.cs 98.78% 0 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #476      +/-   ##
==========================================
+ Coverage   95.07%   95.13%   +0.06%     
==========================================
  Files         259      261       +2     
  Lines       10710    10795      +85     
  Branches     1504     1516      +12     
==========================================
+ Hits        10182    10270      +88     
+ Misses        403      400       -3     
  Partials      125      125              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 12 '24 05:10 codecov[bot]

@siriak Can you please review

mohit-gogitter avatar Oct 14 '24 11:10 mohit-gogitter

@siriak Can you please review and merge as the PR is opened since 2 weeks

mohit-gogitter avatar Oct 26 '24 05:10 mohit-gogitter