0% found this document useful (0 votes)
6 views

EXPERIMENT 3 - Linked List Nishtha

Uploaded by

Nishtha Sharma
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)
6 views

EXPERIMENT 3 - Linked List Nishtha

Uploaded by

Nishtha Sharma
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/ 6

EXPERIMENT 3

NAME : Nishtha Sharma SUBJECT CODE: 20CSP-314


UID : 20BCS5674 DATE OF PERFORMANCE: 22-08-2022
CLASS : 20BCS_WM_609 (B)
SUBJECT : Competitive Coding Lab

Aim/Overview of the practical: Understanding the Concepts and problem


solving question on Linked list Data structures.

Task to be done: Solving Hacker rank Linked list based problems

Question: You are given the pointer to the head nodes of two linked lists.
Compare the data in the nodes of the linked lists to check if they are equal. If all
data attributes are equal and the lists are the same length, return 1. Otherwise,
return 0.

CODE:
QUESTION: Given a reference to the head of a doubly-linked list and an
integer, data, create a new DoublyLinkedListNode object having data value and
insert it at the proper location to maintain the sort.

CODE:
QUESTION: Given the pointer to the head node of a doubly linked list,
reverse the order of the nodes in place. That is, change
the next and prev pointers of the nodes so that the direction of the list is
reversed. Return a reference to the head node of the reversed list.
Note: The head node might be NULL to indicate that the list is empty.

CODE:
QUESTION: Given pointers to the head nodes of 2 linked lists that merge
together at some point, find the node where the two lists merge. The merge
point is where both lists point to the same node, i.e. they reference the same
memory location. It is guaranteed that the two head nodes will be different,
and neither will be NULL. If the lists share a common node, return that
node's data value.
Note: After the merge point, both lists will share the same node pointers.

CODE:
QUESTION: A linked list is said to contain a cycle if any node is visited more than
once while traversing the list. Given a pointer to the head of a linked list,
determine if it contains a cycle. If it does, return 1 . Otherwise, return 0.

CODE:

You might also like