Question: due today!! help please Ins CSCI 2315 Data Structures S. (40 points) Using the (push, pop, top, and topindPop) to complete thi incosplete Liststack Class
Ins CSCI 2315 Data Structures S. (40 points) Using the (push, pop, top, and topindPop) to complete thi incosplete Liststack Class provided: complete theae four nethods s Iiststack Class. Please draw the Linked represented by the incomplete Liststack Class provided. ListStack Drawing s package weiss.nonstandard 3 // ListStack class s II CONSTRUCTION: with no initializer 711PUBLIC OPERATIONS*sssss s II void pushC x Insert x Remove most recently inserted ites Return nost recently inserted item "> Return and renove sost recent item Return true if empty; else false s II void pop) 10 // AnyType topC 11 // AmyType topAndPop( ) 12 // boolean isEnpty( ) 13 II void makeEmpty) Remove al1 items 14 11ERRORS 15 I/ top, pop, or topAndPop on empty stack 17 public class ListStackcAnyType> isplements StackcAnyType 19 public boolean isEmpty) 20 21 public void sakeEapty) t return topofStackull 23 24 25 26 topofStack ull; public void pushC AnyType x ) pub 2 pub 29 30 public AnyType topAndPop() 32 33 private ListNodecAnyTypes topofStack mul: 34 35 36 // Basic node stored in a linked list. 37 // Note that this class is not accessible outside 38 // of package weiss.nonstandard a9 class List NodecAnyType> public ListNode( AnyType theElement) 41 42 43 44 public ListNode( AnyType theElenent, ListNodecAnyType>n) 45 46 47 public AnyType elenent; 48 public ListNode next; 49 fthis theElement, nu11): t element theElement; next n;)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
