Subtitles section
Repeat sentence
Subtitles mode
Full screen
Previous
Next
x 1.0
Playback speed
More

Exercise - Write a Sorting Function

Video vocabulary

ask

Copy vocabulary

US / ɑ:sk /

UK / æsk /

A1
  • verb
  • To say to someone that you want something

talk

Copy vocabulary

US / tɔ:k /

UK / tɔk /

A1
  • noun
  • Style of speaking
  • Discussion between two countries
  • Giving information in front of people; lecture
  • Saying things or ideas to someone with words
  • verb
  • To make a formal speech about something
  • To say things or ideas to someone with words

for

Copy vocabulary

US / fə(r) /

UK / fɔr,fə /

A1
  • preposition
  • Used to show the purpose, or need of something

resort

Copy vocabulary

US / rɪ'zɔ:t /

UK / rɪ'zɔ:rt /

B1
  • noun
  • Act of choosing something to help with a problem
  • Vacation hotel or complex; area for holidays

algorithm

Copy vocabulary

US / 'ælɡərɪðəm /

UK / ˈælɡəˌrɪðəm /

B2
  • noun
  • A step-by-step problem-solving feature

start

Copy vocabulary

US / stɑ:t /

UK / stɑrt /

A1
  • noun
  • First time or place that a thing exists; beginning
  • First opportunity to achieve something, e.g. a job
  • Sudden action or movement because you are scared
  • other
  • Beginning of something in place or time
  • verb
  • To do, be or happen for the first time; begin
  • To turn something on

just

Copy vocabulary

US / dʒʌst /

UK / dʒʌst /

A1
  • adjecitve
  • Proper or appropriate; as is deserved
  • Doing or being what is right or fair
  • Legally correct; having enough evidence
  • adverb
  • Almost; nearly
  • Exactly at the time of
  • Exactly (the same as, like)

video

Copy vocabulary

US / 'vɪdɪəʊ /

UK / ˈvɪdiˌo /

A2
  • adjecitve
  • Of a moving film, with sound
  • noun
  • Recording capturing action with sound
  • verb
  • To make a moving film of, with sound

dot

Copy vocabulary

US / dɒt /

UK / dɑt /

B1
  • noun
  • Small round mark
  • verb
  • To place small amounts/things in various places
  • To mark something by placing a small, round spot

maybe

Copy vocabulary

US / ˈmeɪbi /

UK / ˈmebi /

A1
  • adverb
  • Possibly but not certainly; perhaps

really

Copy vocabulary

US / ˈri:əli /

UK / ˈriəˌli, ˈrili /

A1
  • adverb
  • Used to stress something that is said; definitely
  • In a true or accurate manner
  • Very

now

Copy vocabulary

US / naʊ /

UK / naʊ /

A1
  • adverb
  • At the present time or moment
  • Right away or in the next possible moment
  • Used to refer to something that just happened
  • Time between the present and a moment in the past
  • conjunction
  • Resulting from or because of something

would

Copy vocabulary

US / wʊd /

UK / wʊd /

A1
  • other
  • Used to indicate something imagined
  • Used to ask or request something politely
  • Verb used to indicate possibility, request etc.
  • Used to indicate a preference
  • Used to indicate a reaction
  • Indicates something that occurred repeatedly
  • Used to indicate willingness or ability to do

python

Copy vocabulary

US / 'paɪθən /

UK / ˈpaɪˌθɑn, -θən /

B2
  • noun
  • A large snake that crushes its victims

not

Copy vocabulary

US / nɒt /

UK / nɑt /

A1
  • adverb
  • Word indicating the negative
  • (Used to form the negative of verbs)

our

Copy vocabulary

US / 'aʊə(r) /

UK / aʊr /

A1
  • determiner
  • Belonging to us

whole

Copy vocabulary

US / həul /

UK / hol /

A1
  • adjecitve
  • Complete or full; all of
  • Being in a good condition
  • noun
  • Complete amount or sum; total

give

Copy vocabulary

US / ɡɪv /

UK / ɡɪv /

A1
  • noun
  • Degree of flexibility in something, a material
  • verb
  • To hand over or present something to someone
  • To cause someone to have or experience something

good

Copy vocabulary

US / ɡʊd /

UK / ɡʊd /

A1
  • adjecitve
  • Proper, appropriate or right
  • (Of an amount) enough; plenty
  • Excellent; high quality
  • Acting well or properly; of moral character
  • In a positive or happy emotional state
  • noun
  • Advantage or benefit

can

Copy vocabulary

US / kæn /

UK / kən,kæn /

A1
  • noun
  • A metal container for storing food
  • other
  • Able to; have the skill to; have the time to
  • verb
  • To have permission to
  • To be possible to do
  • To preserve food by sealing it in a metal container

but

Copy vocabulary

US / bət /

UK / bʌt,bət /

A1
  • conjunction
  • Used before you say something different, opposite

copy

Copy vocabulary

US / ˈkɒpi /

UK / ˈkɑ:pi /

A1
  • noun
  • A counter for items that are the same
  • Fake product pretending to be an original
  • An imitation of an original
  • A duplicate of a paper printed in a photocopier
  • Written text for printing, use in ads, etc.
  • verb
  • To make something look the same as the original
  • To act in the exact same way as someone else
  • To read and then write down what you read

want

Copy vocabulary

US / wɔnt /

UK / wɑnt, wɔnt /

A1
  • noun
  • Something you desire or wish for
  • State or condition of poverty
  • verb
  • To desire or wish for something; hope for a thing

leave

Copy vocabulary

US / li:v /

UK / liv /

A1
  • noun
  • Permission to do something
  • Vacation time; time off work
  • verb
  • To go away from; depart
  • To gift property to someone after you die
  • To allow something to continue happening
  • To let something remain unused or available
  • To let something or someone remain somewhere

call

Copy vocabulary

US / kɔ:l /

UK / kɔl /

A1
  • noun
  • A order or request for action
  • The sound an animal makes, often when in danger
  • A correct prediction, e.g. a decision in a game
  • A short visit to a place or person
  • A decision by a referee or umpire in a game
  • verb
  • To make a request or order for action
  • (Animal) to make sounds to warn of danger
  • To announce the date of an election
  • To make a judgment about something
  • To give someone or something a name
  • To guess in advance the result or outcome
  • To visit a place or person for a short time
  • To phone someone
  • To speak, announce or shout in a loud voice

hopefully

Copy vocabulary

US / ˈhəʊpfəli /

UK / ˈhopfəli /

A2
  • adverb
  • In a manner wishing something to happen

and

Copy vocabulary

US / ənd /

UK / ənd, ən,ænd /

A1
  • conjunction
  • Used to refer to two or more things
  • Plus; in addition; on top of that
  • Used to introduce an action that follows another

particular

Copy vocabulary

US / pəˈtɪkjələ(r) /

UK / pɚˈtɪkjəlɚ, pəˈtɪk- /

B2
  • adjecitve
  • One specific (one)
  • Having firm ideas about what is desirable
  • Being special or more than is typical

literally

Copy vocabulary

US / ˈlɪtərəli /

UK / ˈlɪtərəli /

B1
  • adverb
  • So as to express the exact meaning of something
  • Used to say something is true, even if unlikely

cross

Copy vocabulary

US / krɒs /

UK / krɔs, krɑs /

A2
  • adjecitve
  • Angry and upset
  • From one side of something to the other
  • noun
  • (Of animals) mixture of breeds in one animal
  • Person's name
  • verb
  • To put one thing over another e.g. arms
  • To breed one type of animal or plant with another
  • To not to agree with someone; oppose
  • To go from one side of something to the other
  • To meet at one point

something

Copy vocabulary

US / ˈsʌmθɪŋ /

UK / ˈsʌmθɪŋ /

A1
  • adverb
  • In some degree or measure
  • noun
  • a person or thing of some value or consequence
  • pronoun
  • Thing that is not yet known or named
  • Approximately

most

Copy vocabulary

US / məʊst /

UK / most /

A1
  • adverb
  • Very; extremely
  • Greatest possible degree
  • pronoun
  • Nearly all of something

think

Copy vocabulary

US / θɪŋk /

UK / θɪŋk /

A1
  • verb
  • To have an idea about something without certainty
  • To have an idea, opinion or belief about something

version

Copy vocabulary

US / ˈvə:ʃən /

UK / ˈvɚʒən, -ʃən /

A2
  • noun
  • Different way that someone interprets something
  • New or different form of something
  • An updated form of some software

print

Copy vocabulary

US / prɪnt /

UK / prɪnt /

A1
  • noun
  • Process of making books, magazines etc.
  • verb
  • To make many copies of a page, magazine or book
  • To write individual letters by hand in capitals

use

Copy vocabulary

US / ju:s /

UK / ju:s /

A1
  • noun
  • Ability to employ something
  • Need to enable it to work
  • Permission to do something with something
  • Act of spending money
  • Operation of a machine for its function
  • verb
  • To have; to eat, drink, consume etc.
  • To need to operate or work
  • To operate a machine, e.g. a computer
  • To treat a person badly
  • To do something with, for a task or purpose

actually

Copy vocabulary

US / ˈæktʃuəli /

UK / ˈæktʃuəli /

A1
  • adverb
  • Used to add new (often different) information

itself

Copy vocabulary

US / ɪtˈself /

UK / ɪtˈsɛlf /

A1
  • pronoun
  • Referring to it

intuitive

Copy vocabulary

US / ɪnˈtju:ɪtɪv /

UK / ɪnˈtuɪtɪv, -ˈtju- /

B2
  • adjecitve
  • Able to understand by feeling rather than fact

write

Copy vocabulary

US / raɪt /

UK / raɪt /

A1
  • verb
  • To compose letters and words on paper or a screen
  • To invent or create a computer program
  • To create a song or piece of music

after

Copy vocabulary

US / 'ɑ:ftə(r) /

UK / ˈæftɚ /

A1
  • adverb
  • Later than another time, or behind something
  • conjunction
  • Following something before
  • preposition
  • When an event happened or time has passed

should

Copy vocabulary

US / ʃʊd /

UK / ʃʊd /

A1
  • other
  • Used to indicate what is proper or reasonable

point

Copy vocabulary

US / pɔɪnt /

UK / pɔɪnt /

A1
  • noun
  • An item to be discussed
  • Small spot or dot
  • Fact or detail
  • Feature of something
  • The size of the text on a page or screen
  • A certain time or stage in a process
  • Certain position in time or space
  • Idea or fact you try to convince people about
  • Measurement of scores in a game, sport
  • Sharp end of something, e.g. a pen or pin
  • verb
  • To face a certain direction, e.g. north
  • To indicate something with your finger to others

many

Copy vocabulary

US / 'menɪ /

UK / ˈmɛni /

A1
  • determiner
  • Used to refer a large number of things

will

Copy vocabulary

US / wɪl /

UK / wɪl /

A1
  • noun
  • Desire or choice of someone
  • Document saying who gets your money when you die
  • Strong desire to do something; determination
  • Desire to do something; strong wish to do
  • other
  • Used with verbs to express the future
  • verb
  • To leave property to someone after your death
  • To use mental effort to make something happen
  • Am (is, are) likely to do
  • To influence someone to do something
  • To make something happen by strongly wanting it

already

Copy vocabulary

US / ɔ:lˈredi /

UK / ɔlˈrɛdi /

A1
  • adverb
  • Having happened or been done before this time

try

Copy vocabulary

US / traɪ /

UK / traɪ /

A1
  • noun
  • Act of putting the ball over the rugby goal line
  • verb
  • To make an effort, to attempt to do something
  • To examine someone or something in a court of law
  • To test to see if it is good or you like it
  • To make a person go through hardship; test
  • To examine something to see if it works

wait

Copy vocabulary

US / weɪt /

UK / wet /

A1
  • verb
  • To delay or not do something until later
  • To spend time until an expected thing happens
  • To remain in a place until a thing happens

sort

Copy vocabulary

US / sɔ:t /

UK / sɔrt /

A1
  • noun
  • Group or class of similar things or people
  • verb
  • To organize things by putting them into groups
  • To deal with things in an organized way

fast

Copy vocabulary

US / fɑ:st /

UK / fæst /

A1
  • adjecitve
  • In a way that is difficult to move or change
  • Moving or able to move quickly
  • Showing time that is later than the actual time
  • adverb
  • With a great deal of speed
  • noun
  • Period of time when a person chooses not to eat
  • verb
  • To refuse food for a long time

arbitrary

Copy vocabulary

US / ˈɑ:bitrəri /

UK / ˈɑrbɪˌtrɛri /

B1
  • adjecitve
  • (Of decisions) unsupported; without any evidence

work

Copy vocabulary

US / wɜ:k /

UK / wɚk /

A1
  • adjecitve
  • Activity completed in order to make money
  • noun
  • The product of some artistic or literary endeavor
  • Everything created by an author, artist, musician
  • Activity you do in order to make money
  • Place of employment
  • Final product or result of a some labor or effort
  • verb
  • To bring into a specific state of success
  • To be functioning properly, e.g. a car
  • To do your job in your company or workplace
  • To make an effort to do something
  • To operate a machine or device

way

Copy vocabulary

US / weɪ /

UK / we /

A1
  • adverb
  • Used to emphasize the amount of something
  • noun
  • Particular aspect of something being thought about
  • One of various choices that could be made
  • Particular existing condition or state
  • (Often long) distance or length of time
  • How something is done
  • Route to go to a place
  • Small street
  • Usual behavior, emotions or habits of someone

very

Copy vocabulary

US / 'verɪ /

UK / ˈvɛri /

A1
  • adjecitve
  • Concerning a large degree or amount
  • adverb
  • A lot; much; many
  • Used to stress or emphasize a noun

look

Copy vocabulary

US / lʊk /

UK / lʊk /

A1
  • noun
  • Person's beauty or physical attractiveness
  • Particular style of dress, clothes, or appearance
  • The way someone, something appears to be
  • Act of searching for or examining something
  • verb
  • To appear to be; seem

return

Copy vocabulary

US / rɪ'tɜ:n /

UK / rɪ'tɜ:rn /

A1
  • adjecitve
  • Do again; repeated
  • noun
  • Faulty or unwanted product sent back to a company
  • Enter key; the main key on the computer keyboard
  • Profit made as a result of a business activity
  • Process of going back to a previous way or state
  • verb
  • To hit something back to the other player or team
  • To come back after being away from somewhere
  • To repay someone's actions, kindness etc.
  • To put, bring, take, give, or send something back
  • To occur again

list

Copy vocabulary

US / lɪst /

UK / lɪst /

A1
  • noun
  • Lean of a boat to one side
  • Series of written names, words or numbers
  • verb
  • To lean to one side, like a boat or ship
  • To present for sale for a specific price
  • To write a series of names, words, or numbers

about

Copy vocabulary

US / ə'baʊt /

UK / əˈbaʊt /

A1
  • adverb
  • To be ready to; going to
  • Nearly; approximately; roughly
  • Near; next to; close to
  • In every direction; in the area of
  • preposition
  • Concerning or of (a topic)

what

Copy vocabulary

US / wɒt /

UK / hwɑt, hwʌt, wɔt, wʌt,hwət, wət /

A1
  • pronoun
  • Thing or things that; the same kind as
  • Used to emphasize something you are about to say
  • adjecitve
  • Used to refer to a particular amount, or number
  • Used to place emphasis on a particular quality
  • adverb
  • To a certain degree
  • determiner
  • Question words used for asking for information
  • exclamation
  • Used to express excitement, shock, or surprise
  • Used to ask people to repeat something they said

get

Copy vocabulary

US / ɡet /

UK / ɡɛt /

A1
  • verb
  • To become affected by illness or disease
  • To begin to feel or understand an emotion or idea
  • To send or bring someone or something home, etc.
  • To go somewhere to obtain something
  • To (cause to) do a particular thing
  • To obtain, receive or be given something
  • To currently have
  • To prepare for use
  • To understand something being said or read

that

Copy vocabulary

US / ðæt /

UK / ðæt, ðət /

A1
  • adjecitve
  • The person or thing being talked about
  • Used to identify something both the speakers know
  • adverb
  • Used to reinforce adjectives and adverbs
  • To such a degree
  • conjunction
  • Used to connect a noun clause
  • Used to introduce an adverbial clause
  • Used to introduce a noun clause
  • determiner
  • Used as a noun to refer to something
  • pronoun
  • Referring an object far away
  • Used to refer to the relative pronoun ‘which’

place

Copy vocabulary

US / pleɪs /

UK / ples /

A1
  • noun
  • Particular location, area or region
  • verb
  • To put someone in a particular type of situation
  • To put something in a certain location or position

own

Copy vocabulary

US / əʊn /

UK / on /

A1
  • adjecitve
  • Belong to oneself
  • determiner
  • Yours, his, hers, etc.; not belonging to another
  • pronoun
  • (Something) belong to myself
  • verb
  • To have something as your property

example

Copy vocabulary

US / ɪgˈzɑ:mpl /

UK / ɪɡˈzæmpəl /

A1
  • noun
  • Thing, person which represents a category

like

Copy vocabulary

US / laɪk /

UK / laɪk /

A1
  • adjecitve
  • Being equal in status or kind to something else
  • Similar; the same
  • adverb
  • For example
  • preposition
  • Used as a filler; used to ad emphasis
  • In a way similar to the way something is done
  • Such as; for example
  • verb
  • To want to
  • To find something pleasing; to prefer something

then

Copy vocabulary

US / ðen /

UK / ðɛn /

A1
  • adverb
  • A time that is not now
  • Following another thing in time or arrangement
  • Following on reasonably from what was just stated
  • At that time, not now

right

Copy vocabulary

US / raɪt /

UK / raɪt /

A1
  • adjecitve
  • Correct or true
  • The south side of you looking at the rising sun
  • adverb
  • Exactly in a place or time
  • Being appropriate for a particular event
  • In a straight or direct manner
  • noun
  • Something you are legally or morally allowed to do
  • Ideal of what is just and good
  • Political view based on conservatism
  • verb
  • To fix something previously wrong or unjust
  • To make upright, as a boat that has turned over

sal

Copy vocabulary

US / sæl /

UK / sæl /

A1
  • noun
  • A North Indian tree that yields hard, durable timber and dammar resin.

let

Copy vocabulary

US / let /

UK / lɛt /

A1
  • verb
  • To allow someone to do something
  • Introducing a suggestion to do something together
  • To rent a house, etc. to others

outline

Copy vocabulary

US / ˈaʊtlaɪn /

UK / ˈaʊtˌlaɪn /

A2
  • noun
  • Line around the outer edge of something
  • A summary of the important points of a plan, etc.
  • verb
  • To draw around the outer edges of something
  • To summarize the important points of a plan, etc.

you

Copy vocabulary

US / jʊ /

UK / ju /

A1
  • pronoun
  • Person someone is speaking or writing to
  • Person or people in general

might

Copy vocabulary

US / maɪt /

UK / maɪt /

A1
  • other
  • Used to politely request an action
  • Used to express that something could happen
  • Power, strength, force or influence

the

Copy vocabulary

US / ðə /

UK / ðə /

A1
  • article
  • Used to refer to something already mentioned
  • Used to show there is only one of something
  • determiner
  • Used to describe all of a family

how

Copy vocabulary

US / haʊ /

UK / haʊ /

A1
  • adjecitve
  • To what degree? in what amount?
  • adverb
  • (Used to explain the way to do something)
  • exclamation
  • For what purpose or reason?
  • (Used to ask someone or something's condition)

program

Copy vocabulary

US / 'prəʊɡræm /

UK / ˈproˌɡræm, -ɡrəm /

A1
  • noun
  • Small book of events in a play, concert or movie
  • A plan or schedule of events
  • Series of classes at a college or university
  • A computer application
  • TV show
  • verb
  • To make someone act or think in a certain way
  • To write computer code for a piece of software

this

Copy vocabulary

US / ðɪs /

UK / ðɪs /

A1
  • adjecitve
  • Used to indicate something already been discussed
  • Used to indicate something happening around now
  • adverb
  • An indication by a physical motion or gesture
  • A specific amount of
  • determiner
  • Person, thing, or idea near you
  • pronoun
  • Person, thing that has already been discussed

deep

Copy vocabulary

US / di:p /

UK / dip /

A1
  • adjecitve
  • Complex and important
  • Extreme or intense
  • Going far down from the surface
  • Low in pitch, as a sound
  • adverb
  • At a certain distance beneath the surface

efficient

Copy vocabulary

US / ɪˈfɪʃnt /

UK / ɪˈfɪʃənt /

A2
  • adjecitve
  • Able to produce results without waste

kind

Copy vocabulary

US / kaɪnd /

UK / kaɪnd /

A1
  • adjecitve
  • In a caring and helpful manner
  • friendly and considerate
  • noun
  • One type of thing

into

Copy vocabulary

US / 'ɪntə /

UK / ˈɪntu /

A1
  • preposition
  • Moving or going inside something
  • In the same direction as; in the direction of
  • So as to become; taking the state of

attempt

Copy vocabulary

US / ə'tempt /

UK / əˈtɛmpt /

A2
  • noun
  • Effort made to try to do or accomplish something
  • verb
  • To try to do something challenging or difficult

make

Copy vocabulary

US / meɪk /

UK / mek /

A1
  • noun
  • Product made by a particular company; brand
  • verb
  • To arrange or prepare something e.g. dinner
  • To get to (a place) on time
  • To gain the status of (teacher, lawyer, etc.)
  • To create something by putting things together
  • To earn a certain amount of money at a job
  • To cause or force a person to do something
  • To cause something to happen or be formed

have

Copy vocabulary

US / həv /

UK / hæv /

A1
  • verb
  • To drink, smoke, eat or use something
  • To experience the effects of something
  • To organize an event, or join in an activity
  • To own, possess, or hold something
  • To cause to happen or produce a particular effect

process

Copy vocabulary

US / prə'ses /

UK / ˈprɑsˌɛs, ˈproˌsɛs /

A2
  • noun
  • Dealing with official forms in the way required
  • Set of changes that occur slowly and naturally
  • verb
  • To organize and use data in a computer
  • To deal with official forms in the way required
  • To prepare by treating something in a certain way
  • To adopt a set of actions that produce a result
  • To convert by putting something through a machine

see

Copy vocabulary

US / si: /

UK / si /

A1
  • verb
  • To go on a date with someone
  • To predict whether something is, or will be true
  • To understand what someone says
  • To use your eyes to look at something
  • To visit a place often for sightseeing or pleasure
  • To visit or meet with someone
  • To find out by waiting or looking
  • To watch (a game, movie or TV show)

next

Copy vocabulary

US / nekst /

UK / nɛkst /

A1
  • adverb
  • The one that follows another in time or order
  • At a time or place directly after the present one
  • noun
  • The one that follows after
  • adjecitve
  • Immediately after the previous one
  • First occurrence after the present one
  • Subtitles section
  • What I want you to attempt to do is given an arbitrary list-- I made a particular example of an arbitrary list right here-- write a function that sorts that arbitrary list.
  • So maybe you call your function My Sort, you can call it whatever.
  • What I want is after I call My Sort on a list, the list itself gets resorted.
  • So I don't want My Sort to return a copy of the list.
  • I want, after I call My Sort on a, if I then refer to a, if let's say I do print a, then that will literally return a sorted version of a.
  • Or I should say it will return a, but now a itself is sorted, or the list that a is referring to is now sorted.
  • So it would now look like this. a would now look like 1, 2, 3, 5, 7, 8.
  • And you might say, wait Sal, that's very easy, there is already a sort function in Python.
  • You literally can call a dot sort, and that will sort a in place just the way I've asked you to do.
  • And when I say in place, I'm saying it's actually going to work on the actual list.
  • It's not going to create a copy of the list that is sorted.
  • It's actually going to work in place on that actual list.
  • And a sort does this, but I don't want you to use that.
  • So let's cross this off.
  • The whole point of this is to learn just to kind of try our best to write our own sorting function.
  • What you're going to see, and hopefully appreciate as we go deeper and deeper into this, is it there's many, many, many, many ways to sort things.
  • And sorting is really a good way to think about how good a function, and we'll start talking about algorithms, how good a process is, or how fast a process is, or how efficient a process is, at doing something.
  • So I'll leave you there.
  • Try to sort this.
  • In the next video, I'll try to outline an algorithm, which is really just a process for doing something.
  • I'll outline an algorithm that's kind of an intuitive way to sort things.
  • It's not the most efficient way to sort things.
  • And then after that, I'll try my best try at actually writing that algorithm in a Python program.