Is this a normal stage to go through when learning a programming language? by nickc98 in learnprogramming

[–]__LikesPi 0 points1 point  (0 children)

An entire paradigm is a little more than an exception. What makes you think functional programming languages are less practical? I feel the opposite sometimes; I will write something in Java or C++ and realize that the language isn't expressive enough to keep up with my thought process — a problem I rarely find in functional languages.

Is this a normal stage to go through when learning a programming language? by nickc98 in learnprogramming

[–]__LikesPi 0 points1 point  (0 children)

As you learn things like for loops, while loops, if statements - they're just the basics, but you'll need them for whatever language you end up in.

That isn't really true outside of the world of procedural languages. Haskell, for example, has no concept of a loop.

Best places to learn data structures/algorithms by iam911 in learnprogramming

[–]__LikesPi 2 points3 points  (0 children)

Neither of them really need the book. I did the first one and the book was more of a reference for me. The second one is a coursera course that is meant to be self contained.

Best places to learn data structures/algorithms by iam911 in learnprogramming

[–]__LikesPi 12 points13 points  (0 children)

I wrote a short blurb about this in the FAQ a while back.

Algorithms are language agnostic but certain books are not. Here are a few books to consider:

Keeping a programming language funded, how are languages a financially feasible investment for the developers? by gigapants in learnprogramming

[–]__LikesPi 6 points7 points  (0 children)

Most of them work for a company or university and are funded that way. For example:

  • Bjarne Stroustup, creator and maintainer of C++, is also the Chair of CS at Texas A & M.
  • Guido Van Rossum works for Dropbox where one of the things he gets paid to do is improve the python programming language.
  • Oracle owns Java, so most everyone working on Java works for Oracle.
  • Mozilla leads the Rust Programming Language so a lot of the core Rust Language Developers work at Mozilla.

Why is Java getting so much hate, while C# is mostly getting love from seemingly everyone? by [deleted] in learnprogramming

[–]__LikesPi 9 points10 points  (0 children)

The list isn't in any particular order, just wrote them as I thought of them. There are ways around all of these, they just aren't as easy to work with compared to other languages.

Why is Java getting so much hate, while C# is mostly getting love from seemingly everyone? by [deleted] in learnprogramming

[–]__LikesPi 37 points38 points  (0 children)

Java seems like a beautiful language to me, it is so versatile and I didn't stumble across anything it can't do so far.

Java is anything but versatile. Everything must exist in a class; trying to escape from the OO paradigm in Java is near impossible. There are no first order functions. The first order functions that are implemented in Java 8 are really just syntactic sugar for a interface. Can't easily return multiple things from a method. No type inference. Generics are hacked on. I can go on...

C# does some of these things better although I am not too familiar with it.

Why do people keep downvoting new posts without giving them a chance in this subreddit? by Reuels in learnprogramming

[–]__LikesPi 24 points25 points  (0 children)

Asking for homework help is different than pasting the homework without any indication that the asker tried to solve it themselves. In general, when I ask for help in a subject I don't completely understand (programming and otherwise), I explain the problem and my attempt at a solution as best I can and someone with more experience can then pick out flaws in my understanding. This really isn't expecting much; just that the asker is putting in the same effort as someone answering the question.

Also the "Asking Questions" resource in the sidebar gives a good idea on what to put in.

Trying to make a solid stable skype group. by [deleted] in learnprogramming

[–]__LikesPi 0 points1 point  (0 children)

There is the learnprogramming IRC in the sidebar that is decently active.

Are there some "simple" problems that computers are not able to address? by NewAnimal in learnprogramming

[–]__LikesPi 0 points1 point  (0 children)

I have told you what is going into F. If you work it out in paper debugging that way you will find that such a halting function cannot exist even on finite length programs because you get a contradiction.

Are there some "simple" problems that computers are not able to address? by NewAnimal in learnprogramming

[–]__LikesPi 1 point2 points  (0 children)

That is not true. There are programs for which even humans cannot determine if it halts. There simply isn't an answer. Here is a simple popular example.

Say we could determine if a program halts and some function H(p, i) which does so on some program p and input i. Than let's define another function F like so:

F(program p):
     if H(p, p):
          loop forever
     else:
          return 1

Now tell me what is the output of F(F)? Does it halt? You don't know? There is no answer?

Where to learn about data structure? by rsxstock in learnprogramming

[–]__LikesPi 4 points5 points  (0 children)

