Paper 2: Sorting and Searching Algorithms Flashcards

1
Q

What is sorting?

A

Putting words or numbers into order, either alphabetical or numerical.

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

What is searching?

A

Finding a particular value in a list of data.

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

What does shifting mean in data management?

A

Moving data to the right or left in a list.

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

What is exchanging in data management?

A

Moving data from one memory location to another using a temporary variable.

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

What is a temporary variable?

A

A temporary store of data used when exchanging data to ensure a value is not overwritten.

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

What is a linear/sequential search?

A

Starts at the first item and works through the list until the item is found or the end is reached.

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

What are the advantages of linear search?

A
  • Can work on any list sorted or unsorted
  • Easy to program
  • Efficient for small lists if the value is near the start.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the disadvantages of linear search?

A

Not efficient for larger lists of data.

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

How does a binary search work?

A

Finds the midpoint of the list and checks that value, splitting the list until the item is found or not.

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

What is a requirement for binary search to work?

A

Only works on an ordered list.

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

What are the advantages of binary search?

A
  • More efficient than linear for larger lists
  • Faster search time.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the disadvantages of binary search?

A

Harder to program than linear search.

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

What is bubble sort?

A

Starts at Item 1, checks the first two items, swaps if needed, and repeats until no swaps are made.

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

What are the advantages of bubble sort?

A
  • Easy to program
  • Does not use a great deal of memory to run.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the disadvantages of bubble sort?

A

Not very efficient and can take a long time for larger lists.

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

What is insertion sort?

A

Starts at item 2, compares it with previous items, and places it in the correct position.

17
Q

What are the advantages of insertion sort?

A
  • Efficient use of memory and time
  • More efficient and faster than bubble sort.
18
Q

What are the disadvantages of insertion sort?

A

Slower than merge sort for larger lists.

19
Q

What is merge sort?

A

Splits the list until items are in individual lists, then merges them back together in order.

20
Q

What are the advantages of merge sort?

A

Very efficient for sorting large lists.

21
Q

What are the disadvantages of merge sort?

A

Very memory intensive as it creates many lists.

22
Q

True or False: Linear search can only be performed on sorted lists.

23
Q

True or False: Insertion sort is less efficient than bubble sort for larger lists.

24
Q

Fill in the blank: Merge sort is __________ for sorting large lists.

A

very efficient.