Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

The magic of recursion

Options
  • 19-11-2011 4:11am
    #1
    Registered Users Posts: 146 ✭✭


    Following on from another thread here, I have spent the evening exploring the magic of recursion. I wondered if it was worthy of a thread for general discussion?

    It almost looks like magic when you see it. A function calling itself often seemingly having done no initial work. I was a student of an I.T. They sold their souls to MS and we spent our time studying practical stuff. How I wish I had had exposure to these types of areas of CS. I wish I had had a lecturer like this, she's brilliant. Well worth a watch.




    and
    http://www.youtube.com/watch?v=NdF1QDTRkck&feature=relmfu

    etc etc


Comments

  • Registered Users Posts: 2,781 ✭✭✭amen


    I was a student of an I.T. They sold their souls to MS and we spent our time studying practical stuff.

    You completed third level CS and didn't study recursion ? I find that hard to believe.

    I didn't even do CS and we studied Recursion.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    What has MS got to do with it ? Tbh it just sounds like a crap course.


  • Registered Users Posts: 146 ✭✭m1nder


    All I meant was that, our IT took a decision to teach .Net exclusively as a programming and web programming subject and SQL Server as a database subject. So we spent our time learning how to interact with database and studying out of the box .Net API's.

    We never looked at many things that I wish we had. There were a few other staples of CS that we did not cover either. But hey - great thread, loads of positive input and discussion. What an experience!


  • Registered Users Posts: 2,781 ✭✭✭amen


    sorry but what were you expecting ?

    You completed a course in IT (cert/dip/degree) and you didn't cover recursion. Doesn't speak much for the course.
    We never looked at many things that I wish we had. There were a few other staples of CS that we did not cover either

    well go look at them. Loads of things I wasn't taught either but I went and found out about them.

    Its not about the language its about the concepts


  • Registered Users Posts: 146 ✭✭m1nder


    I dont understand the responses in this thread. I was just looking at recursion and found it amazing. I started a thread on it and happened to mention that we never did it in college. I feel as though I'm being punished for that. That's not the point of the thread at all. It's all pretty negative. I have no idea why or what triggered that. If a mod is listening and if they deem it appropriate, lets delete it.


  • Advertisement
  • Registered Users Posts: 1,311 ✭✭✭Procasinator


    amen wrote: »
    well go look at them. Loads of things I wasn't taught either but I went and found out about them.

    Its not about the language its about the concepts

    You are kind of preaching to the choir there. He has just stated in he spent the evening exploring the subject and created a thread to discuss it.

    OP: Have you looked into the differences between iterative and recursion, and not the pros and cons about them? Read about tail recursion?

    Recursive solutions are much more prevalent in functional programming languages.


  • Closed Accounts Posts: 695 ✭✭✭yawha


    Unfortunately, this forum is much more geared towards the industry and enterprise side of programming rather than Computer Science theory and fun/cool things to do with coding, although I'm still a little surprised by the somewhat hostile responses you've gotten.

    Recursion is awesome though, but it can take time to actually start thinking properly recursively. As was mentioned in the post above, it's a fundamental part of programming in functional programming languages. Learning Haskell was a huge benefit to my understanding of recursion, and helped me think of recursive solutions to problems in other areas too.

    A good exercise if you want to do something cool with recursion is to implement a recursive quicksort. It's a good example of an algorithm which lends itself to recursion very well.


  • Registered Users Posts: 146 ✭✭m1nder


    yawha wrote: »
    Unfortunately, this forum is much more geared towards the industry and enterprise side of programming rather than Computer Science theory and fun/cool things to do with coding, although I'm still a little surprised by the somewhat hostile responses you've gotten.

    Recursion is awesome though, but it can take time to actually start thinking properly recursively. As was mentioned in the post above, it's a fundamental part of programming in functional programming languages. Learning Haskell was a huge benefit to my understanding of recursion, and helped me think of recursive solutions to problems in other areas too.

    A good exercise if you want to do something cool with recursion is to implement a recursive quicksort. It's a good example of an algorithm which lends itself to recursion very well.

    Thanks for your response. However I disagree with you when you say "this forum is much more geared towards the industry and enterprise side of programming rather than Computer Science theory and fun/cool things to do with coding".

    There is nothing in the charter or in the thread trends to suggest that and even the charter includes a post on how to ask for help with homework. While I understand that programming is essentially a professional endeavor, it has to start somewhere. Any forum Ive been to always welcomes beginners (I do not fall into the general beginners category here). When it comes to coding, we have to ask ourselves - "what is a beginner?".

    Considering the rate of change in our field, every 2 years or so we find ourselves learning new syntax, languages, abstractions of patterns etc.... I would suggest that in ways, we are all beginners to some extent all of the time.


  • Closed Accounts Posts: 695 ✭✭✭yawha


    m1nder wrote: »
    Thanks for your response. However I disagree with you when you say "this forum is much more geared towards the industry and enterprise side of programming rather than Computer Science theory and fun/cool things to do with coding".

    There is nothing in the charter or in the thread trends to suggest that and even the charter includes a post on how to ask for help with homework. While I understand that programming is essentially a professional endeavor, it has to start somewhere. Any forum Ive been to always welcomes beginners (I do not fall into the general beginners category here). When it comes to coding, we have to ask ourselves - "what is a beginner?".

    Considering the rate of change in our field, every 2 years or so we find ourselves learning new syntax, languages, abstractions of patterns etc.... I would suggest that in ways, we are all beginners to some extent all of the time.
    Nothing in the charter, I just mean that generally you don't find too many threads on Computer Science theory or people talking about cool things they've created just for the fun of it etc. Compare with www.reddit.com/r/programming or www.reddit.com/r/compsci .


  • Registered Users Posts: 2,023 ✭✭✭Colonel Panic


    I do wish there was more discussion about what people are working on in this forum instead of the usual posts about what language to start with and the fights that usually follow but I personally get my computer science kicks elsewhere.

    If I'm honest, while I find data structures and algorithms quite interesting and read a lot of technical papers, I still just see them as a way of getting things done, and if an algorithm is fast enough,

    I'm not going to spend a moment's thought trying to optimize it or do something beautiful with recursion when storing data flat in memory is usually much more cache and stack friendly and easier break up on multiple threads.


  • Advertisement
  • Registered Users Posts: 2,781 ✭✭✭amen


    From re reading my posts I may have a been a little harsh. That was not my intent especially as I rather like this forum as in general most of the users are friendly, clever and go out of their way to help with any problem.

    Yes recursion is neat especially when you take some existing horrible code and rewrite it by some simple recursion.
    when storing data flat in memory is usually much more cache
    true but it does have it uses.

    In a past life I had to write some code to search some telecommunications data (network sdh pipes) and recursion mad life very easy multiple recursive calls into the data.
    while I find data structures and algorithms quite interesting and read a lot of technical papers

    more a database person myself.

    There are some good MIT Computer Science videos online as well. Worth watching.


  • Registered Users Posts: 2,023 ✭✭✭Colonel Panic


    Yeah, there's not always a "right" solution, just a best fit! Sometimes it's recursion, sometimes it's not. It depends on so many things! I think that sort of stuff it what I enjoy about programming!


  • Registered Users Posts: 3,735 ✭✭✭Stuxnet


    any time I use recursion in java I cant help but think of the movie Inception


  • Closed Accounts Posts: 5,482 ✭✭✭Kidchameleon


    m1nder wrote: »
    I dont understand the responses in this thread. I was just looking at recursion and found it amazing. I started a thread on it and happened to mention that we never did it in college. I feel as though I'm being punished for that. That's not the point of the thread at all. It's all pretty negative. I have no idea why or what triggered that. If a mod is listening and if they deem it appropriate, lets delete it.


    Off topic sorry, it can be dangerous to post in this forum, there a few people here who think they know everything.

    Thanks for that video OP I'm gonna download it and watch later


  • Registered Users Posts: 1,235 ✭✭✭Odaise Gaelach




  • Registered Users Posts: 5,246 ✭✭✭conor.hogan.2



    I even love how the link changes when you click the did you mean link.


Advertisement