RicardoB Posted April 8, 2010 Posted April 8, 2010 Hi, I'm starting my career in Computer Science,but latetly I been having trouble on the class Data Structures. My main problem since the begining is I am more of a person that has to seat down take its time to actually code something, and sometime si have difficulties on how to do it. I know most of you will probably say this is not right for me then, but i do like it and i want to learn. Can you give some feedback, advice on how you guys approach problems i mean what do you do. For example i get blocked during a test if they ask me like write a method that computes the largest element in a B-Tree (java language). Im really concern now about my issue hope you people out there can help me, i really will appriciate it. Im desperate now.
bascule Posted April 10, 2010 Posted April 10, 2010 You need to think about how to break the problem down into a series of steps. How do you find the largest element in a b-tree? Well, a b-tree is already in order, so finding the largest value is simple. Generally the largest value will be stored in the rightmost leaf, so you start at the "root" of the tree and keep taking the rightmost branch, walking the tree a node at a time and every time taking the rightmost branch until you hit a leaf. In a real "b-tree", this leaf will contain an array of values. The rightmost entry in this array will contain the largest value in the b-tree. If you're having problems doing this, you really need to study b-trees better.
khaled Posted April 23, 2010 Posted April 23, 2010 i think you have to realize that there is "untold" step before writing the code, which is writing algorithm
JamesNBarnes Posted May 22, 2010 Posted May 22, 2010 (edited) The best advice i can give is, firstly make sure you understand the problem in its entirety. If its in a test all you can do is make sure you follow the spec to the letter. If its in a more real world setting, ask questions, lots of them. Even the most basic questions can be important. As a general rule, if in doubt, ask. Any one who looks down on you for asking questions is a fool. Actually, i just reread that, i should be more specific... If you are asking "how do i compile this" then you need to go and work on your skills. If you are asked to write a method to compute something by your supervisor, ask questions like "what will it be used for?" and "how will it be used" etc etc. This helps eradicate any misunderstandings, its worth bearing in mind, that the person who has assigned you a task may not have any knowledge of how it will be used, if they cant answer, find someone who can. After you know exactly what you need to produce, break it down into a series of discrete and simple steps. Personally i scribble in a notebook with lots of arrows and such Once you have the structure of the program, you can implement it step by step. When you have it working, test it thouroughly (better yet, get a coworker to). Once you are happy with that, you can look into optimising it. Edit: Practice a lot. Sit down and think of some interesting programs to write, and start writing them! Anything, even if other programs already exist that do it, write one yourself. Challenge yourself though, don't start a project that you know you can finish easily. Try something that seems beyond your skills, you will often surprise yourself, and even if you cant finish it, you will be taking away valuable lessons. Practice will improve your intuition, and that cuts down on development time, and makes it easier to spot your mistakes. Lastly, and this may be controversial, if you don't enjoy it, perhaps programming isnt for you. Everybody gets frustrated and walks away from the keyboard from time to time, but if you find yourself running back 30 seconds later then you know you have the bug A lot of the time it takes determination to do it, and if you don't enjoy doing it, that determination can be hard to find. There are a lot of things one can do in computer science besides writing software. J Edited May 22, 2010 by JamesNBarnes
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now