CA213 Data Structures & Algorithms Lab Exercise, Week 5

38 downloads 739 Views 12KB Size Report
CA213 Data Structures & Algorithms. Lab Exercise, Week 5. Monica Ward. 1. Introduction. These lab exercises are to give you a chance to practise some of the  ...
CA213 Data Structures & Algorithms Lab Exercise, Week 5 Monica Ward 1.

Introduction

These lab exercises are to give you a chance to practise some of the concepts we have covered in the lectures. You are expected to first think about the problems, and when you understand what needs to be done, design a solution. Then you can implement the solutions should you feel you need to practise your Java. Sometimes implementations or solutions to these problems can be found on the web, but going straight to those will ultimately benefit you little. When you have a working solution of your own, which you have verified does the required task, then you may benefit from comparing your code to those published. It is unlikely you’ll complete the tasks in a single 2 hour lab session, so be prepared to spend some extra time on them. If you don’t get time to write the code, make sure you’re confident that any pseudocode you produce will work if implemented. In summary, understanding the data structures, algorithms and OO design principles are key. Implementations follow easily once the understanding of the underlying principles has been achieved. 2. Container Sort Implement an algorithm that orders a series of containers from the lightest to the heaviest. 3. Power Algorithm Implement different power algorithms (from the notes) and verify their computational complexity. Experiment with Java’s time related methods to compare your results. 4.

Mergesort

Design and implement the mergesort algorithm and verify its expected computational complexity. 5.

Universal Date Sorter

Use inheritance when you design and implement a program that will sort dates. The dates can be any common format: DDMMYYYY (European), MMDDYYYY (North American), YYYYMMDD (East Asian). 6.

Linked lists

Implement and test any missing code from the linked list lecture notes.