KalAcademy - Assignment7 This assignment contains writing algorithms and making descriptive videos for the algorithems which is accessible through this file, and also this repository includes all the implemented algorithms:
1- Given a singly linked list, find middle of the linked list.
2-Given a singly linked list, rotate the linked list counter-clockwise by k nodes. Where k is a given positive integer smaller than or equal to length of the linked list. For example, if the given linked list is 10->20->30->40->50->60 and k is 4, the list should be modified to 50->60->10->20->30->40.
3-Given a linked list, write a function to reverse every k nodes (where k is an input to the function).If a linked list is given as 1->2->3->4->5->6->7->8->NULL and k = 3 then output will be 3->2->1->6->5->4->8->7->NULL.
4-Given a linked list, check if the the linked list has a loop. Linked list can contain self loop.
5-Given a linked list, the task is to find the n'th node from the end.
6-Given two linked lists sorted in ascending order. Merge them in-place and return head of the merged list. For example, if first list is 10->20->30 and second list is 15->17, then the result list should be 10->15->17->20->30. It is strongly recommended to do merging in-place using O(1) extra space.
7-Given a Linked List where every node represents a linked list and contains two pointers of its type: (i) anext pointer to the next node (ii) a bottom pointer to a linked list where this node is head.
You have to flatten the linked list to a single linked list which is For Ex: Shown below is a given linked list
5 -> 10 -> 19 -> 28 | | | | V V V V 7 20 22 35 | | | V V V 8 50 40 | | V V 30 45
and after flattening it, the sorted linked list looks like:
5->7->8->10->19->20->22->28->30->35->40->45->50
The node structure has 3 fields as mentioned. A next pointer, a bottom pointer and a data part.
8-Given a singly linked list, write a function to swap elements pairwise. For example, if the linked list is 1->2->3->4->5 then the function should change it to 2->1->4->3->5, and if the linked list is 1->2->3->4->5->6 then the function should change it to 2->1->4->3->6->5.
9- Given two numbers represented by two lists, write a function that returns sum list. The sum list is list representation of addition of two input numbers. Suppose you have two linked list 5->4 ( 4 5 )and 5->4->3( 3 4 5) you have to return a resultant linked list 0->9->3 (3 9 0).
- Given a singly linked list of integers, Your task is to complete the function isPalindrome that returns true if the given list is palindrome, else returns false.