Self Organizing list is a list that re-organizes or re-arranges itself for better performance. In a simple list, an item to be searched is looked for in a sequential manner which gives the time complexity of O(n). But in real scenario not all the items are searched frequently and most of the time only few items are searched multiple times.
So, a self organizing list uses this property (also known as locality of reference) that brings the most frequent used items at the head of the list. This increases the probability of finding the item at the start of the list and those elements which are rarely used are pushed to the back of the list.
In Move to Front Method, the recently searched item is moved to the front of the list. So, this method is quite easy to implement but it also moves in-frequent searched items to front. This moving of in-frequent searched items to the front is a big disadvantage of this method because it affects the access time.
Input : list : 1, 2, 3, 4, 5, 6 searched: 4 Output : list : 4, 1, 2, 3, 5, 6 Input : list : 4, 1, 2, 3, 5, 6 searched : 2 Output : list : 2, 4, 1, 3, 5, 6
List: 1 --> 2 --> 3 --> 4 --> 5 Searched: 4 List: 4 --> 1 --> 2 --> 3 --> 5 Searched: 2 List: 2 --> 4 --> 1 --> 3 --> 5
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Move last element to front of a given Linked List
- Move last m elements to the front of a given Linked List
- Move last element to front of a given Linked List | Set 2
- Move all zeros to the front of the linked list
- Self Organizing List : Count Method
- Queries to search an element in an array and move it to front after every query
- Self Organizing List | Set 1 (Introduction)
- Move first element to end of a given Linked List
- Move all occurrences of an element to end in a linked list
- An interesting method to print reverse of a linked list
- Print the alternate nodes of linked list (Iterative Method)
- Iteratively Reverse a linked list using only 2 pointers (An Interesting Method)
- Length of longest palindrome list in a linked list using O(1) extra space
- Partitioning a linked list around a given value and If we don't care about making the elements of the list "stable"
- Rotate the sub-list of a linked list from position M to N to the right by K places
- Create new linked list from two given linked list with greater element at each node
- Convert singly linked list into circular linked list
- XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
- XOR Linked List - A Memory Efficient Doubly Linked List | Set 1
- Difference between Singly linked list and Doubly linked list
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.