OCR A Level CS 2.3.4 Searching Algorithms

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/13

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 5:03 PM on 4/15/25
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

14 Terms

1
New cards

What is the purpose of a searching algorithm?

To find a specific element in a data structure, such as an array or list.

2
New cards

What are the two standard searching algorithms in OCR A-Level?

Linear Search
Binary Search

3
New cards

How does linear search work?

It checks each element one by one until it finds the target or reaches the end.

4
New cards

What is the time complexity of linear search?

O(n) – Worst case, it checks every element.

5
New cards

What is an advantage of linear search?

Works on unsorted data.

6
New cards

What is a disadvantage of linear search?

Slow for large data sets.

7
New cards

Pseudocode for linear search:

i = 0

while i < A.length:

if A[i] == x:

return i

else:

i = i + 1

return "Not found"

8
New cards

How does binary search work?

It finds the middle element, checks if it's the target, and then eliminates half of the remaining data.

9
New cards

What is the time complexity of binary search?

O(log n) – It halves the data each step, making it much faster than linear search.

10
New cards

What is a key requirement for binary search?

The data must be sorted.

11
New cards

What is an advantage of binary search?

Much faster than linear search for large data sets.

12
New cards

What is a disadvantage of binary search?

Only works on sorted data.

13
New cards

Pseudocode for binary search:

low = 0

high = A.length - 1

while low <= high:

mid = (low + high) / 2

if A[mid] == x:

return mid

else if A[mid] > x:

high = mid - 1

else:

low = mid + 1

return "Not found"

14
New cards

Comparing Linear and Binary Search

Feature

Linear Search

Binary Search

Best for...

Small datasets or unsorted data

Large datasets, sorted data

Time Complexity

O(n) (Slow)

O(log n) (Fast)

Requires Sorting?

No

Yes

Efficiency

Inefficient for large data

Highly efficient

Explore top notes

note
Disabilities
Updated 383d ago
0.0(0)
note
Chapter 3: Using Research Methods
Updated 1393d ago
0.0(0)
note
12 Basic Functions of Calculus
Updated 1285d ago
0.0(0)
note
6.2 State Expansion
Updated 1144d ago
0.0(0)
note
Group 15 elements
Updated 1353d ago
0.0(0)
note
Exploration and Isolation
Updated 851d ago
0.0(0)
note
Disabilities
Updated 383d ago
0.0(0)
note
Chapter 3: Using Research Methods
Updated 1393d ago
0.0(0)
note
12 Basic Functions of Calculus
Updated 1285d ago
0.0(0)
note
6.2 State Expansion
Updated 1144d ago
0.0(0)
note
Group 15 elements
Updated 1353d ago
0.0(0)
note
Exploration and Isolation
Updated 851d ago
0.0(0)

Explore top flashcards

flashcards
phrasal verb and collocation
38
Updated 283d ago
0.0(0)
flashcards
Fourth year final
58
Updated 1215d ago
0.0(0)
flashcards
EXAM 1 - Lecture 1
27
Updated 244d ago
0.0(0)
flashcards
Unit 3 - Post Classical Era
40
Updated 510d ago
0.0(0)
flashcards
cogni
400
Updated 793d ago
0.0(0)
flashcards
Topic 3 Computers
35
Updated 1046d ago
0.0(0)
flashcards
phrasal verb and collocation
38
Updated 283d ago
0.0(0)
flashcards
Fourth year final
58
Updated 1215d ago
0.0(0)
flashcards
EXAM 1 - Lecture 1
27
Updated 244d ago
0.0(0)
flashcards
Unit 3 - Post Classical Era
40
Updated 510d ago
0.0(0)
flashcards
cogni
400
Updated 793d ago
0.0(0)
flashcards
Topic 3 Computers
35
Updated 1046d ago
0.0(0)