asg4 - COP 3530 Assignment 4 Due Date: Monday, 21st Sep...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COP 3530 Assignment 4 Due Date: Monday, 21st Sep 2009 Have your name and UF ID on what you submit and only soft copies are REQUIRED. You need to submit ChainMerge.java file for problem 1(a) and a hw4.txt file that contains your arguments for the rest of the homework problems. 1. Extend the class Chain to include a new implemented method mergeChain(Chain a,Chain b) that merges two sorted Chains into one. For example, suppose the original Chains are a = [3, 5, 6, 7] , b =[1, 2, 3, 4, 8] . a and b are sorted from lowest to highest. When mergeChain(a,b) is called, it will return [1,2,3,3,4,5,6,7,8], and both a and b will be equal to [] at the end. The template for the Chain class is given below: package dataStructures; public class ChainMerge extends Chain{ // your member variable goes here public void mergeChain(Chain a,Chain b){ // your code goes here //Call the function mergeChain(a,b) w ithin itself, so it becomes a recursive implementation } public static void main(String[] args) { Chain a = new Chain(); Chain b = new Chain(); ChainMerge c=new ChainMerge(); for(int i=0 ; i < 60 ; i++) { b.add(i,i); } for(int i=0 ; i < 30 ; i++)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

asg4 - COP 3530 Assignment 4 Due Date: Monday, 21st Sep...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online