Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make solutions more compact #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

setop
Copy link

@setop setop commented Apr 12, 2023

  • variable are implicitly initialized to 0 or ""
  • NR == 1 represents the header line

@fxj9a
Copy link

fxj9a commented Apr 12, 2023

Awesome solutions. The changes look great! However, since this repository is geared towards learners, I appreciate the more verbose nature of the current version in master to provide additional context and clarity.

For some of the advanced solutions I would need more explanation :D

I also appreciate your solution for 16b (median, "extra credit"), which -- despite incomplete definition, has the correct solution in this case.
You get the number of values plus the header which works for an uneven number of values, however,
for an even number of values n you would have take the average of the middle numbers: (value[n/2] + value[(n/2)+1] )/2
It's up for discussion if it's enough to have the solution for the data at hand or if a general solution is needed.
IMO it's better to have an incomplete solution than none at all ;)

@setop
Copy link
Author

setop commented Apr 14, 2023

Thanks for the reply.

However, since this repository is geared towards learners, I appreciate the more verbose nature of the current version in master to provide additional context and clarity.

Totally agree.

For the story, I was looking for advanced AWK material when I come to this repo. AWK saved my life as an engineer so many times ...

For some of the advanced solutions I would need more explanation

Sure, with pleasure ! Which ones ?

however, for an even number of values n you would have take the average of the middle numbers

Ah, nerd trap ! Now I have to fix this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants