Sorting Algorithms
No description yet. This curated deck is ready for daily study.
Card preview (11)
Usability Testing
Aims to grade the ease of use of a program The software should be easy to understand and be suitable for everyone
Improved Bubble Sort
Boolean variable called sorted introduced in order to be set to true when no swaps have occurred in a pass
Insertion Sort
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
Selection Sort Using Two Lists setup
Procedure selection sort DECLARE dummy INITIALLY “X” DECLARE comparisons, passes, minimum position initially 0
Describe how an insertion sort would reorder items
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
Algorithm for removing an item from the queue top
IF front = back THEN ELSE SET front TO front -1 END IF
Selection Sort using two lists FOR setup
FOR listBcounter FROM 0 TO listlength DO SET passes to passes + 1 SET minimum position TO listBcounter
Selection sort using two lists after FOR setup
FOR listAcounter FROM 0 to listlength DO SET comparisons TO comparisons + 1 IF listA(listAcounter) < listA(minimumposition) THEN SET minimumposition TO listAcounter
Selection sort using two lists final part
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
Describe adding a new item to a linked list
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
Explain why a hotel should inform customers of a security breach and advice they should give
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