Set Flashcards

1
Q

What is an ADT Set?

A

A container.

In which:

  • the elements are unique
  • the order of the elements is not important (there are no positions)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the representations for an ADT Set?

A

Dynamic Array specific representations:
(R3) if the elements of the set are numbers,
the elements are represented by the positions in the dynamic array &
a boolean value from that position shows if the element is in the set or not

*when indexing starts from 1,
the element in the dynamic array that is on position i:
⇒ the element at position: minimum + i − 1
⇒ position of an element e: e − minimum + 1

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

What is the domain for an ADT Set?

A

Domain

S = {s|s is a set with elements of the type TElem}

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

What are the operations on an ADT Set?

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

What is an ADT SortedSet?

A

A Set.

The elements are ordered based on a relation.

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

ADT Set vs ADT SortedSet

A

Modification in the interface:

  • for a SS, the init operation receives a relation as a parameter
  • for a SS, the iterator has to iterate through the elements in the order given by
    the relation, so we need to keep them ordered in the representation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly