AP CS 7: Arrays

Premium Lesson

This is a premium course. To view and assign premium course, you must upgrade your account

Upgrade Now

Course Items

Arrays Introduction

Arrays allow programmers to store multiple values in a single variable

Introducing Arrays

Creating an Array

Create an array and populate it with values

Learn to create an array and how to initialize arrays

Traversing Arrays

Traversing an array means to visit each element in the array sequentially. We may modify these values or simply read them depending on what we are trying to accomplish.

Traversing an array involves visiting each element one at a time

Array Length

The length of an array returns the number of elements in the array. We can use this to tell our for loops how many times to repeat

You should from now on, always use array.length when traversing an array

Array Method Exercises

Here begins our segment on practicing arrays through building array helper methods

Here we begin practicing arrays by doing some exercises

Print Array

Make a nice array print method

It will be useful to make a method that prints every element of our array

Summing an Array

Create a sum method that returns the result of adding together every value of an integer array

Summing an Array means adding each element together and returning the result

Averaging an Array

Use the sum method you just created to calculate the average value of an array of integers

We can use our sum method to create an averaging method

Array Contains Element

Write a method that checks if a character array contains a given input character

Check if an array contains an element and returning the index number of that element.

Array Sorting

Here we will start to look at sorting algorithms for arrays

Array sorting is very important in computer applications. In this lesson we will make a swap method to make sorting easier

Bubble Sort

Bubble sort works great for small lists of data

Learn the bubble sort algorithm

Insertion Sort

A sorting algorithm that inserts each element of an array into a new array in its proper position

Learn the insertion sort algorithm

AP CS 7: Arrays Info

Track

AP Computer Science

Account

MVCode

Rank

Hacker

Created By

jamie

AP CS 7: Arrays Prereqs