Slices

From CSE231 Wiki
Revision as of 17:56, 27 June 2017 by Benjaminchoi (talk | contribs) (Created page with "=Background= As the name suggests, we will create a class to represent a <code>Slice</code> of data and a list of <code>Slice</code> called <code>Slices</code> which divides...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Background

As the name suggests, we will create a class to represent a Slice of data and a list of Slice called Slices which divides the data into a specified number of Slice given an array of data.

Where to Start

Navigate to the slice directory and look under slice.studio. You must implement Slices using the implementation of Slice given to you under the slice.core directory.

createNSlices

To create this slice, you will start at the beginning of the data array and keep creating new slices until you have numSlices which more or less evenly span the range. Remember that the sliceId should start at the zero index and the length of the list should be equal to the number of slices. Also remember that if the range is not divisible by numSlices, you must account for this and make a slightly larger slice at the end of the range.