Question: C++ This is a LINKED LIST implementation. 1/PART A: Complete the code below (do not use any standard libraries) /PART B: For each public method,
C++ This is a LINKED LIST implementation.
1/PART A: Complete the code below (do not use any standard libraries) /PART B: For each public method, provide a big-oh bound on the worst case run-time for that method in terms of the number of items n, contained in 5 //the data structure at the time of the method call. Justify your bound in each case. class stackLL 9 private: 10 12 13 14 15 16 class node public: int data; node * next; node * top; 9 public: 20 stackLL() 21 //your code here 23 24 25 26 27 28 29 30 31 32 stackLL ) //your code here //return true if empty, false if not bool empty () return top 0; 3 4 35 36 37 38 39 40 //add item to top of stack void push (int x) //your code here 42 43 //remove and return top item from stack int pop ) 45 46 47 //your code here //remove and return the kth item from the top of the stack. int popkth (int k) 49 50 51 52 53 5 4 //your code here //decimate: remove every 10th item from the stack void decimate () 56 57 58 59 60 61 62 63 64 65 //your code here //add item x to stack, but insert it //right after the current ith item from the top // (and before the i+1 item) void insertAt (int x, int i) //your code here 67 68 1/PART A: Complete the code below (do not use any standard libraries) /PART B: For each public method, provide a big-oh bound on the worst case run-time for that method in terms of the number of items n, contained in 5 //the data structure at the time of the method call. Justify your bound in each case. class stackLL 9 private: 10 12 13 14 15 16 class node public: int data; node * next; node * top; 9 public: 20 stackLL() 21 //your code here 23 24 25 26 27 28 29 30 31 32 stackLL ) //your code here //return true if empty, false if not bool empty () return top 0; 3 4 35 36 37 38 39 40 //add item to top of stack void push (int x) //your code here 42 43 //remove and return top item from stack int pop ) 45 46 47 //your code here //remove and return the kth item from the top of the stack. int popkth (int k) 49 50 51 52 53 5 4 //your code here //decimate: remove every 10th item from the stack void decimate () 56 57 58 59 60 61 62 63 64 65 //your code here //add item x to stack, but insert it //right after the current ith item from the top // (and before the i+1 item) void insertAt (int x, int i) //your code here 67 68
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
