Remove Linked List Elements (LeetCode 203) | Quick and Easy Explanation | Study Algorithms

  Рет қаралды 7,072

Nikhil Lohia

Nikhil Lohia

Күн бұрын

A linked list is a beautiful data structure, but at the same time in order to ace this, you need to understand its components and how they interact with each other. One such problem is to remove elements from a linked list. In this video we take advantage of shuffling the pointers to find an efficient approach to the problem. All along with visualizations so you can understand what is happening behind the scenes.
Actual problem on LeetCode: leetcode.com/problems/remove-...
Chapters:
00:00 - Intro
00:54 - Problem Statement and Description
01:59 - A direct solution
03:59 - Playing with pointers
08:36 - Dry-run of Code
11:17 - Final Thoughts
📚 Links to topics I talk about in the video:
Linked Lists: • Linked List Data Struc...
Traversing a Linked List: • Traversing a Linked Li...
Data Structures: • Data Structures
📘 A text based explanation is available at: studyalgorithms.com
Code on Github: github.com/nikoo28/java-solut...
Test-cases on Github: github.com/nikoo28/java-solut...
📖 Reference Books:
Starting Learn to Code: amzn.to/36pU0JO
Favorite book to understand algorithms: amzn.to/39w3YLS
Favorite book for data structures: amzn.to/3oAVBTk
Get started for interview preparation: amzn.to/39ysbkJ
🔗 To see more videos like this, you can show your support on: www.buymeacoffee.com/studyalg...
🎥 My Recording Gear:
Recording Light: amzn.to/3pAqh8O
Microphone: amzn.to/2MCX7qU
Recording Camera: amzn.to/3alg9Ky
Tablet to sketch and draw: amzn.to/3pM6Bi4
Surface Pen: amzn.to/3pv6tTs
Laptop to edit videos: amzn.to/2LYpMqn
💻 Get Social 💻
Follow on Facebook at: / studyalgos
Follow on Twitter at: / studyalgorithms
Follow on Tumblr at: / studyalgos
Subscribe to RSS feeds: studyalgorithms.com/feed/
Join fan mail: eepurl.com/g9Dadv
#leetcode #programming #interview

Пікірлер: 20
@minnikeswarrao6185
@minnikeswarrao6185 Жыл бұрын
One small improvisation can be done... To change the head and tail pointers when the node to be deleted is one of them... However you are just awesome mann🤩
@ArunaSrivastava-xb5eq
@ArunaSrivastava-xb5eq 10 ай бұрын
You are the best, lots of love from seattle
@nikoo28
@nikoo28 9 ай бұрын
Thank you so much. I have been to Seattle too :D
@jayprakashjaiswal8220
@jayprakashjaiswal8220 Жыл бұрын
nice explaination bhaiya
@ymhuang651
@ymhuang651 Жыл бұрын
Keep Going!🤩
@nikoo28
@nikoo28 Жыл бұрын
🚀
@subee128
@subee128 6 ай бұрын
Thanks
@CodeOs5
@CodeOs5 Жыл бұрын
sir can you comment the name of book that u mentioned in one of your video for ds algo
@nikoo28
@nikoo28 Жыл бұрын
The book is always available in every video description :)
@honey-xr5kp
@honey-xr5kp 4 ай бұрын
what is that x: -1 when you create the dummy head node? I've never seen that before.
@atharv_rege5869
@atharv_rege5869 2 ай бұрын
that x is the variable or parameter in which -1 is stored
@atharv_rege5869
@atharv_rege5869 2 ай бұрын
it is just the data part of the dummy node because we dont actually need the data of the dummy node
@satendrachauhan5120
@satendrachauhan5120 6 ай бұрын
What about this node [5,5,5,5,5]🤔🤔
@nikoo28
@nikoo28 5 ай бұрын
what is the value of 'val'?
@preetnandeshwar5331
@preetnandeshwar5331 4 ай бұрын
@@nikoo28 val = 5
@atharv_rege5869
@atharv_rege5869 2 ай бұрын
@@nikoo28 bhaiya what if the the node which is updated itself contains the val because we are actuallly checking the data of the next node but if the present node contains the data then it will not be removed na?? like if the ll is 1-> 2 -> 3 -> 3 -> 4 and the val is 3
@zerkinanastya4410
@zerkinanastya4410 11 ай бұрын
Thank you dearly for the video! It helps a lot! But could you please explain the (x:-1) notation in new ListNode(x:-1); and how it will look like in js? Bc I can create a dummy node in js with this notation: let dummy = new ListNode(); or I can pass 0 or -1 in ListNode(-1) or ListNode(0) and it still works. Why should we write -1. I am new to programming, so if only you could explain…🙏I would be much grateful!
@allahs_creation233
@allahs_creation233 Жыл бұрын
increase volume
@nikoo28
@nikoo28 Жыл бұрын
it should be better in the latest videos. :)
@shivraj940
@shivraj940 8 ай бұрын
Implement queue using Linked List : Its very simple . we don't have to think much on this. 4 operation of Queue Data structure : FIFO 1. Enqueue() -> Simply insert the element in tail part -> TC : O(1) 2. Dequeue() -> Simply move head ie) head = head.next -> TC : O(1) 3. front() -> head.val -> TC:O(1) 4. isEmpty() -> return head == null -> TC:O(1)
Зачем он туда залез?
00:25
Vlad Samokatchik
Рет қаралды 2,1 МЛН
Nutella bro sis family Challenge 😋
00:31
Mr. Clabik
Рет қаралды 14 МЛН
Leetcode 46. Permutations : Introduction to backtracking
10:06
ComputerBread
Рет қаралды 89 М.
The Algorithm Behind Spell Checkers
13:02
b001
Рет қаралды 408 М.
Generative AI in a Nutshell - how to survive and thrive in the age of AI
17:57