(Including python code) Need all complete answers, thank you.
Design a generic local cache with the following property: if the cache is asked for a key that it doesn’t contain, it should fetch the data using an externally provided function that reads the data from another source (database or similar). Note that from the client perspective, the cache is read-only; it should be populated autonomously and dynamically as clients request data from the cache.
What features do you think such a cache should offer? How, in general lines, would you implement it?
Suppose we have a corpus of documents with integer identifiers and an inverted index, which maps words to Skip Lists of document identifiers (If you haven’t encountered skip lists in the past, feel free to google it). Our skip list implements the following interface:
1. getDocld() – returns the identifier of the document in the current position of the skip list cursor.
2. skipTo(docld) – moves the cursor to the first position where the document identifier is equal or greater than the docld parameter.
3. skipToNext() – move the skip list cursor to the next position. A possible implementation of this function is by calling skipTo(getDocld() + 1).
A. Describe an algorithm which, given a query of two words, returns all document identifiers of the documents that contain the two words.
B. Describe an algorithm which, given a query of N words, returns all document identifiers of the documents that contain all N words.
C. Describe an algorithm which, given a query of N words, returns all document identifiers of the documents that contain at least K words.
An emphasis will be given to the time and space complexity of the solutions.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more