logo

Crowdly

Browser

Add to Chrome

IN1002 Introduction to Algorithms (PRD2 A 2024/25)

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. epsilon, ab, aabb, aaabbb, and so on.

Which of the following is true?

0%
0%
0%
0%
0%
View this question

Consider the context-free grammar S:

S rightwards arrow a S b S | b S a S | epsilon

 

Which of the following strings does not belong to the context-free language described by S?

0%
0%
0%
0%
View this question

Assuming the alphabet { a, b }, which of the following regular expressions does not describe the set of all strings containing at least one b?

View this question

Consider the following finite state machine:

A finite state machine with 5 states:   Q0 is the start state.  Q2 and Q4 are accept states.  From q0 an a input transitions to q1. From q0 a b input transitions to q3.  From q1 an a input transitions to q1. From q1 an b input transitions to q2.  From q2 an a input transitions to q1. From q2 a b input transitions to q2.  From q3 an a input transitions to q4. From q3 an b input transitions to q3.   From q4 an a input transitions to q4. From q4 a b input transitions to q3.

Which of the following strings does not belong to the language recognized by this machine:

0%
0%
0%
0%
0%
View this question

Consider the following finite state machine:

A finite state machine with 5 states:   Q0 is the start state.  Q2 and Q4 are accept states.  From q0 an a input transitions to q1. From q0 a b input transitions to q3.  From q1 an a input transitions to q1. From q1 an b input transitions to q2.  From q2 an a input transitions to q1. From q2 a b input transitions to q2.  From q3 an a input transitions to q4. From q3 an b input transitions to q3.   From q4 an a input transitions to q4. From q4 a b input transitions to q3.

What state is reached after scanning the string  "babbba''?

View this question

Which of the following problems is undecidable?

0%
0%
0%
0%
0%
View this question

Suppose it is proven that P != NP.

Which of the following would then be a consequence?

View this question

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

0%
0%
0%
0%
View this question

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?

0%
0%
0%
0%
View this question

Suppose that sequential search is called 100 times.

What is the worst-case time complexity of these 100 calls?

View this question

Want instant access to all verified answers on moodle4.city.ac.uk?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome