Week 8 Day 1 - Templates

Channel:
Subscribers:
2,750
Published on ● Video Link: https://www.youtube.com/watch?v=cmK2aJfvfUE



Duration: 1:18:47
109 views
1


Today we talked a bit about the homework assignment, with some ideas on how you should sort a linked list (not efficiently, but well enough to get the homework done).


We then ran through some examples of using stacks. Stacks are a LIFO (last in first out) data structure. Really simple, can be implemented in a heartbeat, but used in a lot of different places in computer science.


Finally, we talked about templates - which is to say, being able to create functions and classes where you can specify the type at a later date. This allows you to write a function or data structure once, rather than once for every type. You use angle brackets to specify which type the class or function can use, and C++ can sometimes deduce the type as well, so you don't need to type it at all.







Tags:
csci 41
stacks
templates