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 Transpose Method, the node that is accessed is swapped with its predecessor. So if any node is accessed, it is swapped with the node in-front of it unless it is the first(head) node in the list. In simple terms the priority of an accessed node is increased slowly such that it eventually reaches the first position. The main difference between transpose method and other methods is that, it takes many accesses to bring a node to front.
Input : list: 1, 2, 3, 4, 5, 6 searched: 4 Output : list: 1, 2, 4, 3, 5, 6 Input : list: 1, 2, 4, 3, 5, 6 searched: 5 Output : list: 1, 2, 4, 5, 3, 6 Explanation: In 1st case, 4 is swapped with its predecessor i.e. 3 In 2nd case, 5 is swapped with its predecessor i.e. again 3
List: 1 --> 2 --> 3 --> 4 --> 5 --> 6 Searched: 4 List: 1 --> 2 --> 4 --> 3 --> 5 --> 6 Searched: 5 List: 1 --> 2 --> 4 --> 5 --> 3 --> 6
- Optimal read list for given number of days
- How to insert elements in C++ STL List ?
- Delete adjacent duplicate nodes from the Doubly Linked List
- Why start + (end - start)/2 is preferrable method for calculating middle of an array over (start + end)/2 ?
- Make middle node head in a linked list
- Java Math min() method with Examples
- LongAccumulator getThenReset() method in Java with Examples
- Java Long.toHexString() Method
- Java lang.Long.builtcount() method in Java with Examples
- Hashtable remove() Method in Java
- TreeMap tailMap() Method in Java
- ArrayDeque clone() Method in Java
- IntBuffer equals() method in Java
- Deque getFirst() method in Java
- Provider entrySet() method in Java with Examples
- OffsetDateTime getOffset() method in Java with examples
- Locale toString() Method in Java with Examples
- Locale getVariant() Method in Java with Examples
- Locale getAvailableLocales() Method in Java with Examples
- Locale getISOCountries() Method in Java with Examples
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.