Searching And Sorting Algorithms Y9 Flashcards

(19 cards)

1
Q

What is linear search

A

The computer checks each individual item on the list, and compares it to the value being looked for, it then moves on to the next value if not found.

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

Why is linear search inefficient

A

Large lists mean that the search would take a while to finish

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

What is binary search

A

List has to be in order(number or alphabetical order)
Computer checks middle value and compares it-if the number/alphabet is higher than it finds the middle of the second half
Keeps doing this until value found

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

Wha has to happen before binary search can take place

A

List needs to be in order

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

What happens if there is an even number for binary search(which ones the middle)

A

The one on the left

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

Why is binary search more efficient than linear search

A

Binary search looks at significantly less values than linear. Making the process quicker

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

Why do we use sorting algorithms

A

To put a list of items in order (alphabetically or numerically)

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

What is the bubble sort algorithm

A

Compares first two numbers and will swap them if needed (if the value on the one on the right is lower than the one on the left)
Then repeats with second and third number.
This repeats until end of list
Then goes to start of list and redoes it all(ordering again)
Keeps going from start until all in order (there will be one check)

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

How efficient is bubble sort

A

Very inefficient

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

What is merge sort

A

Divide the list in half
And in half again
Keep dividing in half until values are separated
Then start merging them back together
Ordering the values as you go along

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

Which one is more efficient merge or insertion sort

A

Merge

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

Which sort is most complicated

A

Merge

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

What is insertion sort

A

Takes first number of list and adds it to the sorted list
Takes the second and puts it in the sorted list (placing it in order)
Keep going from doing this one at a time until all are sorted

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

Advantages of bubble sort

A

Simple and easiest to code

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

Disadvantages of bubble sort

A

Slowest

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

Advantages of insertion sort

A

Simple and easy to code

16
Q

Disadvantages of insertion sort

A

Twice as fast as bubble but slower than merge

17
Q

Advantages of merge sort

18
Q

Disadvantages of merge sort

A

More difficult to code than the other two and it requires more memory