Logo

Programming Abstractions - Shared screen with speaker view
James Van Kirk
12:32
shuffled deck of cards
Ilies Ghanzouri
28:20
Is there also N stacks for N disks? If yes, can we solve it with less than N disks (is there a global minimum)
Nick Bowman (he/him)
28:35
There is always 3 stacks (source, auxiliary and destination)
Nick Bowman (he/him)
29:10
That’s how the game is defined – with N disks you would just start with N disks on source at the beginning of the game and then try to move them all to destination while following the constrains of the game
Abrar Alshaikh
40:15
using the stringSplit function, are we taking into account the commas and the fullstops?
Jin-Hee Catherine Lee
40:32
Wooooooo YEAH!
liang wang
40:39
In what order was Set<> stored?
Nick Bowman (he/him)
40:51
No, since we’re only splitting on spaces, we would not take commas or other punctuation into consideration
Jin-Hee Catherine Lee
40:52
(BTW Kylie’s code example looked *super* useful for assignment 2 :O)
James Noh
41:10
What does “break” do again? Does that just end the function when the user presses RETURN?
Nick Bowman (he/him)
41:45
@Liang for now, our understanding is that Sets don’t store their contents in any particular order, but we will dig further into this later in the quarter
john ren
42:00
if we iterate through the set multiple times, will we get the identical result each time?
Nick Bowman (he/him)
42:04
Break is a keyword that exits the current loop that you’re in
Nick Bowman (he/him)
42:09
@John ,yes we will
cecile loge
42:26
Aren’t sets “ordered” by alphabetical / increasing order? When you do the for each loop?
Nick Bowman (he/him)
43:03
The reason why is (as I alluded to earlier) there is some organization to how data is stored on the implementation side of the Set. We will discuss what that organization looks like later in the course when we actually implement our own set
Nick Bowman (he/him)
44:02
@Cecile yes iterating over the elements of a stanford Set containing strings you will give you the elements in a lexicographical order – this is a consequence of the underlying storage structure (binary search trees) which we will discuss in the back half of the course!
cecile loge
44:24
Oh cool! Thx! :)
Nick Bowman (he/him)
44:28
However, we avoid saying that sets are “ordered” specifically because they do not support a notion of indexes or retrieval by index
cecile loge
44:58
Yes, I see!
Minh
46:42
Can we do Map<Vector, Vector>?
Minh
47:41
Thanks!
Carl Schoeller
49:25
If I initialised a map as map<string&, string>, could I modify the keys?
Nick Bowman (he/him)
50:00
I don’t believe you can use a reference as the key type of a Map, but you can try compiling it in a sample project and see what happens.
cecile loge
58:14
How would we print the 10 most common words?
Nick Bowman (he/him)
59:08
Not as easy as in Python :)
Carl Schoeller
01:06:19
If it were Vector<string>& times = feedingTimes[“lumpy”], would that work?
Nick Bowman (he/him)
01:06:52
Yes, that would work, although in this class we’ll try to avoid using references outside the context of parameter passing as they can get complicated quick.
Nick Bowman (he/him)
01:07:22
To clarify, this would work because you would store a reference to the vector stored in the map, rather than making a copy of the contents of the vector.
cecile loge
01:10:17
Does const without & make any sense?