What is the time complexity of deleting a node from a linked listed? Is it faster than deleting a node from an array? Why?

HONOR CODE

COMP-3040

Data Structures

Assignment-3

Due on 09/26/2018

I pledge my honor that I have neither given nor received aid on this work.

Do not sign until after you have completed your assignment.

Name: Signature:

Questions 1 – 3 are related to “singly linked list”. You must type your answer.

1. What are the fundamental operations of a linked list?

2. What is the main advantage of a linked list over an array?

3. What is the time complexity of deleting a node from a linked listed? Is it faster than

deleting a node from an array? Why?

4. Test program p2-1 linkedListClass, and make sure that you understand each operation in

the program.

5. Write a testing class that is similar to linkedListApplication class defined in p2-1 to test

program p2-2 DoubleLinkedList. Make sure that you understand each operation in the

program.

6. (Programming) Use p2-1 linkedListClass as a reference, add the following operations

in the class LinkedList;

Find the average data values of the linked list.

Find the item with largest key, and then delete the node.

Test ALL operations in the Main method. (Also display the average of the data values of

the linked list, the largest key, the linked list before and after deleting the node with the

largest key;

7. (Programming) Modify p2-1 SingleLinedList programs so that it handles employee

objects. Make your program menu-driven. The class employee is the same as in

Assignment 2:

import java.util.Scanner; public class employee { public int id; public String name; public double salary; public void Input() { System.out.println(“Enter name: “); name = new Scanner(System.in).nextLine(); System.out.println(“Enter ID: “); id = Integer.parseInt(new Scanner(System.in).nextLine()); System.out.println(“Enter Salary: “); salary = Double.parseDouble(new Scanner(System.in).nextLine()); } public void Output() { System.out.printf(“Name: %1$s, ID: %2$s, Grade: %3$s “, name, id, salary); } public String toString()

{ return String.format(“[Name: {0}, ID: {1}, Grade: {2}]”, name, id, salary); } }

Requirement for assignment reports

1. The cover page must be attached. 2. For each programming question, the submission must contain the program itself, proper

description of the program, and running page (screen shot) which shows that the program

works for all cases.

3. Add proper comments lines for non-trivial so that the instructors can read and understand the program.

4. Submit to e-learn by mid-night on the due date.

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"FIRST15"

Order Now