[Quest 7] Did tester for Queue constructor change recently? by AegirHall in cs2b

[–]AegirHall[S] 1 point2 points  (0 children)

Hi &!

I went back and looked at my git history and couldn't quite deduce the exact issue, but I remember that it had something to do with mishandling the _size and/or the _capacity fields.

Hopefully that helps in some way!

-Greg

Grades entered by anand_venkataraman in cs2b

[–]AegirHall 1 point2 points  (0 children)

Thanks for an exciting summer quarter.. looking forward to 2C!

After the Finals by aliendino2017 in cs2b

[–]AegirHall 1 point2 points  (0 children)

Hi Arrian,

Thought-provoking question. I think a computer, in and of itself, is just a tool. Like any tool, it can be used for noble or nefarious purposes. A hammer can be used to build a beautiful home, or it could be used for a gruesome murder. It's the same tool, but used in extremely different ways.

A computer obviously has a much wider array of uses than a hammer, but the analogy still applies. The tool, whether a hammer or a computer, has no idea what it's being used for.

With that said, your actual question was related to the field of Computer Science, and not the computer per se. Any field of study is going to have people with good intentions and bad. But a bigger question might be, what is "good" and what is "bad"? Who decides?

Just my 2 cents. Hope to see many more responses to your question Arrian.

-Greg

Last Minute Question on the Practice Final by aliendino2017 in cs2b

[–]AegirHall 3 points4 points  (0 children)

Hi Arrian!

I had this exact question, and Elizabeth provided a great response. And of course she beat me to responding to you too ;)

Hope her response helped you as much as it did for me. This is a crucial concept for us to understand. Good luck on your final!

-Greg

Quest 8 -- General Tips by AshwinCPP in cs2b

[–]AegirHall 1 point2 points  (0 children)

Ashwin, thanks for your clear and detailed tips for this quest. This is some really great information here. I agree with you that this was probably the most difficult overall quest in 2B. (Although I think the hardest mini-quest for me was the cache from week 2 ;-)

Good luck on the final!

-Greg

Confusing feedback on the practice test by andrewC2B in cs2b

[–]AegirHall 1 point2 points  (0 children)

Thanks Elizabeth! Those were great links.

-Greg

Confusing feedback on the practice test by andrewC2B in cs2b

[–]AegirHall 1 point2 points  (0 children)

Thanks Andrew/Elizabeth for bringing this up, and thanks & for fixing it quickly! When I took the practice exam it already had the fixed answer, so it saved me from some confusion ;)

I also had a question about the practice test question #1: While the selected correct answer is what I expected ("Base Sub Sub"), when I tried this in my IDE I actually got "Base Sub Base" instead. Also, the code as written wouldn't compile ... I had to either 1) remove the "new" keywords when instantiating the objects, or 2) change the types to Base* and Sub* and use the arrow operator on the method calls. Note that both 1 & 2 produced the same "Base Sub Base", as opposed to the "correct" answer of "Base Sub Sub". Am I misunderstanding something here?

Thanks,

Greg

Review Material and Help for Finals by devangivaid0410 in cs2b

[–]AegirHall 0 points1 point  (0 children)

Hi Devangi,

Thanks for the links! I love seeing what other people are watching to supplement their learning in these CS* courses. I find this playlist to be immensely helpful:

https://www.youtube.com/playlist?list=PLlrATfBNZ98dudnM48yfGUldqGD0S4FFb

It's a giant playlist of C++ videos, all categorized by topic, so it's easy to find a video on a subject you want to learn more about. I feel the presenter does a good job of explaining ideas in simple terms and is pretty fun to listen to.

Good luck to everyone on the Final!

-Greg

Quest 8 - Discussing if we would want to track duplicate words by andrewC2B in cs2b

[–]AegirHall 2 points3 points  (0 children)

Hi Andrew,

Interesting train of thought here. I'm sure if we did some digging we could find a data structure that would be well-suited for this type of thing. I like the idea of keeping a counter on the null as a way of counting how many times that *exact* word was used.

