ShmoopTube

Where Monty Python meets your 10th grade teacher.

Search Thousands of Shmoop Videos


Standard Algorithms Videos 19 videos

AP Computer Science 2.1 Standard Algorithms
432 Views

APCS: Standard Algorithms Drill 2, Problem 1. How much slower is InefficientSum than EfficientSum in the best case for an array of n elements?

AP Computer Science 2.5 Standard Algorithms
176 Views

In this computer science drill question, figure out which implementation will copy one array over to another.

AP Computer Science 3.3 Standard Algorithms
175 Views

AP Computer Science: Standard Algorithms Drill 3, Problem 3. What should go in "expression 1" to satisfy the conditional statement?

See All

AP Computer Science 3.5 Standard Algorithms 1 Views


Share It!


Description:

AP Computer Science 3.5 Standard Algorithms. What does the list look like after three passes?

Language:
English Language

Transcript

00:04

and here's your shmoop du jour now it's delicious nougat

00:06

filling all right the program is in build implement selection sort this [Question appears]

00:11

program like many other sorting programs will sort things are this particular

00:16

program is sorting candy which seems like a fun job in the grand scheme of

00:20

sort ology the program sorts by the ASCII value of the first letter of the

00:26

brand name from highest to lowest candy names are case sensitive so what

00:31

does the list look like after three passes

00:34

all right near your potential answers

00:40

okay looks like we're being asked to take the first three passes in

00:44

the process of organizing the names of these candies in reverse order according [Candy bars appear]

00:49

to the ASCII standard our DS in the bottom of this we'll need a quick

00:52

refresher on the selection sort and we'll need to know a little bit about

00:56

ASCII and how to determine what should come first

00:59

well actually let's rewind it even a little more for a moment and go back to [Video rewinds on screen]

01:03

binary all information is ultimately stored and transmitted in binary text

01:09

you read image you see videos you watch all of it deep down judge the flood of [Man watching videos on computer]

01:14

1-0 the smallest amount of information is a bit a single one or a zero strap

01:21

eight of these bits together and you've got a bike assign a different value to

01:25

each bit in powers to do and you can use those eight bits to represent any value

01:30

from zero to 255 pretty clever all right and of course combined way

01:36

more bytes together and you can represent much more complex data

01:39

pictures of Grandma videos of sneezing pandas units [Person looking at picture of Grandma]

01:43

all right that's beside the point ASCII device was a standard way to

01:47

transmit by different values and have them mean the same thing through the [ASCII device linked to computers]

01:50

computer on the other side the agreed-upon solution starts with a

01:54

handful of control codes many of which aren't used in quarters and then divides [Control codes jump into pool]

01:58

into numbers capital letters and lowercase letters and there's a tional

02:02

punctuation cycle throughout so if anyone were to transmit this byte which

02:06

holds the decimal value 74 it should represent

02:11

a capital J practically any computer or device that could receive it well no impossible

02:16

this is all relevant to the question it says that we'll be sorting the candies [Boy sounds a horn to girl in classroom]

02:20

by ASCII values from highest to lowest and how we're sorting is another thing

02:26

selection sort is probably the simplest search algorithm to implement it's not

02:30

great for big job but for a handful of candy bars it'll be just fine [Man working on a car engine]

02:34

all it really does is travel down a list finding the lowest value or in our case [People with numbered t-shirts appear on field]

02:38

we'll be looking for the highest value and moving that to the front of the list

02:43

by swapping it with whatever was already there then it goes again starting from [People re-arrange order]

02:47

the next position and again and so on until the entire array has been sorted

02:51

okay that said we'll be traversing this list of candy looking for the highest

02:56

value ASCII character and according to the shark it'll probably be a lowercase

03:00

letter while on the first pass M&M is the highest value ASCII character and

03:05

we'll get moved to the head of the line switching places with KitKat next back [M&M switches with KitKat bar]

03:09

the highest value would be that capital T belonging to Twix which will switch

03:14

with Snickers and on our third path skittles will be higher value than the [Skittles value shown on chart]

03:19

others including Snickers ster they both begin with an uppercase s but that means

03:24

the next character would decide it and that lowercase K would be higher value

03:29

on the after chart then an uppercase int alright well after three passes our list

03:34

now looks suspiciously like option B which would be correct [Option B circled]

03:37

and now if anyone wants to ask you a question you can say hey I know that pun

03:42

and it stinks [Girl giving thumbs down at boys joke]

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?