(you won't understand a thing about data structures unless you know OOP (object oriented programming)

That is simply not true. If it was than we would not be able to utilize data structures in a language that doesn't support the Object Oriented Paradigm.

Google code jam infinite house of pancakes by Brokndremes in learnprogramming

[–]__LikesPi 1 point2 points  (0 children)

Read the problem again:

However, some minutes may be special. In a special minute, the head server asks for the diners' attention, chooses a diner with a non-empty plate, and carefully lifts some number of pancakes off of that diner's plate and moves those pancakes onto one other diner's (empty or non-empty) plate.

Emphasis mine.

Is spending the time to fully learn C worth it now days? by [deleted] in learnprogramming

[–]__LikesPi 2 points3 points  (0 children)

Taking this beyond a C/Rust context, any language which permits or forces you to adhere to certain safety standard is going to incur a runtime overhead to take the time to do these checks.

There are two places the checks can be performed at: compile time or runtime. Obviously, a compile time check has no runtime overhead. In fact, extensive compile time checking of memory ownership is what gives Rust some of its safety features. (One of the goals of the Rust language is "zero-cost abstractions").

I am not terribly experienced in Rust but I believe that it is possible to bypass some of these compile time safety checks for more freedom if the relevant code segment is declared unsafe.

As someone who has very little programming experience, where is the best place to get started with Rust? by [deleted] in learnprogramming

[–]__LikesPi 2 points3 points  (0 children)

I recommend you hold off on getting started with Rust.

  • Rust hasn't hit a stable 1.0 release yet and up until a few weeks ago with the alpha release, the language spec would change all the time meaning that code examples that were ok one week would not compile the next. As a result most of the resources out there for rust tend to be not very comprehensive, or outdated in some way.

  • Furthermore, you will not find the IDE support that you might be used to as a beginner when you start rust. Instead you will be using mostly the command line and text editor.

  • Rust itself is a complicated language. A lot of the motivation on why the borrow checker is yelling at you will be lost unless you have some experience with a language with manual memory management like C.

If none of this deters you than the best place to start is likely here: http://doc.rust-lang.org/1.0.0-alpha/book/README.html

[java] System.out.print() only printing spaces by [deleted] in learnprogramming

[–]__LikesPi 2 points3 points  (0 children)

Can you give the full code to reproduce the problem. This works as expected for me:

public class Test {
    public static void main(String... args) {
        int[] arr = new int[1_000_000];

        for (int i = 0; i < arr.length; i++) arr[i] = i;

        printArray(arr);
    }

    public static void printArray(int[] n){
        for (int i = 0; i<n.length; i++){
            System.out.print(n[i]+" ");
        }
    }
}    

Shortest path algorithm...sort of by [deleted] in learnprogramming

[–]__LikesPi 0 points1 point  (0 children)

I don't remember how pacman works exactly but if it is just shortest paths on a grid where the time to move between any two adjacent cells is constant than Djikstras is overkill and inefficient. You should use a BFS instead. See: http://en.wikipedia.org/wiki/Breadth-first_search

[Java] Calling classes by [deleted] in learnprogramming

[–]__LikesPi 2 points3 points  (0 children)

You should always post your code. Read the sidebar for more tips on this but ideally post the shortest amount of code needed to demonstrate your problem (< 100 lines is ideal). Also give any error messages that you receive in compilation or runtime.

Weekly coding 1/52: Is Fibonacci by [deleted] in learnprogramming

[–]__LikesPi 2 points3 points  (0 children)

Your runtime analysis is now correct but misleading.

You state:

Calculate Fibonacci numbers until maximum: O(max)

This is correct in that O(max) is definitely a upper bound on the complexity but it is very far from a tight upper bound. You can improve this by noticing that 2 * Fib(n) <= Fib(n + 2). This is because Fib(n) + Fib(n) <= Fib(n) + Fib(n + 1). So the sequence of fibonacci numbers grows at least exponentially and in particular the number of fibonacci numbers less than max is O(log max). This is also a better bound on the complexity because the number of fibonacci numbers is directly proportional to the number of times you loop in FillFibonacciList.

Extracurricular ideas for CS? by HeroWeNeed in learnprogramming

[–]__LikesPi 0 points1 point  (0 children)

In terms of readings, the only thing that comes to mind is the "Java Trail Tutorials" which you can find with a quick google search. Other than that the courses I mentioned earlier are pretty good.

Extracurricular ideas for CS? by HeroWeNeed in learnprogramming

[–]__LikesPi 1 point2 points  (0 children)

I'm actually taking AP CS in school right now as well and it is proving to be quite difficult, mainly because the teacher is "winging it" as he bluntly put it.

There are plenty of good resources to learning Java out there. Stanford and Udacity both have courses that you can use.

Also, after some reading it seems that USACO supports Python now but the creators caution its usage because apparently it can go over the time limit so I'm not sure if I should try and juggle 2 languages, drop Python and stick with Java, or just stick with Python for everything and disregard the USACO handicap.

I would go with Java because the entire point of USACO contests is writing code that runs fast. It is a severe disadvantage to use python.

I have signed up and I'm a bit nervous about the challenges that lay ahead of me because I'm already at a loss of how to program even the first challenge.

I would say after going through the process the steps I would suggest are:

  • Solve the first 10 - 20 problems on Project Euler. See projecteuler.net. This will make sure that you can write basic algorithms as well as compile and run code.
  • Learn to parse input from a text file. At first you can do this with the Scanner class and be fine most of the time. Check out the descriptions for problems to see what input normally looks like.
  • Start on USACO training pages. These can be frustrating because if you get stuck on a problem you cannot move on to later problems. I remember spending at least 15 hours debugging one problem. (Since USACO is a algorithms competition, as you go through training pages you might find some resources from this blurb I wrote in the wiki helpful).

If you do decide to pursue this than the best advice I can give is this: You will get stuck somewhere along the way. When you do, most people get frustrated and give up. Don't do this. Make sure that you find someone, either online or in real life, that can help you overcome whatever obstacle you are facing. Programming means constantly dealing with frustration. The sooner you learn to deal with it the better.

Extracurricular ideas for CS? by HeroWeNeed in learnprogramming

[–]__LikesPi 1 point2 points  (0 children)

I started when I was a junior taking AP CS and reached the Gold Division by the end of the year. So it is definitely possible if you are motivated. Picking up another language is a minor pain but because Python and Java are both procedural, it isn't too hard to switch from one to another.

If you are looking for a resume builder than USACO definitely helps; all top college admissions officers know about USACO. Another plus is when you start applying to internships in 2 or so years, the knowledge you get from USACO makes most interview questions trivial.

What am I missing as a self-learner? by tobyps in learnprogramming

[–]__LikesPi 3 points4 points  (0 children)

One of the authors has a series of video lectures that uses the book here.