Module 2: Arrays

CMPS 260: Data Structures

Introduction

Arrays are a simple but often used data structure that allow to store multiple values in sequential order. This is very useful when you want to keep track of a collection of things, such as temperatures or grades. Elements can be added, deleted, inserted, and retrieved. Because elements in an array are stored in order, they are usually retrieved by index. Note that this makes arrays very useful for cases when random access to elements is required. It is also possible to construct multidimensional arrays which can be used to solve many problems. For loops are often used to iterate through all the elements in an array.

Module Objectives

  • Explain why arrays are useful
  • Implement creating and initializing arrays
  • Implement adding elements
  • Implement removing elements
  • Implement adding and removing elements from a specific position
  • Implement two-dimensional and multidimensional arrays
  • Look up references for JavaScript array methods

Learning Resources

  • Module 2 Readings: Chapter 2 (skip ECMAScript sections)
  • Module 2 Slides: Chapter 2

Learning Activities

  • Module 2 Assignment

For Further Study

  • Read more about arrays on Wikipedia
  • Read more about arrays on the Mozilla Developer Network

Leave A Reply

Your email address will not be published. Required fields are marked *