Assume you are in charge of a news website and want to show the k most...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assume you are in charge of a news website and want to show the k most oft en clicked articles on the landing page, in descending order of clicks received. You are given an array A of m articles where A[i] includes the heading (string) and the click count (int eger) of article i. 1. What Abstract Data Type would suit this application? Explain your choice! 2. From the discussed datastructures (implementations) for this ADT which is the most efficient implementation given this problem description? 3. Write a met hod that uses this ADT to return the k most clicked entries. Use this template for java 1 class Entry implements Comparable 3 4 5 6 7 8 9 10. 11 12 13 14 15 16 17 18 19 21 22 23 24 25 27 28 29 30 31 } public String heading; public Integer clickCount; public Entry (String heading, Integer clicks) { this.heading heading; this.clickCount = clicks; } public static Entry [] top_entries (Entry[] entries, int k) { // TODO: Use your chosen ADT here to //get the top k entries and return them } public static void main (String[] args) { Entry] entries ( new Entry ("aa3", 3), new Entry("aa10", 10), new Entry ("aal", 1), new Entry("aa100", 100), new Entry("aa4", 4), } new Entry ("aa20", 20), new Entry("aa5", 5), }; for (Entry e: Entry.top_entries (entries, 3)) { System.out.println(String.format ("%s %d", e.heading, e.clickCount)); 4. What are the complexities of the methods that you use in your implementation? Assume you are in charge of a news website and want to show the k most oft en clicked articles on the landing page, in descending order of clicks received. You are given an array A of m articles where A[i] includes the heading (string) and the click count (int eger) of article i. 1. What Abstract Data Type would suit this application? Explain your choice! 2. From the discussed datastructures (implementations) for this ADT which is the most efficient implementation given this problem description? 3. Write a met hod that uses this ADT to return the k most clicked entries. Use this template for java 1 class Entry implements Comparable 3 4 5 6 7 8 9 10. 11 12 13 14 15 16 17 18 19 21 22 23 24 25 27 28 29 30 31 } public String heading; public Integer clickCount; public Entry (String heading, Integer clicks) { this.heading heading; this.clickCount = clicks; } public static Entry [] top_entries (Entry[] entries, int k) { // TODO: Use your chosen ADT here to //get the top k entries and return them } public static void main (String[] args) { Entry] entries ( new Entry ("aa3", 3), new Entry("aa10", 10), new Entry ("aal", 1), new Entry("aa100", 100), new Entry("aa4", 4), } new Entry ("aa20", 20), new Entry("aa5", 5), }; for (Entry e: Entry.top_entries (entries, 3)) { System.out.println(String.format ("%s %d", e.heading, e.clickCount)); 4. What are the complexities of the methods that you use in your implementation?
Expert Answer:
Related Book For
A Survey Of Mathematics With Applications
ISBN: 9780135740460
11th Edition
Authors: Allen R. Angel, Christine D. Abbott, Dennis Runde
Posted Date:
Students also viewed these programming questions
-
On January 1, Year 10, Awesome Contracting Corporation (ACC) purchased a specialized piece of construction equipment for $115,000 from Bulldozer Corporation (BC) and immediately leased it to...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Using the sinking fund Table 13.3, complete the following: Note: Do not round intermediate calculations. Required amount $ Frequency of Length of payment time 8 years 15,000 Annually Interest rate 8...
-
Have you witnessed any changes in international business activity in your hometown over the past five years? How would you make a convincing case that open trade in goods and services as well as,...
-
For a major university, match each cost in the following table with the activity base most appropriate to it. An activity base may be used more than once, or not used at all. Cost: Activity Base: 1....
-
Ki Corp. is in liquidation under Chapter 7 of the Federal Bankruptcy Code. The bankruptcy trustee has established a new set of books for the bankruptcy estate. After assuming custody of the estate,...
-
George Company purchased land for use as its corporate headquarters. A small factory that was on the land when it was purchased was torn down, and before the new buildings foundation could be...
-
The Rolling Department of Jabari Steel Company had 5,300 tons in beginning work in process inventory (70% complete) on October 1. During October, 87,800 tons were completed. The ending work in...
-
The Rolling Rock Restaurant records its payroll weekly for salaried and hourly rate employees separately. Jessica Talbot and Kristen Millar are salaried employees. There annual salaries are...
-
It is discovered that production of painclear damages groundwater quality - this affects just one party: Greenview Nature Park (a park run by the local council which people can access, for free, for...
-
You are given the following information about a 30-year bond: The par value is 2000. The redemption value is 2250. i) ii) iii) iv) v) vi) Calculate the modified duration of the bond, based on the...
-
Key outputs of the Technical Planning process include: ( Select the two answers that apply. ) A ) A Systems Engineering Plan ( SEP ) B ) A Test and Evaluation Master Plan ( TEMP ) C ) Any previously...
-
Why is there an error here? O 13 15 16 17 public class A { } int func1(final int x) { x*j; } X = return x;
-
Describe four key ways that Forster's story "the machine stops" predicts the modern world and its technologies?
-
If an insurance firm is evaluated to be financially weak, what suggestions you can provide to the general manager?
-
The following data are supplied for the common stocks of Nikola Corporation, Tesla, Inc. and General Motors: Nikola Corp (NKLA) Tesla Inc. (TSLA) Close Price ($) Close Price ($) 67.53 30.00 40.81...
-
Write an equation and solve. The product of 9 and a number is 54
-
Fill in the blanks with an appropriate word, phrase, or symbol(s). A circuit that passes through each edge of a graph exactly one time is called a(n) ________ circuit.
-
Fill in the blanks with an appropriate word, phrase, or symbol(s). For the rational number p/q, q is called the ________.
-
Midwest Energy Group has issued preferred stocks ($10 par value) that pay 8 percent dividend annually. If the required rate of return is 15 percent, what is the value of the stock?
-
You are considering an investment in one of the preferred stocks of either Longines Watch Company or Titoni Watch Company. Longiness preferred stock pays an annual dividend of \($2.73,\) while that...
-
Calculate the value of Swatchs preferred stock that pays a dividend of $8 per share if your required rate of return is 14 percent.
Study smarter with the SolutionInn App