Flattening a Linked List | GeeksforGeeks

  Рет қаралды 62,641

GeeksforGeeks

GeeksforGeeks

7 жыл бұрын

Explanation for the article: www.geeksforgeeks.org/flatteni...
This video is contributed by Harshit Jain.

Пікірлер: 31
@HarshaVardhan-jf9sd
@HarshaVardhan-jf9sd 5 жыл бұрын
Cant get a more dumber explanation of this algorithm...Great job
@divyeshpuri
@divyeshpuri 3 жыл бұрын
This dude assumed that the reason I am here is that I didn't know how to read.
@gallilos
@gallilos 5 жыл бұрын
sir you should not be a teacher
@caligula2167
@caligula2167 5 жыл бұрын
Thank you for the video. Hey guys. If anyone is struggling with this algorithm, basically what you need to do in order to solve this is: 1) write a function to merge any two sorted lists 2) in the function that you will use for flattening, merge the first two nested lists, then merge the third into your list.and so on, to the end of the argument-list. Regarding the 2), below is the Python-ish pseudo-code that may help clarify the idea (please do let me know of any bugs that could've snuck in): ``` result = head->down node = head->next while node is not nil: result = merge_lists(result, node->down) node = node->next ``` Kind Regards
@bostonlights2749
@bostonlights2749 4 жыл бұрын
Dude, at least explain the flow with an example. (You could use the example in the question) Otherwise it's just a waste of time.
@hardikpatel-90
@hardikpatel-90 6 жыл бұрын
bekar.. who will explain the code for such a algo??
@Mohit-cn2us
@Mohit-cn2us 4 жыл бұрын
*What's the time complexity for the algorithm ?*
@anirudhdevpura2798
@anirudhdevpura2798 4 жыл бұрын
Please share the logic and intuition behind the code and then read the code. Expected much better from gfg
@SaurabhYadav-hh7fx
@SaurabhYadav-hh7fx 4 жыл бұрын
You are just reading the code man!!
@annasbinfazal340
@annasbinfazal340 6 жыл бұрын
please convert that code in GUI, if is it possible!
@pranaychandra8016
@pranaychandra8016 5 жыл бұрын
Anyone have a solution using min heap or priority queue then please share the link or contribute in any other form.
@asthanarht
@asthanarht 5 жыл бұрын
you should clear problem by example instead of repeating code block
@shivaniguptacv1215
@shivaniguptacv1215 3 жыл бұрын
Time complexity?
@dishagupta7446
@dishagupta7446 3 жыл бұрын
Time complexity??
@shivamguptayoutube
@shivamguptayoutube 3 ай бұрын
Thanks!
@pushangupta4815
@pushangupta4815 4 жыл бұрын
If anyone is having a hard time through this algorithm, I have an alternate solution... Traverse the given linked list by first visiting all the bottom nodes of each main nodes. As you traverse, make a binary search tree(AVL for better performance) and then do a preorder traversal and see the magic!
@rajveersanghvi6678
@rajveersanghvi6678 4 жыл бұрын
You mean inorder traversal?
@theguy5423
@theguy5423 4 жыл бұрын
@@rajveersanghvi6678 yeah... My bad
@AmitRajArtist
@AmitRajArtist 4 жыл бұрын
Thanks...
@keshavrastogi5005
@keshavrastogi5005 5 жыл бұрын
Such a pathetic explanation. Did someone force you to make and upload video. Please don't do it as it waste lot of our time. We trust geeksforgeeks and that's why thought to watch this video.
@srinidhibhat3955
@srinidhibhat3955 7 жыл бұрын
The explanation is sub-par compared to many of the videos in the play list. I feel it is essential to explain the code with an example thought the video and not just displaying the functions.
@GeeksforGeeksVideos
@GeeksforGeeksVideos 7 жыл бұрын
Thanks for the feedback. We will share this with our contributors.
@30secondsEmotions
@30secondsEmotions 4 жыл бұрын
for all those who are facing difficulty in understand this, I want to say that ,sir has explained very nicely, ,,but if you want other algorithm, you simply make the list linear by joining the vertical list in between two nodes,,,,,two nodes can be node from which it is attached and other node is it's adjacent node, and simply sort it,
@30secondsEmotions
@30secondsEmotions 4 жыл бұрын
like this,,,, like you have a list which you want to flat, a function named-- makeFlattenedList() which simple makes the list linear without sorting,,,by joining vertical list in between two nodes of base list and after it call the function -- sortList (),,, it will sort the list
@sahilanower9189
@sahilanower9189 3 жыл бұрын
hats off Harshit bro! Successfully wasted lot of my fucking time
@subham-raj
@subham-raj 4 жыл бұрын
*Use MinHeap that's much better*
@adityaaggarwal4622
@adityaaggarwal4622 4 жыл бұрын
Good jobs just need some support of logic and GFG are always there :)
@PRIYANKAKUMARI-iz2no
@PRIYANKAKUMARI-iz2no 5 жыл бұрын
wasted my time.
Merge Overlapping Intervals | GeeksforGeeks
18:26
GeeksforGeeks
Рет қаралды 59 М.
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 408 М.
Gym belt !! 😂😂  @kauermotta
00:10
Tibo InShape
Рет қаралды 18 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 19 МЛН
Can A Seed Grow In Your Nose? 🤔
00:33
Zack D. Films
Рет қаралды 30 МЛН
Hash Tables and Hash Functions
13:56
Computer Science
Рет қаралды 1,5 МЛН
Google Data Center 360° Tour
8:29
Google Cloud Tech
Рет қаралды 5 МЛН
Top 7 Algorithms for Coding Interviews Explained SIMPLY
21:22
Codebagel
Рет қаралды 344 М.
What is Cloud Computing and How does it work? #geeksforgeeks
1:01
GeeksforGeeks
Рет қаралды 1,3 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 441 М.
Reverse Linked List II - Leetcode 92 - Python
16:03
NeetCode
Рет қаралды 75 М.
Gym belt !! 😂😂  @kauermotta
00:10
Tibo InShape
Рет қаралды 18 МЛН