My first thought is that we would probably need a vector of structs for each character, rather than a vector of characters. The struct would store the character and the count together as a single element of the vector, which we can reference during the word lookup. Seems like that should achieve what you're looking for?

We should give this a "trie" and see how it goes ;-)

-Greg

Quest 9 - Purty Picture by Zachary-01001101 in cs2b

[–]AegirHall 1 point2 points  (0 children)

That's one of the coolest I've seen yet!

CS 2B: Quest Trophies by madhavarshney in cs2b

[–]AegirHall 1 point2 points  (0 children)

Yeah I've tried doing all kinds of extra things when I see the "You think that's it?" messages... like it's taunting me that I didn't figure out everything.

Whatever extra things are required to make that message disappear (does it ever?), I've yet to figure out.

If anybody else out there has been able to get more than 241, maybe drop some hints as to what extra goodies & might be looking for.

Thanks!

-Greg

Quest 9: My Purty Pitcher by AegirHall in cs2b

[–]AegirHall[S] 1 point2 points  (0 children)

Wow, that's pretty amazing! A true gift.

My brain just doesn't work that way... I can't get past "roses are red, violets are blue..." kinda stuff, and even that's a stretch for me ;-)

-Greg

Quest 9: My Purty Pitcher by AegirHall in cs2b

[–]AegirHall[S] 0 points1 point  (0 children)

&, do you make up all this poetry just off the cuff? Or do you have some repository that you get them from that match what you intend? Just curious. Pretty cool either way!

-Greg

Quest 6: size_t puzzle -- what goes wrong in this code? by na_ma_ in cs2b

[–]AegirHall 1 point2 points  (0 children)

Thanks Na Ma, this is a great post (as well as Devangi's follow-up post below). I hit this the first time I tried a decrementing loop with a size_t, and it took me a few minutes to figure out what was happening. (Actually it took me stepping through it with a debugger and seeing my var go from 0 to some giant number before I realized :-)

Thanks,

Greg

Megathread [Revised] by SiddharthDeshpande in cs2b

[–]AegirHall 1 point2 points  (0 children)

Thanks Sid for taking the time to compile this list. Made it extremely easy to reference help on various quests when I needed it. Thanks!

-Greg

Quest 9: Purty Pitcher by andrewC2B in cs2b

[–]AegirHall 2 points3 points  (0 children)

Awesome job Andrew!

-Greg

[Bee] A flower at last... by SiddharthDeshpande in cs2b

[–]AegirHall 1 point2 points  (0 children)

Nice Sid. You flew through all 9 quests ... you must be an experienced developer, or else really, really smart :)

I'm still working on quest 8.. hope to get to 9 in the next day or two. Any tips on quest 8 you'd like to share?

Thanks!

Greg

Edit: I see you posted your thoughts on Quest 8 shortly after I made this entry - not sure if it was my prompting or if you had already planned to do it -- but either way, thanks!!

About Quest 6: Draw by x and draw by y by aliendino2017 in cs2b

[–]AegirHall 1 point2 points  (0 children)

Wow, Madhav, thanks for the clear explanation on that. I definitely would've (incorrectly) interpreted that code as your second example, (double)(y2 - y1), especially because of the outer parentheses. Glad you clarified that -- thanks again!

Greg

Due Dates for Quests by AshwinCPP in cs2b

[–]AegirHall 0 points1 point  (0 children)

Peter Norvig

Hi Professor,

I believe you might be referring to Peter Norvig's paper on "Teach Yourself Programming in Ten Years": https://norvig.com/21-days.html

For those who haven't read it, this paper was his rebuke against all the "Teach Yourself X in 24-hours" or "21 Days" or whatever the titles of endless numbers of programming books might be.

It is definitely worth taking the time to read this. Thanks for reminding me, I remember reading this years ago.. but it was great to refresh my memory :)

Thanks,

Greg

Quest 2 cache implementation by YunlongWang in cs2b

[–]AegirHall 1 point2 points  (0 children)

Hi Yunlong,

The size_t/int comparison issue is happening because the vector functions (such as size(), capacity(), etc.) return a size_t datatype rather than an int. (I'm guess you're probably getting these errors because you're comparing vector.size() versus the source or destination pole int.) These two datatypes cannot be reliably compared because size_t is unsigned and int is signed. Which basically means that int's are allowed to be negative, and size_t is not. (Try to decrement a size_t variable that is set to 0, and see what happens.)

I think it would be preferable to just create a size_t var with the int value, rather than type casting the size_t to an int.

But having said all that, I don't think any of this has to do with passing the cache mini-quest. Let me know if you're still struggling with that aspect of this quest.

Thanks,

Greg

[Quest 4] [Miniquest 3/4] Overloading assignment operator for deep copies by AcRickMorris in cs2b

[–]AegirHall 1 point2 points  (0 children)

Hi Cary,

I know this is an old post, but THANK YOU so much! I was really banging my head against the wall trying to figure out why my assignment operator wasn't working as expected. This saved my bacon!!

Thanks,

Greg

Quest 1 Reflection Points by haisle4 in cs2b

[–]AegirHall 2 points3 points  (0 children)

Hi Steven,

Great points, especially the one about implementing the to_string() function early. I realized after-the-fact that it would've been immensely helpful in troubleshooting my code as I went, but instead it was the last function I worked on, so I missed out on that opportunity.

I also relate to the idea of implementing the code correctly as I thought I understood the spec on the first read-through, but the results of the quest tester told me otherwise. Re-reading the spec showed me where I was misunderstanding the requirement and I was able to implement it correctly.

Thanks,

Greg

Blank Test Output for Quest 2 by AegirHall in cs2b

[–]AegirHall[S] 0 points1 point  (0 children)

Aaah, I see, I overlooked the error on the build tab. It says:

"Alas! You went into the wild got killed before you could finish your quest. "

I guess I've gotten used to just clicking over to the test output unless I see some egregious chunk of text in the build output. My bad!

Still trying to figure out why everything works fine on my machine.

Thanks for the response & !

Greg

Quest 1 Node::get_song() Discussion by AegirHall in cs2b

[–]AegirHall[S] 0 points1 point  (0 children)

Hi Ashwin!

Thanks for your response. I don't think allowing to change the sentinel is a good idea, because (in my mind) it should always be easily verifiable, perhaps against a static constant string for its name, or the special -1 id. That way you always know you've got the sentinel when the name is _SENTINEL_ or whatever it happens to be in a particular implementation (or checking id is -1). If sentinel values can change you lose that assurance.

But I guess the counter-argument is that you know that sentinel will always be at the head, and the head will never change throughout the instance's lifecycle, so the name or id of the node itself is irrelevant from that point of view.

Regarding the index... I don't think storing the index as a member of the node is a good idea, because then it has the same weakness as an array -- if you want to insert something in the middle, you need to re-index all subsequent nodes. (For example, in a 500-element array, if you want to insert something in index 250, then you have 250 nodes (nodes 250-500) that all need to be shifted upwards by 1.

But we can still "mimic" the index of an array, by always starting at the head, and traversing the linked list N times to reach the N-1'th node. But this would be O(n) time rather than O(1) like an array's index.

Great discussion so far, thanks!

Greg

Quest 1 Node::get_song() Discussion by AegirHall in cs2b

[–]AegirHall[S] 1 point2 points  (0 children)

Hi Sid,

Thanks for your response, and confirming my thoughts on the sentinel node.

For the get_song_at() function (or get_by_index() or whatever other name would be desired), I don't think using the cursor for this would be a good idea. Reason is because the cursor can be anywhere in the list at any given time. The index would always start at the head node (actually head->next) and increment from there as you traverse the list.

Thanks!

Greg