Skip to content

Latest commit

 

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assignment7

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.

https://youtu.be/aywAP9j5Mos

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.

https://youtu.be/gNwyEJmhkts

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.

https://youtu.be/eHGwWjXBS-A

4-Given a linked list, check if the the linked list has a loop. Linked list can contain self loop.

https://youtu.be/oRt7SVR-yL8

5-Given a linked list, the task is to find the n'th node from the end.

https://youtu.be/hb8u911NOqo

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.

https://youtu.be/zA4j7eOsWYI

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.

https://youtu.be/whmMWaY8G-Q

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.

https://youtu.be/DGhUujKzxWw

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).

https://youtu.be/zCPoBndNR6E

  1. 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.

https://youtu.be/pyFh8WOiUOI

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages