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

New exercise: organize a Queue from 2 Stack's #623

Closed
ybod opened this issue Mar 3, 2017 · 10 comments
Closed

New exercise: organize a Queue from 2 Stack's #623

ybod opened this issue Mar 3, 2017 · 10 comments

Comments

@ybod
Copy link

ybod commented Mar 3, 2017

I want to introduce new exercise where You have access to only one data structure: Stack. And the task is to implement Queue using only 2 Stacks as efficiently as possible.

I can make such exercise for C#, and also try to do something for JS and Elixir I think...

@NobbZ
Copy link
Member

NobbZ commented Mar 3, 2017 via email

@petertseng
Copy link
Member

Oh interesting!

  • I imagine it will be hard to test that the student's submission is implemented only with the two stacks and efficiently (rather than cheating and using a queue from the language's standard library)
    • But that is okay, that is for reviews
    • binary-search and sieve deal with the same: they talk about specific implementations, but it's hard to enforce
    • If one really wanted to enforce efficiency of course one could keep access counters to the stacks (see Lua's TracedArray for binary-search tests)
  • If we come up with a way to group related problems (as in Should the existing text-based exercises be merged? #326) we should consider grouping this new exercise, binary-search-tree, custom-set, linked-list, simple-linked-list, zipper, maybe list-ops as well.

@ybod
Copy link
Author

ybod commented Mar 7, 2017

@NobbZ I'm not sure about Okasaki, need to find some time to read this paper. But I solved this task as a part of one of my interviews :) and I believe the implementation can be challenging.

@petertseng Yes, we cannot guarantee that user implementation will be based on Stack. But there are some other tasks that require You to implement some functionality already presented in standard libraries yourself. So I think it's pretty normal do describe all limitations in the README. I'm not sure that we should limit a number of Stacks. Maybe the requirement of using only particular data structure will be enough?

@NobbZ
Copy link
Member

NobbZ commented Mar 7, 2017 via email

@ybod
Copy link
Author

ybod commented Mar 10, 2017

@NobbZ Yes, than we are talking about Okasaki queue for sure. Because that was the "optimal" implementation with 2 stacks I was talking about! The problem is that if we provide the description of Okasaki queue in the task README than we will literally give the key to solution of the problem :) So task must be formulated something like: "implement a queue utilizing only list/stack data structure" (depending on the language)?

@NobbZ
Copy link
Member

NobbZ commented Mar 10, 2017 via email

@rbasso
Copy link
Contributor

rbasso commented Mar 11, 2017

This seems related to exercism/discussions#124.

@ybod
Copy link
Author

ybod commented Mar 13, 2017

So according to @rbasso comments we should not introduce the problems like this into Exercism at all?
Because it's not very practical, doesn't allow the freedom of implementation and can not show any practical ways of applying stacks...

@rbasso
Copy link
Contributor

rbasso commented Mar 13, 2017

So according to @rbasso comments we should not introduce the problems like this into Exercism at all?

I just argued - in an issue that someone else opened - that instantiating theoretical problems in more concrete contexts usually make the exercises more interesting. It believe this approach could also motivate some people to learn computer science.

Because it's not very practical...

That was not my argument.

... doesn't allow the freedom of implementation

I think that this kind of exercise usually fells more restrictive than others that just state a goal, without specifying how to solve it. The former usually results in less diverse solutions and less reviews.

... and can not show any practical ways of applying stacks...

I'm not saying that!

Maybe it is possible to come up with a good story to motivate this exercise. Who knows?!

But that was just my opinion! I have no desire to force my will on anyone. 😄

Finally, I mentioned that issue here so that people could be aware of the discussion. I had no intent to dissuade anyone from creating a new exercise.

emcoding pushed a commit that referenced this issue Nov 19, 2018
@ErikSchierboom
Copy link
Member

This issue has been stagnant for quite a long while. I'm therefore closing this. If anyone feels like they want to continue working on this, feel free to reopen.

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

No branches or pull requests

5 participants