Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 6 pages
Summary

Summary GCSE OCR Computer Science revision notes for Algorithms

Document preview thumbnail
Preview 2 out of 6 pages

These in-depth and comprehensive GCSE OCR Computer Science notes helped me to achieve a high Grade 9 in my GCSE Examinations. They were created using a wide array (pun intended) of online resources, including but not limited to Physics and Maths Tutor, Craig n Dave, ISAAC Computer Science, ZigZag Learner Companion and Teach-ICT.

Content preview

Data set – group of data items

Two search algorithms: linear and binary

What you are looking for – search criteria

Linear search = start with he first item in the set and compare it to the search
criteria

If no match is found, then the next one is compared, continuing until a match is
found or the end of the set is reached – sequential search algorithm

Data_set = [“cat”, “dog”, “lion”, “penguin”, “ant”]


data_set_length = 5

search_criteria = "penguin"

match = false



FOR (i = 0 TO (data_set_length - 1))

IF data_set[i] == search_criteria THEN

match = true

exit loop

END IF

NEXT i



IF (match == true) THEN

PRINT "Match found"

ELSE

PRINT "No match found"

END IF

 Performs well with small and medium-sized lists

 Fairly simple to code

 The data set does not need to be in any particular order
(some algorithms need an ordered list)

,  It doesn't break if new items are inserted into the list.

Disadvantages
 May be too slow to process large lists or data sets

 If the search criteria only matches the last item in the list,
the search has to go through the entire list to find it.

Binary search algorithm must be arranged in order.

Then split into two and two again

Hover over each line to see the comment about it.



data_set = [2, 4, 5, 6, 9, 21, 50, 77, 91]

data_set_length = 9

search_criteria = 50

LB = 0

UB = data_set_length - 1

match = false



WHILE match == false AND LB != UB

MidPoint = roundup((UB - LB)/2) + LB

IF data_set[MidPoint] == search_criteria THEN

match = true

ELSE IF data_set[MidPoint] < search_criteria THEN

LB = MidPoint + 1

ELSE

UB = MidPoint - 1

END IF

END WHILE



IF match == true THEN

PRINT 'Match found'

ELSE

Document information

Study
School year
3
Uploaded on
September 2, 2026
Number of pages
6
Written in
2023/2024
Type
Summary
$14.69

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Sold
0
Followers
0
Items
29
Last sold
-




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions