ordered_structures_flashcards

1
Q

What is an ordered structure?

A

A collection of elements where order matters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do ordered structures differ from sets?

A

In ordered structures, element arrangement matters, whereas in sets, order is irrelevant.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an n-tuple?

A

An ordered list of n elements.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is a tuple different from a set?

A

A tuple considers order, while a set does not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Give an example of a 3-tuple.

A

(a, b, c) where order is important.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a list?

A

A sequence of elements where duplicates and order are allowed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between a list and a tuple?

A

Lists are often used dynamically in programming, while tuples are fixed-size ordered structures.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Give an example of a list.

A

[2, 3, 5, 7] (a list of prime numbers).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a string?

A

A sequence of characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is an example of a string?

A

“hello” is a string with five characters.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a formal language?

A

A set of strings following specific rules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a relation?

A

A set of ordered pairs (a, b) where a is related to b.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Give an example of a relation.

A

“is less than” on natural numbers: (2,3), (3,5), etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are common properties of relations?

A

Reflexivity, symmetry, transitivity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How many 2-tuples can be formed from a set with 3 elements?

A

If order matters, there are 3 × 3 = 9 possible tuples.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How many 3-tuples can be formed from a set {a, b, c}?

A

3 × 3 × 3 = 27 different 3-tuples.

17
Q

What are key takeaways about ordered structures?

A

Tuples, lists, and strings have fixed order, relations define relationships, and counting tuples depends on available choices.