Programming BASIC and Sorting - Computerphile

Computerphile
4 Aug 201313:55

Summary

TLDRThis script explores the auditory and visual representation of sorting algorithms, focusing on the BBC Micro's A5000 computer. It discusses the use of BBC Basic to create a program that visually and audibly sorts elements, playing sounds to represent the values during the sorting process. The script compares various sorting algorithms like Bubble Sort, Quick Sort, and Heap Sort, demonstrating their efficiency and differences. It also touches on the use of libraries and the challenges of implementing certain algorithms due to outdated dependencies.

Takeaways

  • 🔊 The script describes a sorting algorithm visualization where elements are swapped with accompanying sounds to represent their values.
  • 📈 It was suggested to sort 100 elements side by side to visually compare different sorting algorithms.
  • 💻 The BBC Micro and its descendant, the A5000, are discussed as early computers that introduced people to programming with BASIC.
  • 🎵 The Acorn A5000 computer is highlighted for its built-in BBC BASIC interpreter and its ability to quickly boot into a GUI with an icon bar and hard drive.
  • 👀 A program written in C++ for visualizing sorting algorithms was mentioned, which inspired the speaker to create their own implementation.
  • 🛠️ The speaker discusses the use of libraries in programming, which are collections of code that perform specific tasks, often used for reliability.
  • 📚 Reference is made to a book titled 'Games for your BBC Micro' which provided insights on how to use sound in programming.
  • 🔢 A demonstration of the 'Doctor Audio' game from the book is given, explaining how sound is used to provide feedback based on the proximity of a guess to a number.
  • 📉 The script covers various sorting algorithms, including Bubble Sort, Quick Sort, Selection Sort, and Heapsort, noting their complexities and performance.
  • ⏱️ Performance metrics such as time taken, number of comparisons, and swaps are highlighted as important factors in evaluating sorting algorithms.
  • 📊 A visual comparison of sorting algorithms is conducted with 100 elements to demonstrate the differences in speed and efficiency.

Q & A

  • What is the purpose of the sound played when swapping elements in a sorting algorithm?

    -The sound is played to provide an auditory cue that a swap has occurred, with the pitch of the sound indicating the values of the elements being swapped.

  • Why was the BBC Micro commissioned and by whom?

    -The BBC Micro was commissioned by the BBC to introduce people to computers and programming as part of their educational project.

  • What is the significance of the ARM chip in the Acorn A5000?

    -The ARM chip is significant as it was a feature not present in the original BBC Micro, indicating an advancement in technology and performance.

  • What is the difference between the BBC Micro and the Acorn A5000 in terms of boot-up time?

    -The Acorn A5000 boots up more quickly than the BBC Micro because its operating system is stored in ROM, allowing for a faster start-up process.

  • What is the role of the 'Icon Bar' in the Acorn A5000's GUI?

    -The Icon Bar in the Acorn A5000's GUI provides quick access to various applications and system functions, similar to taskbars in modern operating systems.

  • How does the 'Doctor Audio' game provide feedback on the player's guess?

    -In 'Doctor Audio', feedback is given as a tone, with the pitch of the note varying according to how close the player's guess is to the computer's number.

  • What is the role of the 'rem' command in BBC Basic?

    -The 'rem' command in BBC Basic is used to insert comments or reminders in the code, which are ignored during execution.

  • What is the time complexity of Bubble Sort and why is it considered inefficient for large datasets?

    -Bubble Sort has a time complexity of O(n^2), making it inefficient for large datasets because the number of comparisons and swaps grows quadratically with the size of the input.

  • How does Quick Sort differ from Bubble Sort in terms of efficiency?

    -Quick Sort has a time complexity of O(n log n), making it significantly faster than Bubble Sort for larger datasets due to its divide-and-conquer approach.

  • What is the concept of a 'heap' in the context of Heap Sort?

    -A 'heap' in Heap Sort is a specialized tree-based data structure where every parent node is larger than its children, allowing for efficient extraction of the largest element.

  • How does the Selection Sort algorithm find the smallest element in an unsorted list?

    -Selection Sort works by repeatedly scanning the unsorted section of the list to find the smallest element and then swapping it with the first unsorted element, moving the boundary of the sorted and unsorted sections each time.

Outlines

00:00

🔍 Interactive Sound Visualization in Sorting Algorithms

This paragraph discusses an interactive program that uses sound to represent the process of sorting algorithms. When elements are swapped, the program plays a sound, allowing users to hear fluctuating pitches that correspond to the values being sorted. The creator of the video script reflects on previous videos about sorting algorithms and mentions the BBC Micro, a computer designed to introduce people to programming. The script also touches on the use of BBC Basic, an interpreter built into the Acorn A5000 computer, which is used to demonstrate the sorting process visually and audibly. The video script includes the source code for a program that generates random colors and sounds, and discusses the limitations of using certain libraries for programming.

05:02

🎮 Implementing Audio Feedback in Sorting Algorithms

The script describes a game called 'Doctor Audio,' which is a variation of 'Dr. Watson,' using tones to provide feedback on the user's guess of a number. The tone's pitch varies based on the proximity of the guess to the correct number, with the sound parameters explained in detail. The paragraph also covers the process of transferring data from a book to a computer, which involves typing in the code manually. The speaker then transitions to discussing the implementation of visual sorting programs, starting with bubble sort, which is demonstrated with 30 elements. The script provides specific details on the time taken, comparisons, and swaps for bubble sort, and how these metrics change when the number of elements is increased to 60.

10:02

📉 Comparing Sorting Algorithms and Their Performance

This paragraph compares different sorting algorithms, including bubble sort, quick sort, selection sort, and heapsort. It explains that bubble sort and selection sort are slow due to their time complexity of n squared, while quick sort and heapsort are more efficient with a time complexity of n log n. The script provides a visual demonstration of quick sort, showing how it partitions the list and sorts it more quickly than bubble sort. Selection sort is also discussed, with its process of finding the smallest element in the unsorted list and placing it in the sorted list. The paragraph concludes with a brief introduction to heapsort, explaining the concept of a heap and how it is used in the sorting algorithm, followed by a demonstration of heapsort sorting 100 elements.

Mindmap

Keywords

💡Sorting Algorithm

A sorting algorithm is a method for arranging elements in a specific order, typically numerical or alphabetical. In the video, various sorting algorithms are discussed and demonstrated, such as Bubble Sort, Quick Sort, and Heap Sort. These algorithms are essential for organizing data efficiently, and the video provides a visual and auditory representation of how each algorithm processes a list of elements.

💡Bubble Sort

Bubble Sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. The pass through the list is repeated until the list is sorted. In the video, Bubble Sort is shown with a visual representation where each swap is accompanied by a sound, illustrating the algorithm's process.

💡Quick Sort

Quick Sort is an efficient sorting algorithm that works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arrays, according to whether they are less than or greater than the pivot. The sub-arrays are then sorted recursively. The video demonstrates Quick Sort and compares its efficiency to other algorithms, showing how it can quickly organize a large set of elements.

💡Heap Sort

Heap Sort is a comparison-based sorting technique based on a binary heap data structure. It's similar to selection sort where we first find the maximum element and place it at the end. We follow this process for the remaining elements. The video explains Heap Sort and shows how it builds a heap and then repeatedly extracts the maximum element to sort the list, demonstrating its efficiency.

💡BBC Micro

The BBC Micro is a series of microcomputers and associated peripherals designed and sold by the Acorn Computer company in the 1980s, as featured in the video. It was designed for the British Broadcasting Corporation's Computer Literacy Project, aiming to promote computer and programming education. The video discusses the BBC Micro and its descendant, the Acorn A5000, which are used to demonstrate programming concepts.

💡Acorn A5000

The Acorn A5000 is a personal computer that was released in 1991 by Acorn Computers. It is a successor to the BBC Micro and is featured in the video as an example of an older computer system. The A5000 is shown booting up and running BBC Basic, which is used to demonstrate various programming tasks, including the implementation of sorting algorithms.

💡BBC Basic Interpreter

The BBC Basic Interpreter is a programming language interpreter for the BBC Micro and compatible computers, including the Acorn A5000. It allows users to write and execute programs in the BBC Basic language. The video shows how the interpreter is used to implement and visualize sorting algorithms, providing an interactive way to understand their operation.

💡Graphical User Interface (GUI)

A Graphical User Interface (GUI) is a type of user interface that allows users to interact with electronic devices through graphical icons and visual indicators. The video mentions that the Acorn A5000 boots up into a GUI, which is a departure from the text-based interfaces of earlier systems. This GUI includes features like an icon bar and mouse support, making it more user-friendly.

💡Sound Synthesis

Sound synthesis refers to the artificial generation of sound. In the context of the video, sound synthesis is used to create auditory feedback during the sorting process. Each time elements are compared or swapped, a sound is played, with the pitch of the sound corresponding to the value of the elements. This adds an additional layer of interactivity and understanding to the sorting visualization.

💡Data Structure

A data structure is a way of organizing and storing data in a computer so that it can be used efficiently. The video touches on data structures like heaps, which are used in Heap Sort. A heap is a specialized tree-based data structure that satisfies the heap property, where each parent node is either greater than or equal to (in a max heap) or less than or equal to (in a min heap) its children. The video explains how heaps are used in sorting algorithms to improve efficiency.

💡Computer Programming

Computer programming is the process of designing and building an executable computer program to perform a specific task. The video script discusses various aspects of programming, such as implementing sorting algorithms and using the BBC Basic Interpreter. It also touches on the historical context of programming education with the BBC Micro and the Acorn A5000, showcasing the evolution of programming tools and techniques.

Highlights

The transcript describes a unique auditory and visual approach to demonstrating sorting algorithms, with sounds representing the elements being swapped.

Acorn's BBC Micro and its successor, the A5000, are discussed, highlighting the evolution of computing and programming interfaces.

BBC Basic interpreter is mentioned, illustrating the continuity of programming languages and their influence on modern systems.

The operating system's quick boot-up time due to being stored in ROM is noted, emphasizing the efficiency of older computing systems.

A GUI-based interface of the A5000 is contrasted with the BBC Micro, showcasing the shift to more user-friendly computing experiences.

Built-in applications and the concept of 'apps' in the 90s are explored, providing historical context to modern application ecosystems.

The use of libraries in programming is explained, emphasizing the reliance on community-contributed code for efficiency and reliability.

Acorn's BBC Basic is used to create a visual and auditory representation of sorting algorithms, demonstrating creative programming applications.

The transcript details the implementation of a program that visualizes sorting algorithms with sound, offering insight into multi-sensory programming.

Bubble Sort's process and its auditory representation are explained, providing a clear example of how the algorithm works.

The time complexity of Bubble Sort is discussed, with a practical demonstration of its performance on different element counts.

Quick Sort is introduced, with an explanation of its partitioning method and its superior performance over Bubble Sort.

Selection Sort is covered, comparing its time complexity to Bubble Sort and noting its fewer swaps but similar performance.

Heapsort is introduced, explaining its use of a heap data structure and its time complexity of n log n.

A comparison of sorting algorithms is presented, visually and audibly, to demonstrate their efficiency and differences.

The transcript concludes with a discussion on the practical applications of these sorting algorithms and their performance implications.

Transcripts

play00:00

so each time it swaps a pair of elements

play00:02

it plays the sound of both of them

play00:04

you can hear this sort of fluctuating

play00:06

pitches

play00:07

each time it compares each pair of

play00:08

elements it plays a noise and then

play00:11

potentially swaps them

play00:12

and what we thought we'd do is make them

play00:14

all sort 100 elements and you'll see

play00:16

them side by side

play00:19

in the last couple of videos we've done

play00:21

on sorting algorithms there's been quite

play00:23

a few comments uh on the videos and

play00:26

requests from people to do

play00:28

some more on different sorting

play00:29

algorithms so it's been a couple of

play00:30

weeks since we did the videos and um

play00:34

also there's been some more videos on

play00:36

computer file in particular i saw the

play00:38

one on the bbc micro so the bbc wanted

play00:40

to develop a project to introduce people

play00:42

to computers and programming they

play00:45

commissioned a british company called

play00:46

acorn

play00:47

to make this computer and how easy it is

play00:50

to use basic to draw things on the

play00:53

screen and make noises

play00:56

this is an a5000 which is a computer

play00:59

made by acorn

play01:01

which dates from about 1991 i think

play01:04

so um

play01:06

it's it's kind of

play01:07

a descendant of the bbc micro it's it's

play01:09

got an arm chip

play01:11

which the bbc micro didn't have because

play01:13

it's a an acorn it's got um

play01:16

it's got bbc basic interpreter built

play01:18

into it there is a bbc basic interpreter

play01:20

for windows

play01:21

it's a bit limited in terms of what you

play01:23

can use for memory and i didn't want to

play01:25

have to pay for it and i have this

play01:26

sitting in a corner like the bbc micro

play01:28

the operating system is in rom so you

play01:29

turn it on and it's

play01:31

it's pretty quick to boot up

play01:34

so

play01:35

we just wait

play01:37

and

play01:43

there we go it's booted up unlike the

play01:44

bbc micro this boots up into a gui

play01:47

you've got a mouse and some things to

play01:49

click on this is called the icon bar at

play01:50

the bottom here and this is a hard drive

play01:53

icon so you click on that it opens it

play01:55

comes with a hard drive in a window that

play01:57

looks familiar to you probably if you

play01:58

used any modern operating system this is

play02:01

the floppy drive here

play02:02

so you click on that it'll say drive

play02:04

empty because it is and then we've got

play02:07

apps which are some built-in

play02:09

applications and networking and over

play02:11

here we've got

play02:12

graphics options and operating system

play02:14

options so acorn we're talking about

play02:16

apps back in the 90s well yeah it's just

play02:20

short applications so if you click on it

play02:22

you've got some built-in basic things so

play02:24

you've got an alarm which tells you the

play02:26

time if you click on configure it brings

play02:28

up the configuration

play02:30

so you can change things like sound

play02:32

options so i can change the noise to be

play02:38

various different things when i was

play02:40

looking at sorting algorithms on youtube

play02:41

i found

play02:43

another video or another couple of

play02:44

videos made by someone else who had

play02:46

written a program in c plus but did

play02:49

visualization of sorting algorithms

play02:51

so it would show you an unsorted list

play02:54

and it would sort it into order each

play02:56

time it would swap a pair of elements or

play02:57

do something it would play a certain

play02:58

pitch depending on the value of that

play03:00

element well that's quite interesting

play03:02

but there are some sorting algorithms

play03:04

that they haven't done that i'd like to

play03:05

see so i thought i'd do it myself they

play03:08

posted their source code and it was

play03:10

using some c plus plus library that i

play03:12

couldn't get an up-to-date version of on

play03:13

my system

play03:14

so a library is just a collection of of

play03:17

code written by other people that does a

play03:19

certain task for you so you can just use

play03:20

that most people use libraries of code

play03:22

because you can generally be guaranteed

play03:24

that it does what it's supposed to do

play03:25

correctly and i thought well having seen

play03:27

that bbc basic video and the

play03:30

the triangles program on screen i can

play03:32

show you you know i did my own

play03:34

implementation as i was playing the

play03:35

triangle on screen i also decided to

play03:36

make it make a noise

play03:38

so i can show you the source code for

play03:40

that this is it i'm going to put some

play03:42

spaces in just make it a little bit

play03:43

clearer mode 27 tells it what screen

play03:46

resolution to use and what color is

play03:47

available that sort of thing okay and

play03:49

then we've got this repeat until false

play03:51

block what it does it repeats all this

play03:53

until false and now false never

play03:55

evaluated to true so it just repeats it

play03:56

forever this says set a variable called

play03:58

color to a random numbers between zero

play04:01

and seven

play04:02

this then says set the graphics color to

play04:05

that random number between zero and

play04:06

seven

play04:08

then we play a sound

play04:10

related to that random number as well so

play04:12

the numbers between zero and seven we

play04:13

need to scale it to be in the range zero

play04:15

to two five five so that's the pitch

play04:16

value and it

play04:17

zero is the lowest pitch it doesn't two

play04:19

five five is the highest pitch it will

play04:20

do if we left it zero to seven it would

play04:22

just be very low and they'd all sound

play04:23

quite similar this line that says plot

play04:26

actually draws a triangle so that's what

play04:28

you would have seen in the other video

play04:30

now this line is here to slow it down

play04:33

because it goes very fast on this so if

play04:35

i comment this line out we use rem

play04:38

which i think stands for reminder so if

play04:40

i save that and then i run triangles

play04:42

again

play04:43

it goes so fast that you can't already

play04:45

sound because as soon as it starts

play04:46

playing one sound it's trying to stop

play04:47

playing the next and you can't hear

play04:48

anything another thing i used was a book

play04:52

that

play04:54

came into my possession i came to the

play04:56

office called games for your bbc micro

play04:58

this is just code listings of of certain

play05:01

games the first one i did was quite

play05:03

short it's called doctor audio it says

play05:05

this game is a variation of dr watson in

play05:07

which when you guess the computer's

play05:08

number the feedback is given as a tone

play05:10

the picture of this note varies

play05:11

according to how far your guess is from

play05:13

the correct number the sounds are

play05:14

programmed in line 130. this is where

play05:16

how i learned how to do sounds because

play05:18

it said line 130 sound 1 -15 abs a minus

play05:22

b 5. so it turns out that i had to look

play05:26

this up because it wasn't in this book

play05:28

sounds takes one two three four

play05:30

different

play05:31

parameters

play05:33

so the first one is the channel you want

play05:35

to play on i think channel zero does

play05:37

percussion sounds or something strange

play05:39

so anyway the first argument says play

play05:41

on channel one the second one is the

play05:43

volume and that has to be between i

play05:45

think zero and -15 minus 15 is the

play05:48

loudest zero is the quietest this says

play05:51

abs a minus b so that subtracts one

play05:53

number from the other and

play05:55

um

play05:56

gets you the absolute value of it

play05:58

and then the last one is the duration of

play06:00

the note it's in centi seconds so it's

play06:02

500th of a second it plays it for here

play06:04

goes the program they might have rude

play06:06

words in it i can't remember

play06:09

something

play06:09

so i am thinking about between 100 what

play06:11

is it let's go for

play06:13

25.

play06:15

okay it was changed a little bit from

play06:16

what you said in the book

play06:18

but ivy wrote it so the higher the pitch

play06:20

is the closer it is 25 is wrong you

play06:22

so what's my next guess i'm going

play06:25

to say um 75.

play06:28

so 75 sounds closer let's try 80.

play06:31

no that's further away uh 60

play06:35

yeah i'm gonna go for

play06:38

70.

play06:41

hooray where was the disc then with that

play06:43

book

play06:44

where's the disc the disc is

play06:46

the data is stored on the pages

play06:49

which means you've got to transfer it

play06:50

via your hand and the keyboard

play06:53

so show me what that meant okay so what

play06:54

i have to do is um type everything in to

play06:57

a nice text editor

play06:59

this one's not particularly nice

play07:01

this is the code that does that program

play07:03

this is

play07:06

about 30 lines probably now i kind of

play07:08

was a little bit more familiar with bbc

play07:10

basic and how to draw things in certain

play07:12

colors and how to play sounds i decided

play07:16

that i could probably implement those

play07:17

visual sorting programs

play07:19

so first of all we've got bubble sort i

play07:21

think this sorts

play07:23

30 elements

play07:25

so with bubble sort we compare elements

play07:27

and keep swapping elements if they're

play07:28

bigger than the ones we're in front of

play07:29

until they get to the end so

play07:32

um

play07:33

the green elements are ones that are in

play07:34

the right place red elements are

play07:36

unsorted and the blue ones are sort of

play07:38

ones that are being the ones are active

play07:40

at the moment

play07:42

so for 30 elements that took

play07:45

23.38 seconds 384 comparisons and 228

play07:50

swaps so if we change it to 60 elements

play07:53

open it in the editor and change maxwell

play07:55

from 30 to

play07:57

60.

play07:58

so say five

play08:02

okay so now we've got six elements

play08:06

we've doubled the input size and because

play08:08

it runs with the square of the input

play08:09

size

play08:10

two times two is four so it should take

play08:12

four times as long with four times the

play08:13

number of comparisons and four times the

play08:15

number of swaps each time it does a

play08:17

comparison and each time it does a swap

play08:19

it it increments a counter and just

play08:20

prints it out up here

play08:22

so each time it swaps a pair of elements

play08:24

it plays the sound of both of them

play08:26

you can hear this sort of fluctuating

play08:27

pitches

play08:28

each time it compares each pair of

play08:30

elements it plays a noise and then

play08:33

potentially swaps them

play08:38

it's getting

play08:39

smaller now

play08:40

we're only sorting say 20 maybe now

play08:43

what this is showing uh us is each of

play08:46

these columns which is the same width is

play08:48

a different number and so that's a low

play08:51

number and they said you've got a high

play08:53

number so when we start out the list is

play08:55

unsorted so you've got sort of also high

play08:57

and low columns all next to each other

play08:59

and when we have sorted the list in it

play09:02

with low numbers like end and high

play09:03

numbers at that end we also covered

play09:04

quick sort in our previous videos so

play09:07

we'll show you that so there's a

play09:08

variable called number of elements

play09:10

that's set to a thousand so i'm going to

play09:11

reduce it to

play09:12

say uh

play09:14

400. okay and we've also got another

play09:16

option here so we can set graphical to

play09:18

true or false actually what you find is

play09:20

if you really want to do proper speed

play09:22

tests you need to turn the graphics off

play09:23

because they slow it down a lot if you

play09:24

wanted to prove a point and

play09:27

do something like this by the way this

play09:28

graph is linked to from the previous

play09:30

sorting videos

play09:32

so let's save that

play09:34

and then run it so we've got

play09:36

quick sort

play09:38

so

play09:39

here's our list of unsourced elements so

play09:41

you can see there's also high low ones

play09:43

hopefully you'll remember from the video

play09:44

on quick sort the way this works it

play09:46

partitions the list by picking an

play09:48

element called pivot and putting all

play09:51

elements less on it on one side and

play09:52

greater than on the other side and then

play09:54

it

play09:55

it does that again on each sub on each

play09:57

side so you can see it's kind of it's

play09:59

done all the left hand side and now it

play10:00

will start doing the right hand side so

play10:02

there's the pivot it does all the

play10:03

left-hand side

play10:04

picks another pivot it keeps doing that

play10:07

until it's sorted

play10:09

[Music]

play10:11

you can see with quick sort it is a lot

play10:13

quicker than bubble sort another

play10:15

algorithm that we didn't cover before if

play10:17

it is still fairly simple is called

play10:18

selection sort you go through your list

play10:20

and you look for the lowest element

play10:21

that's in the in the unsorted list you

play10:23

take that and you put it in your sorted

play10:25

list

play10:26

you go through the unsorted list pick

play10:28

the lowest element from there put that

play10:29

in your sorted list here's 100 elements

play10:31

being selection sorted

play10:33

we've got to look through the whole list

play10:34

find the smallest and then we put it at

play10:36

the other end

play10:38

so

play10:40

is this a quick one this is not

play10:42

particularly quick this also is n

play10:44

squared because you've got to look at

play10:47

you can look at these over and over

play10:48

again

play10:49

it's the same time complexity as bubble

play10:51

sorts although i think it might perform

play10:53

a little bit better because it does

play10:54

slightly fewer comparisons

play10:57

whereas it certainly does fewer swaps

play10:59

it only needs to do at most

play11:01

one swap per element in the list whereas

play11:02

bubbles can go crazy the comparisons are

play11:05

still quite high and that makes it a

play11:06

little bit slow

play11:12

and what we thought we'd do is make them

play11:14

all sort a hundred elements and um you

play11:17

can see them side by side and

play11:20

hopefully uh sped up a bit because some

play11:21

of them are quite slow

play11:24

[Music]

play11:35

[Music]

play11:51

what we've seen is bubble salt and

play11:52

cocktail salt and selection saw are

play11:54

quite slow in comparison to quick sort

play11:57

um quicksort runs in n log n

play12:00

as we said in the quick sort video

play12:02

uh another algorithm that people were

play12:04

asking about in the comments is heapsort

play12:07

that also runs an n log n you need quite

play12:09

a lot of background knowledge to

play12:11

understand how it works so heapsort uses

play12:13

something called a heap

play12:15

now a heap is a type of data structure

play12:19

which is represented by a binary tree

play12:21

whereby

play12:22

every element in the tree

play12:25

um

play12:26

has children who are

play12:28

smaller than it we haven't covered trees

play12:32

to cover trees we need to probably cover

play12:33

linked lists to cover

play12:36

linked lists we need to do something

play12:37

about data structures and we haven't got

play12:39

there yet

play12:40

however i will show you heapsort before

play12:42

i started what it does it builds a heap

play12:44

up the largest element is always at zero

play12:47

and then it swaps that element to

play12:49

the end and it restructures the heap so

play12:52

that the largest elements are getting at

play12:53

that end well let's let's go

play12:56

so this is building up the heat

play12:58

now it's built the heat it can keep

play13:00

taking the largest element and

play13:02

maintaining the heat structure

play13:04

[Music]

play13:07

i'm using a sorted list

play13:13

[Music]

play13:19

well that was quite quick that was 100

play13:20

elements so it's the same as the other

play13:22

ones we've just seen if you know what

play13:23

heap is and not it's different from the

play13:26

heap the heap is um an area of memory as

play13:29

opposed to the stack

play13:30

but the heap and a heap not the

play13:44

and then we say which is lowest between

play13:45

seven and eight it's seven uh which is

play13:48

lowest between eight and nothing it's

play13:49

eight and then similarly ten and nothing

play13:52

it's ten is the idea that we've got it

play13:54

in the case of ipv4

Rate This

5.0 / 5 (0 votes)

Ähnliche Tags
Sorting AlgorithmsBBC MicroVisual ProgrammingSound SynthesisComputer HistoryEducational ToolBasic InterpreterGUI InterfaceAcorn ComputersAlgorithm Visualization
Benötigen Sie eine Zusammenfassung auf Englisch?