Year 11 Exam  >  Year 11 Notes  >  Computer for GCSE/IGCSE  >  Standard Methods

Standard Methods | Computer for GCSE/IGCSE - Year 11 PDF Download

  • Linear search, a fundamental algorithm, is employed to locate elements in an unordered list. It systematically traverses the list from start to end, comparing each element with the value being sought.
    • Upon finding the value, the algorithm indicates its position in the list.
    • If the value is not found, it outputs a message confirming its absence in the list.
  • Linear search finds application in scenarios such as searching for a particular student's name in a list or locating a supermarket item in a shopping list.

Standard Methods | Computer for GCSE/IGCSE - Year 11

OUTPUT “Enter a value to find”
INPUT Number
Found ← FALSE
Index ←1
REPEAT
IF Number = Mylist[Index]
             THEN
Found ← TRUE
ELSE
Counter ← Counter + 1
ENDIF
UNTIL Found =TRUE OR Counter > LENGTH(Mylist)
IF Found = TRUE
  THEN
OUTPUT Number, “ found at position “, Counter
ELSE
OUTPUT Number, “ not found”
ENDIF

Bubble Sort

  • Bubble sort arranges items in ascending order by comparing pairs of elements and swapping them if they are in the wrong order.
  • The comparison process starts with the first element compared to the second, followed by the second to the third, and so on until the second-to-last element is compared to the last. Swaps occur if needed, constituting a pass.
  • Upon completing a pass through the list, the largest value is placed at the end, and the sort resets to the beginning for the next iteration.
  • Successive passes continue until all elements are sorted correctly.
  • A final pass checks for any swaps, and if none occur, the sort is deemed complete.
  • Bubble sort finds application in tasks like sorting an array of names alphabetically or arranging student marks from a test in ascending order.

Standard Methods | Computer for GCSE/IGCSE - Year 11

Mylist ← [5, 9, 4, 2, 6, 7, 1, 2, 4, 3]
FirstElement ← 1
LastElement ← LENGTH(Mylist)
REPEAT
                     Swap ← FALSE
                For Index ← FirstElement TO LastElement - 1
                      IF Mylist[Index] > Mylist[Index + 1]
                          THEN
                       Temp ← Mylist[Index]
                  Mylist[Index] ← Mylist[Index + 1]
                    Mylist[Index + 1] ← Temp
                         Swap ← TRUE
                     ENDIF
                       NEXT Index
                        LastElement ← LastElement - 1
UNTIL Swap = FALSE OR LastElement = 1
OUTPUT “Your sorted list is:”, Mylist

Question for Standard Methods
Try yourself:
Which algorithm is used to locate elements in an unordered list?
View Solution

Totalling & Counting

  • Totalling involves keeping a running total of values as they are inputted into a program or system. For instance, you might use totalling when adding up the cost of items on a shopping receipt.
  • When totalling, the process typically starts with a base value, often zero, and then increments this total by adding each new value to it.
  • For example, let's say you have a receipt with four items: an apple costing £0.50, a drink for £1, a sandwich for £2, and a chocolate bar for £1. If you were to total these costs using an algorithm, it would add each item's cost sequentially, resulting in a final total of £4.50.

Total ← 0
FOR Count ← 1 TO ReceiptLength
               INPUT ItemValue
                  Total ← Total + itemValue
NEXT Count
OUTPUT Total

Counting

  • Counting in algorithms is a fundamental process where the count is either increased or decreased by a fixed value, typically 1, during each iteration. This method helps keep track of how many times a specific action has been executed.
  • Various algorithms, such as linear search and binary search, leverage counting to monitor the element currently under consideration.

Count ← 0
DO
             OUTPUT “Pass number”, Count
              Count ← Count + 1
UNTIL Count >= 50

  • The count decreases from fifty until it reaches zero, with an output generated for each iteration.

Count ← 50
DO
            OUTPUT “Pass number”, Count
                  Count ← Count - 1
UNTIL Count <= 0

Maximum, Minimum & Average

  • Finding the largest and smallest values in a list is a common practice in algorithms. For instance, this could involve determining the highest and lowest student grades in a class or identifying the top and bottom scores in a game.

Max ← Score[1]
Min ← Score[1]
FOR Count ← 2 TO ScoreSize
               IF ScoreSize[Count] > Max
                 THEN
                 Max ← ScoreSize[Count]
                   ENDIF
               IF ScoreSize[Count] < Min
                    THEN
                 Min ← ScoreSize[Count]
                     ENDIF
Next Count

  • To find the maximum and minimum values in a list, a common algorithm involves iterating through the list and comparing each element with the current maximum and minimum values.
  • Initially, the maximum value is set to the first element in the list, and the minimum value is also set to the first element.
  • Then, the algorithm loops through the list starting from the second element to the end.
  • For each element, it checks if the element is greater than the current maximum value. If so, it updates the maximum value.
  • Similarly, it checks if the element is smaller than the current minimum value. If it is, the minimum value is updated.
  • By the end of the iteration, the algorithm would have found the maximum and minimum values in the list.

Total ← 0
FOR Count ← 1 TO ScoreSize
Total ← Total + ScoreSize[Count]
NEXT Count
Average ← Total / ScoreSize

The document Standard Methods | Computer for GCSE/IGCSE - Year 11 is a part of the Year 11 Course Computer for GCSE/IGCSE.
All you need of Year 11 at this link: Year 11
92 docs|30 tests

Top Courses for Year 11

FAQs on Standard Methods - Computer for GCSE/IGCSE - Year 11

1. What is linear search and how does it work?
Ans. Linear search is a simple searching algorithm that sequentially checks each element in a list until a match is found or the whole list has been searched. It works by comparing the target value with each element in the list one by one.
2. How does bubble sort algorithm work?
Ans. Bubble sort is a simple sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted.
3. How can totalling and counting be implemented in a program using standard methods?
Ans. Totalling and counting can be implemented in a program using loops to iterate through a list of numbers, adding them together to calculate the total and incrementing a count variable for each element to keep track of the number of items in the list.
4. How can the maximum, minimum, and average of a list of numbers be calculated using standard methods?
Ans. The maximum and minimum of a list of numbers can be found by iterating through the list and keeping track of the largest and smallest values encountered. The average can be calculated by summing all the numbers in the list and dividing by the total number of elements.
5. What are some common applications of linear search and bubble sort algorithms in real-world scenarios?
Ans. Linear search can be used to search for an item in a list of contacts on a phone, while bubble sort can be used to sort a list of student grades in ascending order. These algorithms are commonly used in various applications where simple searching and sorting operations are required.
92 docs|30 tests
Download as PDF
Explore Courses for Year 11 exam

Top Courses for Year 11

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

Viva Questions

,

ppt

,

Standard Methods | Computer for GCSE/IGCSE - Year 11

,

shortcuts and tricks

,

Free

,

Sample Paper

,

video lectures

,

MCQs

,

pdf

,

Extra Questions

,

Exam

,

Standard Methods | Computer for GCSE/IGCSE - Year 11

,

study material

,

past year papers

,

Standard Methods | Computer for GCSE/IGCSE - Year 11

,

Important questions

,

Semester Notes

,

practice quizzes

,

mock tests for examination

,

Summary

,

Objective type Questions

,

Previous Year Questions with Solutions

;