Week 10 Flashcards

1
Q

What comes in to the uniq program?

A

Either stdin or a file. Both treated the same once the file is open

Filename is identified as the sole parameter that uniq might accept

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

What transformations do I need to make to the data in the uniq program?

A

No changes needed to the data

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

What part of the data is processed right away?

A

I can print each line of text if it is different from the preceding line

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

What part of the data do I need to keep longer?

A

I need to remember the last processed line of the file

I need to compare that line with a new line

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

What goes out of the program?

A

All output to stout. Print each line that isn’t the same as the one before.

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

Uniq program: What assumptions can I make?

A

Are any given? Zero or one arguments of the program. Problem speaks of lines of the file, so we’ll infer line-based text input.

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

Uniq program: Can I reasonably make any of my own assumptions?

A

Maximum line length. Set to 80 characters.

All characters will be printable.

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

What constraints exist for uniq program?

A

Full program in C

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

Are there strange cases to handle in uniq program?

A

Empty file

One line in the file (so nothing to compare against)

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

What is important for the solution to do for uniq?

A

Single-pass of the file so hat it can be used with a pipe if necessary.

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