B2.4 Programming algorithmsB2.4.2
Linear Search and Binary Search
Construct and trace algorithms to implement a linear search and a binary search for data retrieval
SL + HL≈ 60 minCommand term: ConstructPremium
In this lesson
- Constructing a linear search and a binary search in Java and Python
- Tracing a binary search with low, mid and high
- Comparing the efficiency of the two searches
- Choosing a search technique based on the data and the efficiency required
This lesson is part of Premium
Every topic has one free lesson. Premium unlocks every interactive lesson, the exam-style questions at the end of each one, and the rest of Praxis IB.
What's inside
- LearnTwo ways to search
- CodeLinear search
- CodeBinary search
- LabSearch step by step
- CheckTrace a binary search
- LearnComparing the two searches
- CheckQuick check
- LearnChoosing a search technique
- ExamWorked exam answer
- ReviewMistakes examiners see
- Exam practiceExam-style questions
Ends with 4 exam-style questions worth 13 marks, with a self-marking markscheme.