• Activity
  • Votes
  • Comments
  • New
  • All activity
    1. An informal look at the concept of reduction (alternatively: problem-solving for beginners).

      Preface One of the most common questions I see from prospective programmers and computer scientists is "where should I start?". My answer to that is a pretty consistent one: learn how to solve...

      Preface

      One of the most common questions I see from prospective programmers and computer scientists is "where should I start?". My answer to that is a pretty consistent one: learn how to solve problems effectively. But that's vague and not really all that helpful, so I figured that I should actually tackle this in a little more depth by touching on something more specific.

      Specifically, I want to touch on the subject of how to think about complex problems.


      The Rationale Behind Learning

      Before we can better understand how to effectively solve problems, it's important to consider how it is that we learn. With any subject, the standard approach is to begin with the bare basics. For programming, that's writing a Hello, World! program in the new language you're working with. For foreign languages, you learn basic common words and sentence structure. For math, you learn your basic arithmetic operations like addition and multiplication.

      From there, we add on more additional complexity and string together everything we've learned. For a foreign language, this looks like learning about new words, stringing them together in your own sentences, then learning about verb tenses and throwing them into the mix as well. With math, you take your normal number crunching and suddenly throw the concept of order of operations into the mix, then variables and how to solve for them.

      As a general rule, we first get comfortable with solving a simple problem and gradually build up toward solving increasingly more difficult ones.


      The Missing Piece

      Odds are that we've all sat in a math class at one point, and when the teacher asked a student how to solve a problem, they received an immediate "I don't know". You may or may not have been that kid yourself. I have no intention of shaming the kids who struggled (or those who still struggle) with math. Rather, I want to point to what I believe is the fundamental cause of that mental barrier that has frustrated students for generations.

      Learning is not simply a matter of adding more complexity to problems. A key part of learning, and one that I don't recall ever having emphasized during my grade school studies, is your ability to break problems down into the steps that you know how to complete and combine the different, simpler skills you've already learned to arrive at a solution. Instead, you were expected to solve many of those complex problems and learn through practice, or through pure rote memorization.

      What determined whether or not you could solve those problems was then a question of whether or not you could intuit or memorize how to solve those specific problems, and brand new problems that still made use of the same skill sets but had completely different forms would throw a wrench in that. Those who could solve any of those problems--those who, I would argue, were often mistakenly referred to as "geniuses" or "talented"--were really just those who knew how to break a problem down into simpler pieces.

      This isn't a failing on the students, but on the way they've been taught to think about problems.


      Reducing Problems

      What does it mean to "break down" a problem, though? The few times I recall a teacher ever touching on the subject, "break down the problem" and "use the skills you've already learned" were the kinds of pieces of advice passed around, completely vague and devoid of meaning for anyone who didn't already understand. How can we better grasp this important step?

      There's a term in complexity theory known as "reduction". The general idea is that if you have problems A and B, where you already know how to solve B, then if you can transform problem A so that it looks like problem B, then you can use your solution for B to solve at least part of A.

      In other words, finding the solution to a more complex problem is just a matter of finding a way to make it look like a problem you already know how to solve.

      The advice to "break down" a problem really means to perform this process of "reduction", of transforming your more complicated problem A into your simpler, known problem B.


      In Practice

      We're still discussing a vague concept, but now that we have more specific language to work with, we can more easily see how it works in practice (a reduction of its own!).

      Let's consider a conceptually simple problem: grabbing the kth largest (or smallest) item from a list. How do we solve this problem? Probably the most obvious and straightforward answer is to sort the list then grab the kth item, right?

      Notice that we gave two high-level descriptions of the steps we need to solve this problem: sorting, then grabbing the appropriate item. We can therefore then state that the problem of "grab the kth largest/smallest item from a list" can be reduced to the two problems "sort a list" and "grab the kth item from a list".

      Now, let's say we're given the problem "take this list of competitor times from the race and tell me what the top 10 race times were". What do we know about this problem? We know that we're being given a list, and we know that we need the 10 smallest items from that list. We also know that "10 smallest items" is just shorthand for "the 1st smallest item, the 2nd smallest item, ..., and the 10th smallest item". We can therefore reduce this problem to the previous one we solved by transforming it into "grab the kth smallest item from a list" and "repeat for values 1-10 for k".


      Practical Advice

      In the end, my explanation may not have helped much at all in actually grasping the concept of reduction. My intent isn't necessarily to help you understand it immediately, but to provide you a framework for a way of thinking. Even if you do grasp the general concept, you may even wonder how you're supposed to recognize these kinds of reductions out in the wild in non-academic environments. The answer, perhaps annoying, is practice. Much like an appraiser can only become good at discerning details through experience, a programmer or computer scientist can only recognize these patterns through repeated exposure.

      In general, if I had to narrow it down to a small list of tips for improving your problem solving skills, this would be it:

      • Work on grasping the concept of reduction itself.
      • Expose yourself to lots of new problems.
      • Don't shy away from difficult problems. Reduce them as much as you can and solve the pieces you're able to. Try to research the pieces you're struggling with. Return to the problem later when you have more experience if you have to, but take a crack at it first.
      • Don't accept "I don't know" as an answer in itself. Ask yourself why you don't how to solve a problem. Narrow down which pieces you're able to solve and which pieces you're not.
      • Just solve problems. Any problems. Easy ones, hard ones, and anything in between. Solving problems is a skill, and practicing it will make you better at solving problems in general, and better at recognizing the simpler problems inside of more complicated ones.
      • Don't just come up with a solution to a problem. Ensure that you understand how each piece of it works and why it works. Copy-pasting from StackOverflow can be a valid tool at your disposal, but doing so mindlessly isn't nearly as valuable as reviewing the solution, being able to determine whether or not it works before ever executing the code, and being able to discard anything unnecessary from it.

      Final Thoughts

      I'm not an authoritative voice on this subject. I'm not an educator. More than anything, I'm a life-long student and an enthusiast. There's seldom a day when I don't have to research something new in order to solve a problem I'm not familiar with, or remind myself the syntax for a function I've used several times in the past. I don't know anything about teaching others, but I do know plenty about learning, and if there's anything that has stood out to me over the years, it's the fact that I find it easier to learn about something or to solve a problem if I can transform the concept into something that's easier for me to grasp.

      Moreover, I'm human and thus prone to mistakes. Call me out on them if you notice them. I'll take any of my mistakes as learning opportunities :)

      11 votes
    2. What linguistics habits annoy you?

      Habits can be good! I mean, if you build the good ones of course. But ya know, sometimes people fall into habits that annoy you. I mean, they probably don't know that they're annoying you. Or that...

      Habits can be good! I mean, if you build the good ones of course. But ya know, sometimes people fall into habits that annoy you. I mean, they probably don't know that they're annoying you. Or that they've fallen into the habit at all! What linguistic habits have you noticed in yourself (or others) that drives you up the wall?

      26 votes
    3. The Good Place is one of the funniest, most original shows I've seen in a long time

      The third season has just started and it's as funny as ever. If you've never heard of it before, here's the blurb from Wikipedia: The series focuses on Eleanor Shellstrop (Kristen Bell), a woman...

      The third season has just started and it's as funny as ever. If you've never heard of it before, here's the blurb from Wikipedia:

      The series focuses on Eleanor Shellstrop (Kristen Bell), a woman who wakes up in the afterlife and is introduced by Michael (Ted Danson) to "The Good Place", a highly selective Heaven-like utopia he designed, as a reward for her righteous life. She realizes that she was sent there by mistake and must hide her morally imperfect behavior and try to become a better, more ethical person. William Jackson Harper, Jameela Jamil and Manny Jacinto co-star as other residents of "The Good Place", together with D'Arcy Carden as Janet, an artificial being helping the inhabitants.

      The Good Place received positive reviews upon its debut and has since gained critical acclaim. It has been praised for its performances, writing, originality, setting and tone.

      Seriously, give it a shot!

      35 votes
    4. When did rap turn into this? We need to start over.

      hey all! just wanted to share a really interesting response to the title question i came across today. this discussion spawned on the /r/justfuckmyshitup subreddit, a page dedicated to those with...

      hey all! just wanted to share a really interesting response to the title question i came across today.

      this discussion spawned on the /r/justfuckmyshitup subreddit, a page dedicated to those with bad haircuts, and was based around rising (you guessed it) emo rapper, bexey.

      as with many others in the genre, most of bexey's following is still very underground even though popular tracks like 'cutthroat smile' and 'stay alive' have reached 2.9 million and 7 million hits, respectively, on youtube.

      while a bit of controversy surrounds bexter as he was once a good friend of late emo rap frontrunner
      lil peep
      (linked: 'your favorite dress') though has been rumored to have stolen several of peeper's clothes after his death, the musical point of discussion quickly turned to the question in the title:

      when did rap turn into this? we need to start over.

      not shortly after, user /u/GNAR-gemniii responds.

      This is natural progression in genres of music.
      Hip hop starts somewhere, has it's defining characteristics established, then people start pushing the genre in different directions because the same old same old has been done before.
      We're in a weird sort of teenage state with hip hop right now, where people are taking the genre and mixing in characteristic of other genres - some good, some bad. This, combined with the 'viral' nature of social media means we get people who do crazy things to stand out like the above, as part of pushing the genre in all these weird directions. This guy specifically is a blend of modern trap production with goth and emo influences (if you couldn't tell).
      as always, there are gonna be people who do it better than others, and people who rely on gimmicks for attention. This guy is a solid 6/10 talent wise, but has an image that appeals to a younger generation. This pattern is as old as music and culture, and people said the same things about every genre when we start getting some really wacky stuff that doesn't really fit within the confines that we would normally associate with the genre.
      Nu-metal is a great example of this. traditional rock and metal music had been done to death, so we had this infusion of hip hop characteristics in to metal. In its infancy, a lot of it is really bad as people figure out what works, then as the subgenres become more popular you have people who hit a nice groove that combines the best characteristics of both genres into something that actually appeals to people who might like one or the other, and can now appreciate the other part of the blooming subgenre. something like Limp Bizkit or Kid Rock vs. Linkin Park or Korn. They're very similar genre wise but you can see maturation of the style and the progression of people doing it well.
      We've already had some really nice subgenres blooming out of hip hop. Cloud rap is one that I think blends very well, and has been around long enough for people who were inspired by the artists at the forefront to come out and do it themselves, sometimes pushing it even further. Recently Lil Peep was an artist that many felt blended nicely the attitude of punk rock / emo / grunge with the banging beats that dominate modern hip hop currently. In the past couple years NY has had a surge of artists who grew up listening to the boom bap greats that paved the way for hip hop and are now blending that into the modern trap beats. The Underachievers are a personal favorite who demonstrate their understanding and respect for the origins of hip hop by showing master of both old and new styles (infused with the ideals of hippy counter culture) on their album Evermore: The Art of Duality. Seriously it's great, give it a listen. If you like old hip hop you will definitely like some of the songs at least, and it could open your eyes a bit and see how they translate traditional skills on top of more modern production.
      As the genre continues to dominate main stream music we're going to have people inspired by artists in these weird hip hop subgenres come out and do it better than their idols, giving us a further refined and more tasteful progression of the subgenres that are currently in their infancy.
      As time goes on, we forget the gimmicky trash that tends to flare out quickly and tend to remember the ones that did it well. Within the next 10 years i feel we're going to see some of the subgenres really shine and define themselves separately from the genres they have their roots in.
      I just love the culture so on some level I can enjoy some objectively not that great music because I appreciate the art and what these artists are trying to do.
      e. Don't even get me started on how metal has stagnated and it's energy has evolved into modern dubstep.

      10 votes
    5. How did you discover your sexuality?

      Hey Waves! I've been wondering how other people discovered they were bi, or gay, or pan, or ace, or straight, or anything else. You can tell stories of your first crush, how things just 'felt...

      Hey Waves!

      I've been wondering how other people discovered they were bi, or gay, or pan, or ace, or straight, or anything else. You can tell stories of your first crush, how things just 'felt right', anything.

      14 votes
    6. What are you reading this week? #3

      What are you reading currently? Fiction or non-fiction, any genre, any language! Tell us what you're reading, and talk a bit about it. Past weeks: Week #1 · Week #2

      18 votes
    7. When the need arises, what is your go to late night snack?

      For me, its a bowl of cereal, usually grape nuts or cheerios. Sometimes with blueberries. Quick and easy. Also, weird fact; I put table cream or half and half in my cereal. My grandmother grew up...

      For me, its a bowl of cereal, usually grape nuts or cheerios. Sometimes with blueberries. Quick and easy.

      Also, weird fact;

      I put table cream or half and half in my cereal. My grandmother grew up on a dairy farm on PEI and when they were kids the best cream was always used by her family for cereal or tea. Well, she had 6 kids, who then had 13 more and all of us use cream like weirdos (and drink lots of tea). And no, we are not all obese because of it, everything in moderation. =)

      ^ I may or may not be eating grape nuts and cream right now.

      11 votes
    8. Site Idea: Gather links from multiple sources on the same topics and put them together

      This all started about 5 minutes ago because I added a link to the EFF story on the post of the Gizmodo article submission about Facebook sharing phone numbers used for 2FA with advertisers, but...

      This all started about 5 minutes ago because I added a link to the EFF story on the post of the Gizmodo article submission about Facebook sharing phone numbers used for 2FA with advertisers, but the more I thought about it in the past 5 minutes since that comment I think it could be more.

      There's more information out there and available than ever before. The barrier for for entry on content creation is lower than ever. However this has led to the easy-spread of misinformation. It's not that the right info isn't out there, it's that finding it is harder now.

      The idea is to have a site that is essentially a link aggregator. But what makes it different is that if you find a site that talks about the same thing you can tack on the article to the post. Ergo making posts about events, not articles. Bringing sources together and making cross referencing easy.

      10 votes
    9. Hello

      Hello, I am el fox. Just joined today and kind of lurking trying to figure out where to eventually dive in. What do I need to know about interacting here? And how about that Elon Musk? I think he...

      Hello, I am el fox. Just joined today and kind of lurking trying to figure out where to eventually dive in. What do I need to know about interacting here?

      And how about that Elon Musk? I think he might have just flown a little too close to the Sun. At this point I hope he just steps down and takes a less forward facing role in the company and gets himself together. Really rooting for it to work out. Sad to see someone so far off the rails.

      23 votes
    10. ~music Listening Club 15 - Songs in the Key of Life

      It's week 15, and time for another classic record discussion: Songs in the Key of Life by Stevie Wonder! Songs in the Key of Life is the eighteenth album by American recording artist Stevie...

      It's week 15, and time for another classic record discussion: Songs in the Key of Life by Stevie Wonder!

      Songs in the Key of Life is the eighteenth album by American recording artist Stevie Wonder, released on September 28, 1976, by Motown Records, through its division Tamla Records. It was the culmination of his "classic period" albums. The album was recorded primarily at Crystal Sound studio in Hollywood, with some sessions recorded at the Record Plant in Hollywood, the Record Plant in Sausalito, and The Hit Factory in New York City. Final mixing was performed at Crystal Sound.

      An ambitious double LP with a four-song bonus EP, Songs in the Key of Life became the best-selling and most critically acclaimed album of Wonder's career. In 2003, it was ranked number 57 on Rolling Stone magazine's list of the 500 greatest albums of all time. In 2005, it was inducted into the National Recording Registry by the Library of Congress, which deemed it "culturally, historically, or aesthetically significant."

      Here's the place to discuss your thoughts on the record, your history with it or the artist, and basically talk about whatever you want to that goes along with Songs in the Key of Life! Remember that this is intended to be a slow moving thing, feel free to take your time and comment at any point in the week!

      If you'd like to stream or buy the album, it can be found on most platforms here.

      Don't forget to nominate and vote for next week's obscure record in response to this comment!

      15 votes
    11. Parents: have your kids been affected by age-inappropriate content?

      I was having a conversation with one of my coworkers who mentioned that her child showed a fascination with scary, Halloween-type stuff starting around age 6. She and her husband had a hard time...

      I was having a conversation with one of my coworkers who mentioned that her child showed a fascination with scary, Halloween-type stuff starting around age 6. She and her husband had a hard time with whether they should let him enjoy it or limit it. They weren't sure whether to let him read scary books or watch spooky stuff on YouTube, particularly because it's the type of content that can very easily be age-inappropriate--especially for a 6 year old. Nevertheless, it was relatively easy for them to keep it to stuff like Jack-o-Lanterns and black cats since he was so young.

      The boy is now older but has retained his interest, and the parents are still struggling with decisions about allowable content, especially because he is starting to age into books and movies that deal with much darker stuff, particularly ideas about death/violence.

      I'm not a parent, but I am a teacher, and I have to admit that I'm uncomfortable with some of the stuff my students are exposed to. Over the years I've heard students as young as twelve discuss horror movies like the Saw series or The Human Centipede. I've had middle school students bring books like Gone Girl and 50 Shades of Gray to class. On one hand, I think kids are resilient, and I think a lot of the more difficult or disturbing stuff doesn't quite land for them because they don't really have a context into which to put it yet. I also believe that fictional media is a mostly safe way for us to explore troubling or disturbing ideas.

      On the other hand, I think the internet has caused our children to grow up a lot faster than they used to, as they are exposed to mature content (whether intentionally or accidentally) from a very early age. When I was growing up the worst I could do was check out a slightly-risqué book from the school library and hope my parents never found it in my backpack. Now kids are watching violent (often real-world) and pornographic content starting as young as elementary school. Nothing can make your heart sink quite like sixth graders talking excitedly over lunch about a video of a real person getting crushed to death.

      What I genuinely don't know is if this has any negative developmental effect. Am I just clutching my pearls here? I'd love to hear some parents talk about how they've handled the decision of what's right for their kids and whether they've had fallout from their kids consuming content that's not appropriate for them.

      26 votes
    12. Programming Challenge: Compute the shortest path to visit all target spots on a grid.

      Let's do something a little more challenging this time. Given an MxN grid of arbitrary size, and given a random starting place on that grid and a list of points to visit, find the shortest path...

      Let's do something a little more challenging this time.

      Given an MxN grid of arbitrary size, and given a random starting place on that grid and a list of points to visit, find the shortest path such that you visit all of them. Path lengths will be computed using taxicab distances rather than strict coordinate distance calculations.

      There are no restrictions on expected input this time. Output should be the total distance traveled between points.


      Example

      Assume that we use the character # to denote a spot on the grid, the character @ to denote your starting point, and the character * to denote a place on the grid that you're required to visit. One such grid may look something like this:

      ######
      ######
      **####
      #*####
      #*#*##
      #@####
      ######
      

      In this case, let's say that the bottom-left point on the grid is point (0, 0) and we're starting on point (1, 1). One valid solution would be to move to point (3, 2), then (1, 2), then (1, 3), then (1, 4), and finally (0, 4). The shortest path available is thus 8. Note that it's not enough just to visit the next nearest point on the grid!

      15 votes