I used feedback from the code review SE for an assignment. Do I have to mark it? I wrote source code for an assignment. After I was done and the program was functional, i uploaded a piece (a class) on the Code Review SE and people gave me advice, which I then implemented. Should i credit them, and if so, how?

For pieces of code I took from Stackoverflow, for example, I would write it in a comment next to the code, and include a link. 

Should this be done in the same way for improvement suggestions? 
In my concrete example, implemented suggestions were mostly about programming language intricacies and object orientation. Another option would be to inform the professor in advance and/or ask about this being allowed.

EDIT: The assignment ist not about the programming languages or object-oriented design.
Yes, you should ask the professor in advance and make sure he/she understands what CodeReview actually is. 

More generally, you should know (and the professor should effectively communicate) what the parameters are for seeking help. I have doubts that very many professors would permit it, but some would. 

The reason for assignments isn't because the professor needs the result. It is to cause a change in your brain that won't happen if you take very many short cuts. 

Seeking help from the professor or an assistant is different, since they know the actual purpose of the individual assignment (in your learning) and can give hints that won't impede your learning, but help you deepen it. The contributors to CodeReview don't have the context (or usually the background) to do that properly. So you may be sabotoging your learning in pursuit of a better grade. Long term that's a losing game. 

Making it functional first was a good step, but there is a lot to good programming beyond functional.

And if you haven't done so, then yes, mark it and point to the source of help. If there weren't already rules around the behavior there should be no reason to punish you and you might get better advice about seeking help from the prof. In fact, you should make the note pretty visible so it just doesn't get lost. Program comments may not be read without some statement at the top pointing to them.