ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos


Playlist AP® Computer Science: Standard Data Structures 13 videos

0
AP Computer Science 1.1 Standard Data Structures
194 Views

AP Computer Science 1.1 Standard Data Structures. Which of the following method calls will result in an error?

1
AP Computer Science 1.2 Standard Data Structures
194 Views

APCS: Standard Data Structures Drill 1, Problem 2. Which of the following methods are not appropriate for reuse in other programs?

2
AP Computer Science 2.1 Standard Data Structures
176 Views

AP Computer Science 2.1 Standard Data Structures. Which of the following is a correct sequential implementation?

See All

AP Computer Science 2.1 Standard Data Structures 176 Views


Share It!


Description:

AP Computer Science 2.1 Standard Data Structures. Which of the following is a correct sequential implementation?

Language:
English Language

Transcript

00:00

Thank you We sneak And here's your shmoop du jour

00:06

brought to you by used copies of tech war available

00:09

at thrift stores and yard sales everywhere All right which

00:13

of the following is a correct sequential implementation We are

00:18

okay And here the potential answer is brought to you

00:20

by the roman army Okay go ah raise well imagine

00:26

where we'd be without him They're just a bunch of

00:28

loose variables everywhere without anything binding them together Like those

00:31

subscription cards that followed a magazine items in an array

00:35

are a bit like books on a bookshelf and this

00:37

question is asking us how to go about rearranging things

00:41

let's say we've got a date tonight and we don't

00:43

want it to look like we have been reading tech

00:45

war lately Valid concerns there are plenty of ways to

00:48

rearrange a shell thinks the job is a ray list

00:51

class this bad boy comes feature packed with methods like

00:54

get set at removed clear and a handful of other

00:58

obscure friends In this case we're worried it looks like

01:02

we've been reading william shatner's tek war because it's first

01:05

on the shelf not quite the best first impression for

01:08

a date so we'll stick it behind some classics Couple

01:11

ways to do it If we wanted to take tech

01:13

or out of position zero input in position to well

01:15

we could use a remove call on it which will

01:18

move everything else upward a slot and then add which

01:21

will place it at the end again Or we could

01:23

use get in set calls to accomplish much the same

01:26

thing Get as you might expect gets the value of

01:29

a given position in an array and set sets the

01:32

value of a position Tau whatever you specify given question

01:36

is asking us to do almost exactly the same kind

01:38

of operation One two and three are out of order

01:41

in the array for the first of three options Looks

01:44

okay First plant we get the value from slot to

01:48

toss it in a variable called temp and sets lot

01:51

two to the content of plot one and said not

01:53

one of the content of him Well that's Good but

01:56

hold it Pampas declared as an end that'll never fly

02:00

Nice try Option one almost got it Option two gets

02:03

the value from position one and uses an ad call

02:06

toe Put it up The end then removes the value

02:08

of position One option to work for an option Three

02:12

it's just one line but a little tricky looking it's

02:14

A set call for position one and the part of

02:17

the parameter that described what to put in position One

02:20

is another set call and that set called gets position

02:24

One option Three does it all in one line one

02:27

motion are both two and three work so he is

02:30

going to be our answer We may have won the 00:02:32.06 --> [endTime] tech battle but the war is just beginning

Related Videos

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 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 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?