Hi there π, today is June 22, 2024. So, I woke up at 7 AM β° today, did some morning walk, yoga for 30 mins. Went to temple & then started the routine.
Today's Plan - π―
- June 22 (Sat): Study linked lists, practice easy problems. (4 hours)
Watch the videos for linked list from Udemy Course.
Master the Coding Interview: Data Structures + Algorithms
β What is linked list? βοΈ
- A linked list is a linear data structure that stores a collection of data elements dynamically.
- Nodes represent those data elements, and links or pointers connect each node.
- Each node consists of two fields, the information stored in a linked list and a pointer that stores the address of its next node.
- The last node contains null in its second field because it will point to no node.
- A linked list can grow and shrink its size, as per the requirement.
- It does not waste memory space.
β The linked list mainly has three types, they are:
- Singly Linked List
- Doubly Linked List
- Circular Linked List
β Essential Operation on Linked Lists π₯
- Traversing: To traverse all nodes one by one.
- Insertion: To insert new nodes at specific positions.
- Deletion: To delete nodes from specific positions.
- Searching: To search for an element from the linked list.
β Application of a Linked List
- A linked list is used to implement stacks and queues.
- A linked list also helps to implement an adjacency matrix graph.
- It is used for the dynamic memory location.
- The linked list makes it easy to deal with the addition and multiplication of polynomial operations.
- Implementing a hash table, each bucket of the hash table itself behaves as a linked list.
- It is used in a functionality known as undo in Photoshop and Word.
- With that, you have reached the end of this tutorial on Linked Lists.
β Some leet code question which I solved today π¨βπ»
- linked-list-cycle
- Merge Two Sorted Lists
- Remove Duplicates from Sorted List
- Intersection of Two Linked Lists
All the above leet code questions are solved from my end, I hope you will also try the same. If you can't solve it no problem. Learn it and try again. Never give up.
Always remember, your career is a marathon, not a sprint.
β Checkout some of my post
Top comments (0)