Looking for IN1002 Introduction to Algorithms (PRD2 A 2024/25) test answers and solutions? Browse our comprehensive collection of verified answers for IN1002 Introduction to Algorithms (PRD2 A 2024/25) at moodle4.city.ac.uk.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Consider the language of all strings consisting of some number of as followed by the same number of bs, e.g. , ab, aabb, aaabbb, and so on.Which of the following is true?
Consider the context-free grammar S:S a S b S | b S a S |
Which of the following strings does not belong to the context-free language described by S?
Assuming the alphabet { a, b }, which of the following regular expressions does not describe the set of all strings containing at least one b?
Consider the following finite state machine:
Which of the following strings does not belong to the language recognized by this machine:
Consider the following finite state machine:
What state is reached after scanning the string "babbba''?
Which of the following problems is undecidable?
Suppose it is proven that P != NP.
Which of the following would then be a consequence?
What is the time complexity of the following algorithm?
Shift(a[0..n-1])i ← 0
sum ← 0;
WHILE i < n
sum ← sum + a[i]
i ← i+1
average ← sum / n
i ← 0
WHILE i < n
a[i] ← a[i]-average
i ← i+1
What is the time complexity of an algorithm that calls an O(n2) method, an O(n log n) method and then an O(2n) method?
Suppose that sequential search is called 100 times.
What is the worst-case time complexity of these 100 calls?