DSA (QUIZ 7) -Greedy Algorithms and Complexity Analysis

Quiz
•
Information Technology (IT)
•
University
•
Medium
Ma Gonzales
Used 1+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the key principle of a greedy algorithm?
Explore all possible combinations
Always pick the global optimum
Make the best local choice at each step
Use recursion to reduce steps
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following problems can be solved optimally using a greedy algorithm?
0/1 Knapsack
Activity Selection
Traveling Salesman
Longest Common Subsequence
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the greedy choice in the Coin Change Problem using denominations of 1, 5, and 10 to make 27?
Use only 1s
Use only 5s
Use as many 10s, then 5s, then 1s
Use 3 × 9 coins
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Why does the Huffman coding algorithm follow the greedy approach?
It picks the longest string first
It chooses the lowest frequency characters first
It tries all possible encodings
It encodes based on the alphabet
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a common feature of problems that work well with greedy algorithms?
The problem requires backtracking
The solution must be recursive
The problem has an optimal substructure
It needs matrix multiplication
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the time complexity of a function that runs a single loop over a list of `n` elements?
O(1)
O(n)
O(log n)
O(n²)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which time complexity grows the fastest as input size increases?
O(n)
O(log n)
O(n log n)
O(2n)
Create a free account and access millions of resources
Similar Resources on Wayground
13 questions
Session 15 + 16 : Function

Quiz
•
University
14 questions
hashmap

Quiz
•
University
17 questions
Kiểm Tra Môn Tin Học 10

Quiz
•
10th Grade - University
20 questions
C & Python Programming Quiz

Quiz
•
University
15 questions
Data Structure tree and graph

Quiz
•
University
10 questions
CS102 session3

Quiz
•
University
20 questions
1. Polecenia systemowe szczegółowe Linux pliki, katalogi, pomoc

Quiz
•
11th Grade - University
12 questions
Aula07 - Matrizes

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Information Technology (IT)
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University