?

Log in

No account? Create an account
AlbertJayNock

The Beatles And Data Structures

I've begun teaching stacks in my data structures class. Today I was going over the implementation of a stack using an array, and I used a small stack of strings for my example. I went through several push and pop operations, showing  the contents of the array as well as the index to the top of the stack were everytime.

The first three operations were

push("John")
push("Paul")
push("Stu").

Then I did a pop, removing Stu from the stack. The next operation was

push("George").

I almost had enough for a quartet. A drummer was needed, so I showed them the results of 


push("Pete").

Pete didn't work out, so the next two operations were 

pop()
push("Ringo")


I asked them if they recognized the names in the stack. Everybody did, and a few seemed irritated with my question. It wasn't an unreasonable one though. At my age, I am never quite sure how wide the generation gap is. And a few years ago, I saw a piece in the school paper where "Come Together" was referred to as an Aerosmith song!!! Judging from my response,the author of that piece was an anomaly. 

Of course, the main point of the lecture was for them to understand how stacks are implemented. So it's OK if they didn't recognize the names of the Beatles, much less know who Stu and Pete were.

Just to make sure they were thoroughly  exposed to the material, I did one more operation. So I showed the results of 

push("Billy")

adding "Let's just go ahead and make Billy Preston the fifth Beatle".

Comments