**Heads up!** To view this whole video, sign in with your Courses account or enroll in your free 7-day trial.
Sign In
Enroll

Start a free Courses trial

to watch this video

# Intro to Computer Science with Vaidehi Joshi

24:22 with TreehouseComputer science is a crucial skill for developers. However, you don't need a computer science degree to work as a developer. In this video, Vaidehi introduces computer science concepts and discusses her path to tech without a computer science degree.

Presentation Slides (Right Click + Save Link As):

I'd like to welcome up our first speaker of the day. 0:04 She is a senior engineer at Dev, where she builds community and 0:08 helps improve the software careers of millions. 0:13 She enjoys building and breaking code, 0:17 though loves creating empathetic engineering teams a whole lot more. 0:19 She is the creator of BaseCS and BaseDS, two writing series exploring 0:24 the fundamentals of computer science and distributed systems. 0:29 She also co-hosts the BaseCS podcast, and 0:34 is the producer of the BaseCS and Byte Size video series. 0:38 Please welcome Valdehi Joshi. 0:44 Thank you. 0:47 >> I'm so excited to be speaking at the Treehouse festival and 0:49 to be here with all of you. 0:52 And I'm especially excited to be sharing a little bit about one of my 0:54 favorite topics, computer science. 0:58 So, a little bit about me to start. 1:01 I'm a senior software engineer at Forem, the open source software that powers Dev. 1:04 And I also think it's worth mentioning that I did not go to school for 1:09 computer science and I don't have a CS degree. 1:13 In fact, my degree is in English. 1:16 So I learned to code at a boot camp about six years ago, and 1:19 I have been working professionally in the tech industry ever since then. 1:22 And when I was first learning to code, 1:27 I didn't really know what computer science was. 1:29 It was only when I started interviewing for 1:33 my second engineering role that I started to hear a few computer science terms and 1:35 concepts being thrown around and they came up in technical interviews. 1:40 And in these technical interviews, 1:45 I started to realize that these concepts were coming up again and again. 1:47 And I didn't really know that much about what people were talking about. 1:51 I didn't really know the terminology and the jargon that they were using. 1:55 And it was that experience that made me want to learn more about computer science, 1:59 and it made me want to fill in those gaps in my knowledge. 2:05 I'm someone who really doesn't like being out of the loop and 2:09 not knowing what's going on. 2:11 So that was pretty good motivating factor. 2:13 And when I decided that I wanted to fill in those gaps in my knowledge, 2:17 I decided that the easiest way to do that would just be to teach myself 2:22 computer science, which is a pretty bold idea but definitely doable. 2:27 A lot of people have done it. 2:32 And the way that I went about doing this was sort of creating a schedule for 2:33 myself and I decided that for a whole year, I was going to learn 2:39 one new computer science concept every single week for the entire calendar year. 2:44 And I decided that I was going to write about every new concept that I 2:51 was learning during that year too. 2:55 And the culmination of this project was something called BaseCS, 2:58 a year long writing series that included all of the computer science 3:03 topics that I taught myself throughout that year. 3:07 So if you've ever heard CS terms or concepts being used in a conversation and 3:11 find yourself nodding along, but you didn't really know that much about them, 3:17 fear not because you're not alone. 3:23 And that is exactly the way that I started out too. 3:25 And my hope is that by the end of this talk, 3:30 you'll have a better sense of what computer science is, and some of 3:33 the core concepts within the fields and how to go about learning it too. 3:38 And the other thing I wanna note is that it's impossible 3:43 to cover everything about computer science in just 25 minutes. 3:46 It's a huge field and 25 minutes is really not a long time. 3:50 But hopefully, this is going to be a helpful first step in your 3:54 journey in learning more about computer science. 3:59 So let's start with the basics. 4:03 What on Earth even is computer science? 4:06 Well, if you look up the definition of the field, you'll see that 4:09 computer science is defined as the study of computation and information. 4:14 If we look up the definition of computer science, 4:20 we can see that it's actually not just one field, there's all these subfields and 4:24 specific discrete topics within that field too. 4:29 But in my opinion, computation and information, 4:33 those two words really do encompass the way that I think about computer science. 4:37 If you think about it, computation really just means calculation. 4:43 And information really just means data. 4:50 Computer science is a combination of making calculations and dealing with data. 4:56 If you look at CS with this lens, with this perspective, 5:03 you start to see that understanding some fundamentals of computer science helps 5:08 us think about and interact with and manipulate information and data. 5:14 And oftentimes, we're making calculations about that data and 5:19 figuring out how to modify it to fit our needs. 5:25 Now, if you're learning to code, it can be hard to know how these two things, 5:29 computation and information, how they fit into your life. 5:35 And that can make it hard to know where to start learning computer science. 5:41 But the reality is that you've probably already thought about both 5:45 of these concepts in some capacity whether you realize it or not. 5:50 If you've ever thought about how to structure some data, 5:55 you were brushing up against computer science. 5:59 If you've ever thought about how to sort through or find some data, 6:02 you were dabbling in computer science. 6:06 And if you've ever thought about how you can make your code 6:09 just a little bit faster and a little more efficient, 6:13 you're flexing your computer science muscles then, too. 6:17 And it's this idea of computation and information that maps really quite 6:22 well to two of the core concepts in computer science. 6:27 Data structures and algorithms. 6:30 Now, data structures are information part of computer science, 6:33 while algorithms are that computation aspect. 6:39 And data structures and algorithms were the two main concepts that I first 6:44 started learning when I wanted to teach myself CS. 6:49 And I found that if you start with these two topics first, 6:52 you'll often run into other related topics along the way. 6:56 So let's start with data structures first. 7:01 A data structure is really just a way of organizing some data. 7:06 If you're learning to code, 7:12 you probably already run into data structures in some shape or format. 7:14 For example, arrays and objects are actually both just 7:19 data structures, so are sets and dictionaries. 7:25 When you're learning to code, you are forced to use the data structures 7:30 that are built into whatever programming language you're using. 7:34 Because that's what you have to use in order to store any data that you 7:38 care about. 7:42 And computer science is really no different. 7:42 When you study CS, 7:45 you'll encounter different kinds of data structures that let you store your data. 7:46 The only difference is that you might have not seen them in the programming language 7:52 you're learning before. 7:56 For example, you might have heard of and use something called an array. 7:59 But arrays aren't the only way of organizing data. 8:04 There's also something called a linked list, 8:08 which is a linear data structure that orders data sequentially. 8:11 Here's an example. 8:16 Each element within this linked list is stored within something 8:19 called a node and each node holds that data. 8:24 Each node also has a pointer or reference to the next node and 8:27 that's sort of where the linking of the list comes from. 8:31 Now even if you've never seen this data structure before, 8:35 at the end of the day, all this is, is just another way to organize your data. 8:39 Learning about different data structures through the eyes of computer science 8:44 can show us the different ways to structure information and how to hold it. 8:50 And it can also show us scenarios when certain data structures are more useful 8:55 and situations when they're less useful and maybe not the right tool for the job. 9:01 For example, 9:07 the Ruby programming language does have an array data structure built in. 9:08 But what it doesn't have is a built in binary tree data structure, 9:13 which is what's illustrated right here. 9:17 Now, you might not have seen a binary tree data structure before, but 9:20 keep in mind all it is is just another way of structuring and holding data. 9:24 Immediately off the bat, even if we've never seen a binary tree before, 9:29 we can see that they're different from arrays and linked lists. 9:33 They're non linear, which means that their data is organized non sequentially. 9:37 But they still hold data, they have nodes and they have pointers and 9:43 they're just another way of structuring information. 9:47 And sometimes, using a binary tree might be the right choice. 9:50 And other times, using an array might be the better choice. 9:55 And as you learn about different kinds of data structures, 9:58 you also start to see how and where they are used in computing. 10:03 For example, binary trees, like this one illustrated here, 10:09 are used within databases. 10:13 So in the future, if you're ever dealing with databases, 10:16 knowing what a binary tree is and how it works can be really helpful. 10:21 Some fundamental data structures that you might encounter while learning 10:26 computer science are linked lists, trees, graphs, hash tables, and sets. 10:31 So now that we've sort of covered data structures, 10:39 let's look at the other main concept, which is algorithms. 10:43 Now an algorithm can seem like a scary word, but 10:47 really all it is is a set of instructions. 10:51 And those instructions are used for deciding how to perform a calculation. 10:55 In other words, an algorithm is basically just a function or a method. 11:01 And we use that function or method to help us compute something. 11:06 Algorithms actually couple pretty well with data structures. 11:11 Because every time we have to interact with some data, 11:15 we usually have to perform some computation on it, 11:19 which means that we're relying on an algorithm to do that. 11:23 For example, remember that binary tree we just saw a minute ago? 11:27 Here's an illustration of how to insert an element into that tree. 11:31 Now, inserting data into a data structure needs a set of instructions. 11:36 There's no way for the computer or for a program to know how to do this, so 11:41 we have to give it instructions to tell it how. 11:45 And guess what, those instructions are just an algorithm. 11:48 So in this case, the instructions to add some data to a binary 11:51 tree are the insertion algorithm for this data structure. 11:57 And you can imagine how, just as there's an insertion algorithm for 12:02 this binary tree, there's also a deletion algorithm for 12:06 removing some data from the binary tree. 12:10 Anytime that we deal with inserting, deleting, searching through, 12:13 sorting through some sort of data, we're dealing with an algorithm to do that. 12:19 And as you learn more about data structures, you will naturally learn about 12:25 the algorithms that are specific to that data structure. 12:29 There are also some algorithms that are engineered to solve 12:34 a very specific problem. 12:38 For example, in this illustration you can see a binary search 12:39 algorithm that's being performed on a dataset. 12:44 And the binary search algorithm is something that's used specifically 12:47 to search for or find an element within a sorted collection of data. 12:52 As you learn more about different algorithms, you'll start to see 12:57 that many algorithms build on other algorithms, which is pretty cool. 13:01 So as you grow your knowledge about how different algorithms perform, 13:05 you'll start to see them pop up in the real world. 13:11 And as you learn the fundamentals of algorithms, 13:15 it'll become easier to learn more complex versions of the same ideas. 13:19 So now that we know about data structures and algorithms, there's a third concept 13:23 which I didn't mention before, but I think it's pretty cool. 13:28 I'm gonna throw it in there, there's a third concept which is big O notation. 13:32 And to me it sort of sits right between data structures and algorithms. 13:38 Big O notation is a way of measuring efficiency. 13:43 And efficiency is something that actually applies to data structures and 13:47 to algorithms. 13:53 In fact, we think about efficiency a lot when we're writing code and 13:54 when we're thinking about really intense forms of computation. 13:59 Now, what is big O notation? 14:03 It's really just a way to express the amount of time and 14:07 space that something requires. 14:11 In other words, we can use big O notation to talk about how efficient something is. 14:14 Now this could mean how efficient it is in terms of space, 14:20 it could also mean how efficient it is in terms of time. 14:24 Something to note is that we always talk about efficiency and 14:28 big O notation in the worst case scenario context. 14:33 So we can use big O to talk about how well something performs, and 14:37 decide on if we can improve on that and make it do better and perform better. 14:43 And we can talk about big O in terms of both data structures and algorithms. 14:50 So whenever we ask ourselves, how much time does it take to run this algorithm? 14:55 What we're really asking is, what's the big O time complexity of this algorithm? 15:00 Or, how will this algorithm perform in the worst case scenario? 15:07 All three of those questions really are equivalent, and 15:13 they're all talking about how efficient this algorithm is. 15:16 So when we evaluate how an algorithm runs, we want to know how 15:20 much time it will take for that algorithm to run as its input grows. 15:25 If we give the algorithm more elements to process or 15:31 perform computations on, what does the algorithm do? 15:34 Does it slow down, does it remain the same? 15:37 That's how we can evaluate how it behaves. 15:41 An amazingly efficient algorithm is one that runs in constant time or O(1). 15:44 Now this time complexity just means that the algorithm will always take 15:52 the same amount of time to run, regardless of how its input grows in size. 15:56 So an algorithm that is running in constant time behaves the same 16:01 if you give it 10 elements or if you give it 10 million elements. 16:06 It's always still just as fast, which is pretty cool. 16:11 But these algorithms are a little bit hard to come by. 16:14 More than likely what you'll see in the real world is some 16:17 algorithm that runs in linear time, those are a bit more standard. 16:22 And we can say that those run in O(n) time, 16:27 where n is the variable that represents the size of the input data. 16:30 So n could be 10, if you're passing the algorithm 10 elements, or 16:35 it could be 10 million, if you're passing it 10 million elements. 16:38 And when something runs in linear time, 16:42 what that means is that as our input data increases, 16:45 our algorithm's runtime increases linearly in proportion to that input data. 16:49 On the other hand, a terribly slow algorithm might run in 16:55 something called quadratic time, or O(n squared). 17:00 Now, you can imagine, if n is the input data, 17:04 how that algorithm runs as the input data grows. 17:09 Basically an algorithm that runs in quadratic time is one that gets extremely, 17:13 extremely slow as its input data increases. 17:19 Its performance is directly proportional to the square of the size of its input. 17:22 And you can see this kind of algorithm a lot when you write code that has lots 17:28 of nested loops within it, they're often algorithms that run in quadratic time. 17:34 And those are things to avoid, and now you know what they look like. 17:40 But as I mentioned, we don't just need to be efficient when it comes to time, 17:45 we also care about efficiency when it comes to space too. 17:50 We usually wanna know how much space or memory an algorithm will use up. 17:53 So if you find yourself asking, how much memory will this algorithm require, 17:58 you're really just asking, what's the big O space complexity of this algorithm? 18:03 Another way of phrasing that same question is, 18:08 how much memory will this algorithm require as its input grows? 18:11 And measuring efficiency doesn't just apply to algorithms, 18:16 it applies to data structures too. 18:21 If you find yourself asking, how much space does the data structure take up? 18:24 Then you're really asking about the big O space complexity of that data structure. 18:28 So you can see how you can talk about and 18:33 consider efficiency with lots of different perspectives. 18:36 Big O notation is pretty cool, because it allows us to evaluate the space and 18:42 time complexity of data structures and of algorithms. 18:48 And it gives us this language to help us standardize how to talk about efficiency. 18:52 So all three of these core concepts, data structures, 18:58 algorithms, big O notation, they all build on one another. 19:02 And as you learn a little bit about one, 19:07 you reinforce your knowledge and understanding about the others. 19:10 So the question is, of course, how do you go about learning all of this stuff? 19:15 I had to answer this question when I was teaching myself computer science, and 19:22 there's really no one right answer. 19:26 But I do wanna share a couple of strategies that really helped me when I 19:29 wanted to learn these concepts, but I didn't really know how to start. 19:34 So my first piece of advice is to just pick one topic and start learning. 19:39 From there, you'll stumble upon other related topics, and 19:45 you'll expand what you don't know. 19:50 And that's okay, 19:52 because the first step to knowing what to learn is knowing what you don't know. 19:53 So just pick one topic and focus on understanding that really well. 19:56 And maybe that means you start with a data structure that you've always wanted to 20:01 know about, or maybe you learn about a specific algorithm. 20:06 Or you can do what I did, which was just to learn what binary is, and 20:09 how to count in binary, which is something I didn't even cover in this talk, 20:13 but is also pretty cool. 20:18 Next, figure out how you learn, and 20:22 then find a resource that works best with your learning style. 20:24 If you're an auditory learner, 20:29 maybe that means you need to find a really good podcast. 20:31 And if you're a visual learner, find those books, and 20:35 blog post that really are going to cater to your learning style. 20:38 And if you're somewhere in between, maybe a video would work best for you. 20:41 Knowing how you learn is going to help you narrow down resources that best match your 20:46 learning style, and 20:51 then you're gonna be even more effective in your own learning journey. 20:52 Then try to find examples of what you've learned in the wild. 20:58 Look at different frameworks and see if they use a data structure or 21:02 algorithm that you've just learned about under the hood. 21:06 Or find out where that concept that you've just learned about actually applies in 21:10 the real world, like that example with binary trees and databases. 21:15 Computer Science is actually just a whole 21:18 lot more than anything I've really said today. 21:21 It's more than data structures, it's more than algorithms, 21:24 it's more than bigger notations. 21:27 In fact, this field encompasses things like networks, computer architecture, 21:29 security, distributed systems, operating systems, and that's just to name a few. 21:34 This is all to say there's just so much to learn. 21:40 But I believe that if you learn the fundamentals, you'll often find, 21:44 you'll bump up against some of these other related CS topics too. 21:49 And even if you don't need to know computer science concepts immediately 21:53 when you're learning to code, I do think it can be helpful at some point. 21:59 Learning CS can help you think in a context of performance and efficiency. 22:04 And it'll help you recognize pattern, and it will help you in technical interviews. 22:10 And sometimes it'll even help you in conversations with people who are a bit 22:15 gate keepery, and like to throw around terms. 22:19 It's pretty empowering to know what those terms mean, and 22:22 be able to engage in those conversations, and feel empowered that you can understand 22:25 these concepts even without getting a CS degree. 22:30 And a lot of the stuff can be heard at first, and 22:33 it's okay not to know all of it. 22:36 When I was teaching myself computer science, I quickly learned that 22:39 as an industry, we need a lot more approachable learning materials. 22:43 And that's why I wrote down everything that I learned along the way, so 22:47 that it would be easier for everyone else. 22:51 So the one thing that I hope you will do, as you decide what 22:53 to learn in your learning journey, whether it's computer science or something else, 22:56 the one thing I hope you'll do, is share what you learn with others. 23:01 Help make it easier for them, and for 23:05 the next person that tries to learn the same thing that you are. 23:07 If you'd like to check out some of the resources that I created while learning 23:13 Computer Science, here are a few of them. 23:16 There's the base CS writing series and a base CS podcast, 23:18 if that's how you'd like to learn new concepts. 23:22 And there's also base DS, 23:25 a writing series that I wrote a couple years ago on distributed systems. 23:26 And there are a couple links to all of these resources, 23:30 including a link to the video series that covers a couple of 23:33 the fundamental algorithms and data structures that I talked about today. 23:37 Finally, I'm working on a brand new resource which I'm 23:42 gonna be sharing on Twitter in a couple of months. 23:46 So, if you're curious to stay up to date with even more computer science resources, 23:50 you can follow me there and keep up with all the new CS content that I'm creating. 23:55 And that's about it. 24:00 Thank you so much for listening. 24:03 I hope you all end up trying to learn 24:04 computer science and enjoy it. 24:09 And even if you decide that you wanna learn something else, 24:13 I hope you just have fun along the way while doing it. 24:15 Thanks. 24:16

You need to sign up for Treehouse in order to download course files.

Sign up