ShmoopTube
Where Monty Python meets your 10th grade teacher.
Search Thousands of Shmoop Videos
Standard Algorithms Videos 19 videos
AP Computer Science 1.4 Standard Algorithms. How many times will mystery be called for mystery(n) for n > 1?
AP Computer Science 4.2 Standard Algorithms. What kind of algorithm is the following?
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 1.1 Standard Algorithms 29 Views
Share It!
Description:
AP Computer Science 1.1 Standard Algorithms. What is the output of Recurse(3)?
Transcript
- 00:03
And here's your shmoop du jour now it's delicious nougat [Selection of nougat filling]
- 00:06
filling all right the program is in build implement selection sort this
- 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
Full Transcript
- 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 deeds in the bottom of this will 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 PC monitor]
- 01:03
binary all information is ultimately stored and transmitted in binary texts [Binary appears on monitor]
- 01:09
to read image you see videos you watch all of it deep down just a flood of one [Man watching videos on computer]
- 01:14
zero the smallest amount of information is a bit a single one or a zero drop
- 01:21
eight of these bits together and you've got a byte assign a different value to
- 01:25
each bit in powers that do and you can use those eight bits to represent any
- 01:30
value 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 [Bytes combined together]
- 01:39
pictures of Grandma videos of sneezing pandas unit alright that's beside the [Person looking through tablet for pictures of grandma]
- 01:45
point. ASCII device is a standard way to
- 01:47
transmit by different values and have them mean the same thing to the computer
- 01:51
on the other side the agreed-upon solution starts with a handful of [Pool of binary numbers]
- 01:54
control codes many of which aren't used in court and then divides into numbers
- 01:59
capital letters and lowercase letters and there's a tional punctuation
- 02:02
sprinkled throughout so if anyone were to transmit this byte which holds the [Byte appears]
- 02:07
decimal value 74 it should represent a capital J to practically any computer
- 02:13
or device that could receive it well no impossible this is all relevant to the [Man sounds a horn at girl in classroom]
- 02:17
question it says that we'll be sorting the candies by ASCII values from highest
- 02:22
to lowest and how we're sorting is another thing selection sort is probably
- 02:27
the simplest search algorithm to implement it's not great for big jobs [Mechanic fixing a car engine]
- 02:31
but for a handful of candy bars it'll be just fine all it really does is travel
- 02:35
down a list finding the lowest value or in our case we'll be looking for the [People wearing numbered shirts on a field]
- 02:40
highest value and moving that to the front of the list by swapping it with
- 02:44
whatever was already there then it goes again starting from the next position [People swapping positions]
- 02:48
and again and so on until the entire array has been sorted okay that said
- 02:53
we'll be traversing this list of candy looking for the highest value ASCII [Selection of candy bars appears]
- 02:56
character and according to the Chart it'll probably be a lowercase letter
- 03:00
while on the first pass M&M is the highest value ASCII character and we'll
- 03:05
get moved to the head of the line switching places with KitKat next back [Chocolate bars switch position]
- 03:09
the highest value would be that capital T belonging to Twix which will switch
- 03:14
with stickers and on our third path skittles will be higher value than the
- 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 ASCII chart then an uppercase int alright well after three passes our list [ASCII chart appears]
- 03:34
now looks suspiciously like option B which would be correct and now if anyone
- 03:38
wants to ask you a question you can say hey I know that pun and it stinks... [Boy asking question in class]
Related Videos
AP Computer Science 1.2 GridWorld Case Study and APIs. What is the direction of the actor?
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. Which of the following is correct implementation of the Country class?
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. What kind of algorithm is the following?