Some real-world examples of the Data structure "Linked List" 👇
A thread 🧵
🔸Train is an example of a linked list as it is made up of a collection of railroad cars where each car is connected to the car in front of it.
🔸A chain is an example of a linked list as it is connected in a linked list fashion. Each link is connected with the next one.
🔸One funny example of linked list
🔸Image viewer is also an example of a linked list as you can view the previous and next image respective to the current image
🔸Previous and forward navigation in your browser is also implemented in a linked list
🔸A music player in which we can only play the next song after current and not the previous one is an example of a singly linked list
🔸A music player in which we can play both the previous as well as the next song is an example of a doubly linked list
🔸A music player in which we can play songs in loop i.e after finishing the last song it automatically plays the first song is an example of circular linked list
🔸Undo redo operations are mostly implemented in a linked list
🔸Keeping track of turns in a multiplayer board game is an example of a circular linked list. Put all the players in a circular linked list. After a player takes his turn, advance to the next player in the list.
🔸Musical chair game is an example of a circular linked list in which chairs are connected in a circular link and after each iteration of the game, one chair (node) is removed from the list.
🔸Planning a trip to some particular destination is an example of a linked list as you plan a series of directions where to go to after which place. Each step in the navigation sequence has a logical order and then points to the direction to take after the current step.
🔸GPS Navigation: A linked list of map data. Traveling from origin to destination is an example of traversing through all nodes.
Rerouting by a GPS is an example of Add and Remove operations of map data.
This is the end of the thread.
Real-life examples for other data structures coming soon. Be sure to give a follow to @meetjain74
After making m1 = null m1 becomes eligible for garbage collection. So when we call garbage collector the first time, Garbage Collector will call finalize() method on m1 before destroying it.
The finalize method will print "Finalise" here but in finalize method we are again referencing the same object by m which makes it no longer eligible for garbage collection. Hence the garbage collector will not destroy the object.
Confused about implementing data structures in real problems?
See some real-world examples of the Data structure "Array" today 👇
A thread 🧵
🔸A parking lot is an example of an array with each index of the array storing whether a car is present or not. Or it may be used for some other functionality.
Want to become an Android developer or start your journey with Android development but have not started yet?
Let me help you create your first Android app to kick off your Android journey.
Work with me to the end of the thread 🧵🧵
First, download Android Studio on your PC through this link and complete the setup and wait for all indexing and initial build to finish (might take time so keep patience) developer.android.com/studio
🔸Click on create new Project
🔸Select Empty Activity
🔸Click on next