Wednesday, August 20, 2025

DSA using Python: Assignment-5: Circular Linked List



Learn how to implement Circular Linked List in Python step by step. This assignment covers Node and CLL classes, insertion, deletion, searching, and iteration with clear examples for better understanding of Data Structures and Algorithms using Python.

Assignment-5: Circular Linked List

### ✅ Task 1: Define Node class

1. Define a class Node to describe a node of a circular linked list.

### ✅ Task 2: Define CLL class

2. Define a class CLL to implement Circular Linked List with __init__() method to create and initialise last reference variable.

### ✅ Task 3: is_empty()

3. Define a method is_empty() to check if the linked list is empty in CLL class.

### ✅ Task 4: insert_at_start()

4. In class CLL, define a method insert_at_start() to insert an element at the starting of the list.

### ✅ Task 5: insert_at_last()

5. In class CLL, define a method insert_at_last() to insert an element at the end of the list.

### ✅ Task 6: search()

6. In class CLL, define a method search() to find the node with specified element value.

### ✅ Task 7: insert_after()

7. In class CLL, define a method insert_after() to insert a new node after a given node of the list.

### ✅ Task 8: print_all()

8. In class CLL, define a method to print all the elements of the list.

### ✅ Task 9: Iterator

9. In class CLL, implement iterator for CLL to access all the elements of the list in a sequence.

### ✅ Task 10: delete_first()

10. In class CLL, define a method delete_first() to delete first element from the list. 

### ✅ Task 11: delete_last()

11. In class CLL, define a method delete_last() to delete last element from the list.

### ✅ Task 12: delete_item()

12. In class CLL, define a method delete_item() to delete specified element from the list.

No comments:

Post a Comment

πŸ“™Software Engineer at Google Book

 πŸŒ Explore the Journey of a Software Engineer at Google πŸš€   If you are passionate about coding, problem-solving, and building scalable app...