Question: zy 1.17. LaetN c https://led' dybookscom,. zyBooks My library CSCI 2002 gigoritms and Data Structures home > 1 17. LastN e 2y3ooks calaluu @ elp/F40

zy 1.17. LaetN c https://led' "dybookscom,. zyBooks My library CSCI 2002 gigoritms and Data Structures home > 1 17. LastN e 2y3ooks calaluu @ elp/F40 Jama Ali 1.17 LastN For this lab, you will write a class called LastN which is a collection which implements the following AP Signature constuctor LastN(int nTokep constuctor void keep (String s) Function adds String to the list gelLaslN Strinalj get LestN() returns lhe lest "TuKeep lemts pussed 10 keep() LastNwill keep track ot the mas: recent nlokeop Strings passed to the kap) unction. This could be Lsed, ter exampe, to keep track c the last feww lines of a file ty assing lines one at a time to kep)At any time, the functian gctLastN may be called to get an aTay critainirg the last nToKeep Strings as an array, with the least recenit String in index 0 The following sequence of call:s in.kocp l one" In.keap" in.keapI"Eiv" would result in last being this array of 3 Strings ast [21i IMPORTANT DFTAll . Your implementation nt 1 astN may nat store more than nTaKeen strings You CANNOT stone ery 5tring passed to keep() Points will be deducted fycu use more memory than necessary. Assume tat a LastN 0ect may be askec to keep only the last 10 of a million strings. Since we're working on section 1.3 of the text you may assume that you need to use either a staco, queue, or bag to do this. The authors
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
