Reference no: EM132322534
Assignment
1. Write separate programs for the following exercises in Java, Python, or C#. Each file should have your name at the top in comment, with short description of what is implemented in that file. Make sure your files have appropriate names as indicated in each exercise. Programs should write output to the Console and have hard coded input in main.
Note 1: If a program is not in approved programming language (or in different language than previous assignment) or has any syntax error, no points will be awarded for that exercise
Note 2: Submitting wrong files or in the wrong format or corrupted files will not be accepted nor will any re-submission be allowed for any such mistake. It is your responsibility to submit the correct files.
a) DLinkedListADT: Implement doubly linked list ADT using the pseudo code covered in class. The data-type that the ADT should store should be a Student object with the following attributes/members: name (string), id (integer), grade (character). You must have all the operations in the pseudo code with the SAME naming convention and statements. The operations printNextList and printPrevList should only print the student's name.
Any operation that is implemented differently from the one given, will not earn credit. Write test program with main method creating an instance of the DLinkedListADT and calling all the operations to demonstrate they work correctly. You must implement a class called DLinkedListADT for the ADT implementation in one file and a separate TestDLinkedList class for the test in a different file. You also need a third file with an implementation of Student class.
b) ConvertToArray: Implement a method that takes DLinkedListADT instance. The method then allocates an array students[] and copies all elements over from the list to the array. The method prints each element's data on separate line and returns the array to the
caller. The method must check if the list is null/None or empty and throw an exception if it is. Analyze time/space complexity of the method. Write a main method to test the code.
c) ListInsert: Add new linked list operation to DLinkedListADT. The operation is called insertBefore and takes two parameters: insertBefore(String name, Student student).
Then it finds the first node in the list that matches the name and inserts a new node with student value as the previous node in the list. If the list is null it just adds the new Node and if the name is not found in the list it throws an exception with message that the value is not found. Add test cases to TestDLinkedList class from exercise (a) to demonstrate the code works. Analyze time/space complexity of the new operation.
For example:
Given linked list with student elements that have the following name order {"Joe", "Jane", "John"} when we call insertBefore ("Jane", student) where the student has the values {"Beth", 12345, ‘A'} the updated list will have node elements in the following name order: {"Joe", "Beth", "Jane", "John"}
d) QueueADT: Implement Queue ADT using the DLinkedListADT from previous exercise to store Student objects as elements and to include operations:
QueueADT(int min)
boolean isEmpty()
boolean isFull()
void enQueue(Student item)
Student deQueue()
int size()
You must use the QueueADT pseudo code covered in class and use the given operation names and implementation. You cannot not have any other operations. Write test program with main method to demonstrate the correct working of each operation (use double values for your test data). You must implement a class called QueueADT and separate TestQueue class each in a separate file.
e) StackADT: Implement StackADT using the DLinkedListADT from previous exercise to store Student objects as elements and to include operations:
StackADT(int min)
boolean isEmpty()
boolean isFull()
void push(Student item)
Student pop()
int size()
You must use the pseudo code covered in class and use the given operation names and implementation. You should not have any other operations. Write main method to demonstrate the correct working of each operation in a separate test program (use double values for your test data). You must implement a class called StackADT and TestStack class in a separate file.
f) Stack1: A letter means doing a push operation and an asterisk means doing a pop operation n the below sequence. Give the sequence of letters which are returned by the pop operations when this sequence of operations is performed on an initially empty stack.
AB*CE**F**GH*I**
g) Stack2: Given an empty stack in which the values A, B, C, D, E are pushed on the stack in that order but can be popped at any time, give a sequence of push and pop operations which results in pop()ed order of CEDBFA 2.
Record a video(s) 10-20min long explaining the implementation and solution of each of the above programs to include showing the running program and output. You may have two separate videos if you need more time to explain all exercises. DO NOT create separate videos for each exercise!!!
Attachment:- pseudo code.rar