top of page

Data Structures and Algorithms Sample Assignment

Task 1

This task requires you to produce a fully working program, which will compare operation times of various sorting algorithms for given set of data.

You should carefully consider the criteria below and then develop a fully documented program that will calculate the time taken to sort lists of 10, 100, 1000, 10000 integer numbers.

There should be a minimum of 3 sorting algorithms used in the program, including an insertion sort, a bubble sort and another sorting algorithm of your choice.

You must write a report that includes the following:

  • A description of each algorithm used, including pseudo code and/or flowcharts

  • A full code listing with comments

  • A table of results showing the time required for each algorithm to execute once. Use the speed of insertion sort as a guide to compensate for different processor speeds.

  • An explanation of how the timing of each algorithm is achieved.

  • Justification of the best sorting algorithm to be used for the various data sets supplied


Task 2
  • Create a new Java project called your name. Use the underscore (_) to replace any space characters.

  • Create a new package in this project called assignment2_1.

  • Add the following class to this package:

  • Date (attributes: <int>day, <int> month, <int> year) –

  • Methods:

    • constructor/setters/getters/toString())

    • FType Enum – international, national, cargo

    • Flight (attributes: <String> flightID, <String> destination, <int> capacity, <String> priorityCode, FType flightType)- – (methods: constructor/setters/getters/toString())

  • Airline (attribute: ArrayList< Flight> FlightList) –

  • methods:

    • void join Flight(Flight f) Inserts a flight into the list

    • void land Flight(Flight f) lands flight -- removes flight from the list

    • int size() returns number of aircraft in the list

    • void clear() lands all flights leaving the list empty

    • void display() displays a list of flights in the list.

    • You can use the default constructor to create Airline objects.

  1. Create a class called Program that creates an airline with several Flight objects.

  2. Create a shallow copy of a Flight object and demonstrate the impact of changes in the original object on this copy.

  3. Create a deep copy of a flight object and demonstrate the impact of changes in the original object on this copy.

Task 3

Create a new package in this project called assignment2_2.

  • Copy the Flight class and the Airline classes to this package.

  • Change the definition of the FlightList’s ArrayList in the Airline class to a ArrayDeque that implemented the Deque interface.

  • Create a new program to test the Airline. In this program you need to demonstrate how the ArrayDeque structure can be used as a queue as well as a stack.

Task 4
  • Create a new package in this project called assignment2_3.

  • Copy the Flight class and the Airline classes to this package.

  • Change the class definition of the ArrayList in the Airline class to a ProprityQueue that implements Deque interface.

  • Create a new program to test the Airline. In this program you need to demonstrate how the PriorityQueue data structure can be used with its natural sort as well as peritonising the flights in this queue by custom sort (priorityCode), implementing the Comparable and comparator interface.


For Complete solution of this sample assignment mail us on contact@codersarts.com


Also, If you are looking for any kind of coding help in programming languages, Contact us for instant solution

Comments


bottom of page