You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does the self-assignment mean you're working on it? Otherwise I'll give it a try.
Yes, I have started to add some basic files, but have not yet done more (the instruction are taken from the Go track). Feel free to add more.
One of the thoughts I wanted to discuss was the split with .cpp and header files. And if we should move the "easy" exercises to "cpp-only" to nudge the students slowly to that topic on later exercises that need more organization.
push(), pop(), unshift(), and shift() are mandatory, delete() and count() are optional. Do we want them?
I'd vote yes but then we need an additional markdown file that describes them, similarly to the description of the mandatory functions.
The tests leave it to the tracks whether delete() should return the first or last matching element (or leave it unspecified). What do we want? I'd vote first.
Do we want other C++-specific things? Should the linked-list class be a class template? Do we want iterators? Do we want an exception if pop() or shift() get called on an empty list? Should count() be named size()? Tracks are allowed to add/change things when its reasonable and idiomatic.
Attached is a Python script create_tests.txt that reads the canonical-data.json (from the problem-specification repository) and prints the contents of the linked_list_test.cpp. (It ends with .txt because GitHub does not allow attaching .py files.)
I think delete() is pretty interesting because you have to put in some more thoughts than just dropping elements. In my opinion, it should return the first match.
count() might be nice, but I don't think it adds a lot.
Iterators, class templates and exceptions should depend on where the exercise is placed in the syllabus tree. We should not add all to make it not too complex. Unless we implement simple-list as well?
You do make some very good points. I think we should definitely do a simple-linked-list first. The way I see it, it is intended to have elements with int-data, push, pop, size, reverse and an array conversion. That would pave the way to have the "advanced" version as class template with iterators. What do you think @siebenschlaefer?
I just wanted to list these considerations explicitly so that others can weigh in.
I'm completely fine with a simple non-template LinkedList class without exceptions that has these six methods.
From a mentoring perspective I expect the conversations to the about memory management (naked new and raw pointers versus smart pointers a non-recursive deletion), about the general approach of the implementation (first/last pointers or a dummy node), and about helper functions/DRY. At least that's my experience for the linked-list exercise on the C track.
That's very valuable insight. As the memory aspects with pointer management can be a bit intimidating, the related exercises should not do much else.
But, with the memory management questions mostly answered with the simple-list, we could dive into a nice iterator solution and make them useful via templates.
Activity
siebenschlaefer commentedon Mar 1, 2023
Does the self-assignment mean you're working on it?
Otherwise I'll give it a try.
vaeng commentedon Mar 1, 2023
Yes, I have started to add some basic files, but have not yet done more (the instruction are taken from the Go track). Feel free to add more.
One of the thoughts I wanted to discuss was the split with .cpp and header files. And if we should move the "easy" exercises to "cpp-only" to nudge the students slowly to that topic on later exercises that need more organization.
siebenschlaefer commentedon Mar 1, 2023
Some notes:
push(),pop(),unshift(), andshift()are mandatory,delete()andcount()are optional. Do we want them?I'd vote yes but then we need an additional markdown file that describes them, similarly to the description of the mandatory functions.
delete()should return the first or last matching element (or leave it unspecified). What do we want? I'd vote first.pop()orshift()get called on an empty list? Shouldcount()be namedsize()? Tracks are allowed to add/change things when its reasonable and idiomatic.Attached is a Python script create_tests.txt that reads the
canonical-data.json(from the problem-specification repository) and prints the contents of thelinked_list_test.cpp. (It ends with.txtbecause GitHub does not allow attaching.pyfiles.)vaeng commentedon Mar 1, 2023
I think
delete()is pretty interesting because you have to put in some more thoughts than just dropping elements. In my opinion, it should return the first match.count()might be nice, but I don't think it adds a lot.Iterators, class templates and exceptions should depend on where the exercise is placed in the syllabus tree. We should not add all to make it not too complex. Unless we implement simple-list as well?
Thanks for the script! That seems super handy.
vaeng commentedon Mar 1, 2023
You do make some very good points. I think we should definitely do a
simple-linked-listfirst. The way I see it, it is intended to have elements with int-data, push, pop, size, reverse and an array conversion. That would pave the way to have the "advanced" version as class template with iterators. What do you think @siebenschlaefer?siebenschlaefer commentedon Mar 1, 2023
I just wanted to list these considerations explicitly so that others can weigh in.
I'm completely fine with a simple non-template
LinkedListclass without exceptions that has these six methods.From a mentoring perspective I expect the conversations to the about memory management (naked
newand raw pointers versus smart pointers a non-recursive deletion), about the general approach of the implementation (first/last pointers or a dummy node), and about helper functions/DRY. At least that's my experience for the linked-list exercise on the C track.vaeng commentedon Mar 1, 2023
That's very valuable insight. As the memory aspects with pointer management can be a bit intimidating, the related exercises should not do much else.
But, with the memory management questions mostly answered with the simple-list, we could dive into a nice iterator solution and make them useful via templates.
vaeng commentedon Mar 2, 2023
I added a new PR for the simple-linked-list: #570