0% found this document useful (0 votes)
3 views3 pages

Day6 LinkedList Assignments

hi

Uploaded by

Bandenawaz (BLD)
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Day6 LinkedList Assignments

hi

Uploaded by

Bandenawaz (BLD)
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Day6_LinkedList_Assignments

Assignment 1: Understanding Linked Lists

Objective: Define what a Linked List is and compare it with Lists/Arrays. Instructions:

• Write an explanation of what a Linked List is.

• Compare and contrast Linked Lists with Lists/Arrays in terms of structure,


memory usage, and operations (like insertion, deletion, and access).

• Provide examples where Linked Lists are preferred over Lists/Arrays.

Assignment 2: Types of Linked Lists

Objective: Explore different types of Linked Lists. Instructions:

• List and define the different types of Linked Lists (Singly Linked List, Doubly
Linked List, Circular Linked List).

• For each type, explain its structure, advantages, and use cases.

• Create a visual representation (e.g., drawing or diagram) of each type of Linked


List.

Assignment 3: Node Class Constructor

Objective: Implement the Node class for a Linked List. Instructions:

• Create a Node class in Python that represents a node in a Linked List.

• The class should have attributes for storing data and the reference to the next
node.

• Write a constructor for the Node class to initialize these attributes.

• Test the Node class by creating a few nodes and linking them manually.

Assignment 4: Linked List Constructor - Creation of Singly Linked List

Objective: Implement the Linked List class constructor. Instructions:

• Create a LinkedList class in Python that represents a Singly Linked List.

• Write a constructor for the LinkedList class to initialize the head of the list.

• Implement a method to add the first node to the empty list.

• Test the LinkedList class by creating a new list and adding a node to it.
Assignment 5: Insertion in Singly Linked List

Objective: Implement the insertion methods in a Singly Linked List. Instructions:

• Add a method to the LinkedList class to insert a new node at the beginning
(prepend) of the list.

• Add another method to insert a new node at the end (append) of the list.

• Test the methods by inserting multiple nodes at both the beginning and end of
the list.
Assignment 6: Traversal of Singly Linked List

Objective: Implement the traversal of a Singly Linked List. Instructions:

• Add a method to the LinkedList class to traverse the list and print all the node
values.

• Ensure the method can handle an empty list.

• Test the traversal method on a list with multiple nodes.

Assignment 7: Search Method in Singly Linked List

Objective: Implement a search method in a Singly Linked List. Instructions:

• Add a method to the LinkedList class to search for a specific value in the list.

• The method should return the position of the node if found, or indicate if the
value is not present.

• Test the search method with various inputs, including edge cases (e.g.,
searching in an empty list, searching for a non-existent value).

Assignment 8: Get and Set Methods in Singly Linked List

Objective: Implement methods to retrieve and update values in a Singly Linked List.
Instructions:

• Add a get method to retrieve the value of a node at a given position in the list.

• Add a set method to update the value of a node at a given position in the list.

• Test both methods by retrieving and updating values at various positions.

Assignment 9: Remove Method in Singly Linked List

Objective: Implement the remove method to delete a node from a Singly Linked List.
Instructions:

• Add a method to the LinkedList class to remove a node with a specific value
from the list.
• The method should handle cases where the node to be removed is at the head,
middle, or end of the list.

• Test the remove method by deleting nodes from different positions in the list.

Assignment 10: Time and Space Complexity of Singly Linked List Operations

Objective: Analyze the time and space complexity of Singly Linked List operations.
Instructions:

• For each operation implemented (insertion, deletion, search, traversal, etc.),


write down its time and space complexity.
• Compare the complexities with equivalent operations in Lists/Arrays.

• Discuss scenarios where using a Linked List is more efficient than using a
List/Array.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy