This is a new blog concerning recursion. We started learning recursion this week. Recursion is a type of function that keep calling itself. So you have to see how the thing is done only if you trace it. It is hard to follow thing in recursion because you have a lot of calling on itself. It is good for finding the depth of a nested list. It is easy because I simply don't know the depth and recursion does it for me.
Recursion is good in finding parameter such as depth that you don't know but it can blow up the memory in your computer called over flow so I don't like it in that way
Thursday, 25 February 2016
4th blog
This is a late blog for last week. I had been thinking really hard on LinkedList. Linked list consist of 2 parameters value and next. value is stored in this node and next refer to the next node. It was unclear for me that how does assigning node to next made them connected and later on I realized that I was assigning memory address to the next. The memory address made the whole thing smooth. I also did a=b on them and discovered that the what I changed on a changed b.
What I learned is that a=b assign the memory of a to b and that's how the thing works. By understanding memory made the whole thing make much more sense. so I need to get a copy of b to a.
What I learned is that a=b assign the memory of a to b and that's how the thing works. By understanding memory made the whole thing make much more sense. so I need to get a copy of b to a.
Thursday, 4 February 2016
Second blog
This week I am very interested in LinkedList. It is said that they are efficient in memory allocation and every node contains a value and next item. The next item points to the next node and the value is stored inside this node. The node is connected to a chain of nodes in a very simple way and it is just like a list but save spaces for memory.
I lecture we learned that for a linked list, it can contain front, back and size. The front points to front of the node and back points to back.The variable size is used to keep track of size of the node. When adding nodes to the back first I need to set the next of the back to the item that we are adding and point back to the new item. It is very interesting.
Subscribe to:
Posts (Atom)