ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos


Computer Science Videos 112 videos

Computer Science: Setting Up Your Environment
19 Views

Just as you move your furniture into a new house before spending the night, you’ve got to spend a little time setting up your environment when yo...

Computer Science: Doubles and Ints
17 Views

Doubles and ints. At first glance, it may look like this video will be about baseball and football statistics. But they're actually computer scienc...

AP Computer Science 1.1 Classes and Objects
468 Views

AP Computer Science: Classes and Objects Drill 1, Problem 1. Which of the following is a correct {/* Implementation */} for the isInsect method?

See All

AP Computer Science 3.4 Standard Data Structures 5 Views


Share It!


Description:

AP Computer Science 3.4 Standard Data Structures. Which best describes the functionality of the remove method for an ArrayList?

Language:
English Language

Transcript

00:04

And here's your shmoop du jour brought to you by an iterating

00:06

ArrayList it'll throw you for a loop all right which best describes the [People riding rollercoaster]

00:11

functionality of the remove method for an ArrayList at your potential answers

00:16

lot of text......... all right arrays that array

00:24

lists are similar but standard arrays have some limitations the biggest tubing [Man blowing whistle with stop sign]

00:28

that arrays have a fixed size and that elements can't be added or removed this

00:33

once you build an array you're pretty much stuck with the original size you [Man moving array side to side]

00:37

specify yeah you can find ways to sidestep it you can write methods to

00:42

build a new array consisting of an old arrays contents plus or minus whatever

00:46

elements you want to add or remove but it's a little janky though and at that [Computer burning]

00:52

point you're just recreating a lesser version of an ArrayList so you may as [Man throwing work on his desk]

00:56

well ride dragons look at you so ArrayList removed metal works much like [Man riding a dragon]

01:01

you'd expect let's say we have four elements in an array list called the

01:05

scene bad movies jingle all the way police academy first kid and house cast

01:11

our police academy isn't a sin bad movie so we'll remove it from the arraylist [Police men talking on the street]

01:15

and there it goes with trailing thing's sliding upward in line but now

01:20

let's look at the potential answers would fit option a well it removes the

01:24

element at the input index and moves all elements right this way from the front

01:30

fill the spot and adjust the size wait whose elements to the right mmm nope [Man looking confused]

01:35

that's not what happens houseguests moved left trailing elements will always

01:40

move left why because indexing always begin to add zero option B also says

01:46

things move the right which isn't going to work option C well it removes the

01:50

element at the input index 0 so far so good and we move all the elements left

01:54

from in to fill the spot and yep adjust the size right and returns the remove

01:59

element yeah all right the remove method does indeed [Remove method lands in middle of road]

02:03

returned the element you've just removed in case you needed it for something so C

02:08

looks like our answer but let's check the other B is the same answer C but

02:11

without returning your moved element so no option E removes the element from

02:15

the list returns the element and so on but doesn't mention anything about

02:18

moving the remaining elements all rights are there now that wasn't Sinbad or so

02:24

bad was it [Man singing on stage]

Related Videos

AP Computer Science 1.2 GridWorld Case Study and APIs
493 Views

AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?

AP Computer Science 1.4 Standard Algorithms
200 Views

AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?

AP Computer Science 2.3 Classes and Objects
191 Views

AP Computer Science 2.3 Classes and Objects. Which of the following is correct implementation of the Country class?

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism
204 Views

AP Computer Science 3.4 Inheritance, Abstraction, and Polymorphism. Which of the following will satisfy the conditional if statement for boo, str,...

AP Computer Science 4.2 Standard Algorithms
191 Views

AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?