| title | Algorithm4 Java Solution 1.3.40 | ||
|---|---|---|---|
| date | 2019-07-28 08:47:27 +0800 | ||
| draft | false | ||
| tags |
|
||
| categories |
|
Move-to-front. Read in a sequence of characters from standard input and maintain the characters in a linked list with no duplicates. When you read in a previously unseen character, insert it at the front of the list. When you read in a duplicate character, delete it from the list and reinsert it at the beginning. Name your program MoveToFront: it implements the well-known move-to-front strategy, which is useful for caching, data compression, and many other applications where items that have been recently accessed are more likely to be reaccessed
code:
linked list add find() method, return a previous of the node if node.item equals given item.