0% found this document useful (0 votes)
32 views2 pages

CSE106 CircularLinkedList

1. This assignment focuses on implementing a circular doubly linked list that keeps data sorted. 2. You must implement insertion and deletion of values while maintaining the sorted property, with the largest value linked to the smallest and vice versa. 3. For each input operation (insert or delete value), print the updated list.
Copyright
© Attribution Non-Commercial (BY-NC)
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)
32 views2 pages

CSE106 CircularLinkedList

1. This assignment focuses on implementing a circular doubly linked list that keeps data sorted. 2. You must implement insertion and deletion of values while maintaining the sorted property, with the largest value linked to the smallest and vice versa. 3. For each input operation (insert or delete value), print the updated list.
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 2

Offline Assignment CSE 106 This assignment focuses on using structure and pointers.

In this assignment you are to implement a circular doubly linked list keeping the data sorted. From wikipedia, A doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains two fields, called links, that are references to the previous and to the next node in the sequence of nodes. The beginning and ending nodes' previous and next links, respectively, point to some kind of terminator, typically a sentinel node or null, to facilitate traversal of the list. If there is only one sentinel node, then the list is circularly linked via the sentinel node. It can be conceptualized as two singly linked lists formed from the same data items, but in opposite sequential orders.

In this problem you have to implement the linked list in such a way so that the list is sorted and the next value of the largest value is the smallest one in the list, and previous of the smallest value is the largest one..

And you have to keep the following two features: 1. Insert a value. (You have to insert it keeping the sorted property) 2. Delete a value. (You have to delete it keeping the sorted property, if there are multiple same value delete anyone) At start your list is empty. After each insertion/deletion, you have to print the list.

Input: Each time input will contain two values, T and N. T is the operation type and N is the value. If T is 1, you have to insert N into the list. If T is 2, you have to delete N from the list. In the latter case, if N does not exist in the list, you have to show that message(See sample input and output for more details.) Output: You have to print the new list after each step. Sample Input and Output: [The inputs are shown in bold] The list is empty. 15 The list is: 5 12 The list is: 2 5 13 The list is: 2 3 5 1 -100 The list is: -100 2 3 5 22 The list is: -100 3 5 13 The list is: -100 3 3 5 25 The list is: -100 3 3 23 The list is: -100 3 25 5 is not in the list. The list is: -100 3

You might also like