Hello. I would like to solve task,4,5 today.Please, with details
Task1: Write the implementation of the global (notmember) method removeElements(StackList S1, intx) that takes a stack and integer value x, and thenremoves elements from the stack until finding the value x or thestack becomes empty. The method should return the stack aftermodification.
Example: S1 =
98 |
11 |
76 |
23 |
12 |
After executing the method removeElements (S1, 23)
S1:
23 |
12 |
Task2: Write the implementation of the global (not member)method WrapQueue(QueueList Q1, int x).The method takes a Queue and integer value X, and then wraps thequeue according to the givenvalue.
Example: Q1 =
32 | 12 | 5 | 6 | 7 |
After executing the method WrapQueue(Q1, 3)
6 | 7 | 32 | 12 | 5 |
Note: Use the methods defined in the Queue ADT,(enQueue(int val),deQueue(),first()).
Task3: Write the implementation of the global(not member) method RevQue(QueueList Q1, intx). The method takes a Queue and integer value X, andreverses the order of the first X elements in the queue. The methodshould use the Stack structure to reverse the elements order.
Example: Q1 =
50 | 44 | 11 | 22 | 33 |
After executing the method RevQue(Q1, 3)
11 | 44 | 50 | 22 | 33 |
Task4: Use Big-O notation to analyze theefficiency of the methods that you implemented in tasks 1, 2, and3. Write the time complexity (in terms of Big-O) for each method asa comment in the source code file.
Task 5: Using the data structures you havelearned in this course, develop a management system for students'records in the college. The system should enable users toefficiently store, process/update, and track students’ records. Inorder to achieve this, design and implement the appropriatestructures/Classes/Interfaces/methods with space/time efficiency inmind
The main functionalities of the system:
For each student record, you need toinclude the following attributes (you can add more attributes asneeded):
(Studentid, Name, BirthDate, Mobile, Address, Specialty, GPA)
没有找到相关结果