mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-19 21:09:51 +08:00
feat(curriculum): searching and sorting quiz (#61785)
Co-authored-by: Dario <105294544+Dario-DC@users.noreply.github.com> Co-authored-by: Zaira <33151350+zairahira@users.noreply.github.com>
This commit is contained in:
parent
cf48154b2e
commit
09654cda4c
@ -7,7 +7,7 @@ dashedName: quiz-searching-and-sorting-algorithms
|
||||
|
||||
# --description--
|
||||
|
||||
To pass the quiz, you must correctly answer at least 18 of the 20 questions below.
|
||||
To pass the quiz, you must correctly answer at least 9 of the 10 questions below.
|
||||
|
||||
# --quizzes--
|
||||
|
||||
@ -17,439 +17,218 @@ To pass the quiz, you must correctly answer at least 18 of the 20 questions belo
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which search algorithm iterates through a list of items, checking each item from the beginning until the target item is found?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Merge search
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Bubble search
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Binary search
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Linear search
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which technique is used to break down a problem into smaller sub-problems?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Break-down-and-solve
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Divide-and-solve
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Break-down-and-conquer
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Divide-and-conquer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is the space complexity of the linear search algorithm?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`O(n)`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`O(log n)`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`O(n²)`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`O(1)`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which is more suitable for a larger list of items between binary search and linear search?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Both
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Linear search
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
None
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
Binary search
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is the space complexity of binary search?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`O(log n)`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`O(n)`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`O(n log n)`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`O(1)`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What does the binary search algorithm return when it finds the target item?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
The value of the target item.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
The size of the list searched.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
A boolean value of the target.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
The index of the target item.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What does the linear search algorithm return if it doesn't find the target item?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
`0`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
`Null`
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
`Undefined`
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
`-1`
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
How does the merge sort algorithm work?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
It searches for an element by checking each item one by one.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
It builds a sorted list by repeatedly finding the smallest element.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
It swaps adjacent elements until the list is sorted.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
It recursively splits the list into smaller items, then merges them in sorted order.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
What is the condition for a binary search to work?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
The list must contain only unique values.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
The list must be sorted in descending order.
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
The list must contain no negative numbers.
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
The list must be sorted in ascending order.
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
Which computer science approach is used to implement the merge sort algorithm?
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
Dynamic programming
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
Greedy algorithm
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
Tracing
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
### --question--
|
||||
|
||||
#### --text--
|
||||
|
||||
Placeholder question
|
||||
|
||||
#### --distractors--
|
||||
|
||||
Placeholder distractor 1
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 2
|
||||
|
||||
---
|
||||
|
||||
Placeholder distractor 3
|
||||
|
||||
#### --answer--
|
||||
|
||||
Placeholder answer
|
||||
|
||||
Divide-and-conquer
|
||||
|
||||
Loading…
Reference in New Issue
Block a user