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
- How to insert elements in C++ STL List ?
- Optimal read list for given number of days
- How to Prepare a Word List for the GRE General Test
- Make middle node head in a linked list
- Delete adjacent duplicate nodes from the Doubly Linked List
- Set add() method in Java with Examples
- Hashtable remove() Method in Java
- ArrayDeque clone() Method in Java
- TreeMap tailMap() Method in Java
- IntBuffer equals() method in Java
- Deque getFirst() method in Java
- Java Long.toHexString() Method
- Java Math min() method with Examples
- ByteBuffer getChar() method in Java with Examples
- Provider entrySet() 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.