4.3.4 Searching Algorithms

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

10 Terms

1
New cards

What is an algorithm?

A set of instructions which completes a task in a finite time and always terminates

2
New cards

What is a searching algorithm?

An algorithm to:

- Find the location of an item in a data structure

- Verify the presence of the item

3
New cards

What are the types of searching algorithm?

- Linear search

- Binary search

- Binary tree search

4
New cards

How does a linear search work?

Each item in the list is checked in sequence until the item is found or all items have been checked

→ Compared with the search term

→ Can be performed on any unordered list

5
New cards

Why are linear searches rarely used?

High time complexity - O(n)

6
New cards

How does a binary search work?

- Midpoint in the list is found

- Determine if the target is higher or lower than the midpoint

- This is repeated until the item is found or the list cannot be divided further

Ordered lists only

7
New cards

What is the time complexity of a binary search?

O(log n) - The list is halved with each search

8
New cards

How does a binary search work?

Identical to a binary search except it is conducted on a binary tree

9
New cards

What is a binary tree?

A rooted ordered tree in which each node has a maximum of two children

10
New cards

What is the time complexity of a binary tree search?

O(log n)