Sorting Algorithms Flashcards

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

Usability Testing

A

Aims to grade the ease of use of a program

The software should be easy to understand and be suitable for everyone

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

Improved Bubble Sort

A

Boolean variable called sorted introduced in order to be set to true when no swaps have occurred in a pass

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

Insertion Sort

A

PROCEDURE
DECLARE listlength initially length (list)
DECLARE current and position as integer initially 0
FOR index from 1 TO list length -1 DO
SET current TO list (index) and position TO index
WHILE position > 0 AND list position-1 > current
SET list position TO list position -1
SET position TO position -1
END WHILE
SET list(position) TO current followed by END FOR

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

Selection Sort Using Two Lists setup

A

Procedure selection sort
DECLARE dummy INITIALLY “X”
DECLARE comparisons, passes, minimum position initially 0

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

Describe how an insertion sort would reorder items

A

Runs through the list comparing the current item in the array with the one before it
If the item prior to the current item is more/less than the current item then it moves into the current items place and the current item moves back where the gap was left from the move prior to the completion of the fixed loop

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

Algorithm for removing an item from the queue top

A

IF front = back THEN

ELSE

SET front TO front -1
END IF

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

Selection Sort using two lists FOR setup

A

FOR listBcounter FROM 0 TO listlength DO
SET passes to passes + 1
SET minimum position TO listBcounter

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

Selection sort using two lists after FOR setup

A

FOR listAcounter FROM 0 to listlength DO
SET comparisons TO comparisons + 1
IF listA(listAcounter) < listA(minimumposition) THEN
SET minimumposition TO listAcounter

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

Selection sort using two lists final part

A

END IF
END FOR
SET listb(listBcounter) TO listA(minimum position)
SET lista(minimumposition) TO dummy
END FOR
SEND comparisons message & comparisons
SEND passes message and passes to display
END procedure

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

Describe adding a new item to a linked list

A

New node added to store data, pointer set to location of next item in list
Address of new node stored in item prior in the list

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

Explain why a hotel should inform customers of a security breach and advice they should give

A

Under Data Protection Act there is an obligation to ensure that personal data is held securely
Customers to be informed and encouraged to contact their bank to check for unauthorised use

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