you need to design, analyze, and implement algorithms to 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. The program 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 re-accessed. Requirements: The program should read a sequence of characters. The program should insert unseen character at the front of the list. The program should check if the character is not in the list to be inserted at the front of the list. The program should delete a duplicate character and delete it from the list and insert it at the beginning of the list. The program should check if the character is already in the list and delete the character from the list and insert it again at the beginning of the list. You need to implement the List ADT using Linked list implementation for the following operations in a file named “list.h”. You can add any operation if needed: list initialize() boolean IsEmpty (List) list insert (List and character) list delete(List and character) listPointer   search (List)   Your report should include a write up for the following: Justify and Explain briefly in at least 3 sentences the complexity of each operation in list.h file in terms of Big O notation. Justify your answers and discuss if there is any way to improve the complexity of the designed algorithms.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

you need to design, analyze, and implement algorithms to 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. The program 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 re-accessed.

Requirements:

  1. The program should read a sequence of characters.
  2. The program should insert unseen character at the front of the list. The program should check if the character is not in the list to be inserted at the front of the list.
  3. The program should delete a duplicate character and delete it from the list and insert it at the beginning of the list. The program should check if the character is already in the list and delete the character from the list and insert it again at the beginning of the list.
  4. You need to implement the List ADT using Linked list implementation for the following operations in a file named “list.h”. You can add any operation if needed:
    • list initialize()
  1. boolean IsEmpty (List)
  2. list insert (List and character)
  3. list delete(List and character)
  4. listPointer   search (List)

 

  1. Your report should include a write up for the following:
  2. Justify and Explain briefly in at least 3 sentences the complexity of each operation in list.h file in terms of Big O notation.
  3. Justify your answers and discuss if there is any way to improve the complexity of the designed algorithms.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage