Fundamentals of algorithms- module 3) Sorting Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is the definition of a sort?

A

Sorting algorithms find things quickly by putting data into a sort order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 2 types of sort?

A

1) Merge sort.

2) Bubble sort.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a merge sort (also known as divide and conquer sort)?

A

Like a binary search, a merge sort splits data in half and works on each half in turn the computer sorts both small groups before merging the small groups together again.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does a computer do to complete a merge sort?

A

1) Repeatedly splits data in 2 halves until each list contains only a single data item.
2) Merges these 2 lists back together in order (descending or ascending).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is bubble sort (also known as sinking sort)?

A

Slow methodical nature.
Compares which of the 1st 2 items is larger then swaps so that the larger is 1st.
Then checks next one.
If any position changes have happened, whole process is begun again until computer can go from start to finish + no changes to be made. At this point data is in descending order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the definition of descending?

A

Decreasing in number to 1 downwards, or in value from A.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the definition of ascending?

A

Increasing in number to 1 upwards or in value from Z.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the advantages of bubble sort?

A

Space used in memory stable/ never changes as items just swapped about.
Good for sorting a very small volume of data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the disadvantages of bubble sort?

A

Very slow.

Can’t efficiently handle a large data set.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are the advantages of merge sort?

A

Can efficiently handle a large data set.

Very quick.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the disadvantages of merge sort?

A

Uses more memory and variable amounts of memory as has to split data in 2 each time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly