User Tools

Site Tools


opus:spring2015:apardini:start

Anthony Pardini's spring2015 Opus

Introduction

Still new to the world of programming. working hard to achieve the skill to naturally produce complex programs in C.

Data Structures Journal

January, 23rd-27th 2015

Most of the break I spent my time studying a C programming book that was easy to understand. The book used a simple approach to describing the abilities and also displayed code with the output produced. This made approaching the introduction project easier. From my experience in the last C programming course i was struggling to build the interest to tackle difficult problems and often resulted in using online sources for guidance, which often makes the situation even worse

When multiple problems occur that need attention i will outline the situation and post it to my current opus entry at the time. This will be great for reference. programs will be produced for my repository that outlines these problems and give examples through simple programs. This will be useful for reference when building other programs.

My understanding of loops was fairly basic before this data structures course commenced. Knowing the purpose and how to implement them in a simple program helped but caused for multiple errors during run time when loops got more detailed. As i progressed i began to realize the importance of indentation and the better loop structure. My initial loop structure was more block formed. adding {} to single case for loop made my work flow better and reduced syntax errors that i was experiencing earlier.

January, 27th-February 04th 2015

Introduction the Structs

The use of struct is a complex data type that adapts to the size of what data it contains. Structs are able to store different data types to use. can contain and INT or CHAR. Grouping data types will make implementation easier.

Data Structures creates the ability to produce more complex and efficient programs. type of data structure and algorithm choice is essential when managing memory. Any data structure requires space for each item to be stored.

Stacks & Queues.

A Stack is a container of objects that gets inserted and removed. This is achieved by the last in first out(LIFO) rule

A Queue is a container of objects that gets inserted and removed(linear based). This is achieved by first in first out rule(FIFO).

Pointers

A pointer has a separate feature named a pointee. The pointee needs to be set up for the pointer to be successful. Its is important to deference a pointer to access its pointee.

The relationship between the pointer and pointee is the key characteristic that makes pointers a key programming tool. Pointers are the foundation towards complex data structures.

The Assignment( = ) is used to make two pointers point at a same pointee.

  1. * = (De-reference)
  2. & = (Address of)

Malloc() is an important system function that allocates a block of memory in a heap and returns a pointer to the new block. The argument type to malloc is the byte size of the integers block.

February 04th - February 11th 2015

Nodes and Linked Lists.

Nodes are building blocks of linked list

Linked lists essentially functions as an array that can expand and shrink at any given location. A linked list is storing data with a structure that enables a user to create a new place to store data. The first node is always stored as the starting base of the list

A linked list has some advantages over using an array

  • Items can be edited from the center of list
  • No size needs to be defined

However they also have some disadvantages.

  • The list will need to be searched from beginning to end until required item is revealed. The address will also be recorded. Only the address of the first node is stored. To accesss a desired node the list must traverse from the beginning to end.
  • No random access available
  • Pointers require extra memory for storage

Node (A structure having two value containers) Data is stored with the address of another structure. Memory is stored and created with a node each time.

February 15th - February 20th 2015

Work on Linked Lists - Array vs Linked list

An Array works constantly when accessing an element. An Array is stored as one contiguous block of memory. A linked list has multiple blocks on memory at different addresses stored as a node. The address of the head node is the head node which identifies the list.

when you need to access an elements in a list all the time an array would be the best option. Arrays can be set to have unused memory for latter access, or will be wasted.

Linked lists with nodes have no unused memory Extra memory is reserved for pointer variables when the data part of a linked list contains a larger complex data type a linked list is ideal to use with regard to memory storage Memory can often not be available as one large block when creating a large array.

Insertion into the list involves having to shift elements in an array this is time consuming. Inserting a node at the beginning of a linked list means creating a new node an adjust the head/start pointer.

February 25th - 3rd March 2015

Project Work

These last few projects have taught me a lot quickly. My understanding of linked lists has strengthened. The next addition to our project list was SLL1. The last 3 projects have been linked together progressing towards a complete function library. Through trial and error i have noticed that it is important to have each function 100% complete in order to move on.

March, 6th-15th 2015

Project Work

Towards the end of the week i had to submit SLL2. i still have compare.c and sort.c outstanding. Clear list and Rm list were fairly simple. Obtain took some time and swap still is an incomplete problem. We have gone through a lot work in a short period of time. It is important to have full understanding of content before progressing. I need to be sure that i fully comprehend the help i am receiving otherwise success in any sort of final exam or project will be useless.

Choosing the ideal data structure

Algorithms

begins with an initial state and ends at a specified state, the process between contains multiple well-defined instructions needed to solve a given problem. how complex and efficient the algorithm is important when deciding what data type to use. algorithm analysis can be used to determine how much time and or storage is required for an algorithm.

A great way to display algorithms is the use of pseudo-code and flowcharts, drawing out the steps is very important.

March, 15th-22nd 2015

Project SLL3 deadline was extended a week. Great because it gave me time too catch up with things. I was able to implement qty in my list functions by adding qty++ a few times in each function. ldisplay.c took me some time i struggled with the return part and the pos selection. Eventually i has a good idea that would work. i Called to displayf with an incremental tmp node. I had some horrible run time errors that eventually turned out being being a simple issue.

for (i = 0; i <= pos-1; i++)    - In this for loop the <= was the error run killer.

* March 24 2014

Doubly Linked Lists

So far with the singly linked list of nodes we have worked with the data/qty and an after→ pointer. Access to the previous node has not be available. Adding this previous feature can make life coding a lot easier. We can start at the beginning of the list and navigate through or at the end and use the previous pointer to do the same. From any location up and down the list.

struct node 
{
  int data;
  struct node *prev;      //Previous pointer added
  struct node *after;
 }

March, 25th-2nd April 2015

PROJECT WORK

Almost finished the groups project. Getting lgetpos to run correctly was a struggle due to the empty group & empty list part.

Today i began work on Doubly Linked Lists (DLL0) editing the nodes was easy. adding the prior pointer to the list functions will be tricky. doubly linked list have been difficult. I am still struggling on mk.c amd deadline is Wednesday April 08

Doubly linked list work

Doubly linked feature enables the before and after feature which gives the ability to traverse the list easier.

TWO LINKS - before&after = DOUBLY LINKED LIST

An example when inserting a node at the end of a doubly linked list. Three pointers will need to be edited for this to occur the prior pointer for newNode and and the after pointer in the current end node. list last will also need to changed.

  1. newNode→prior = last;
  2. Item tail→after = newNode;
  3. last = newNode;

April, 07-14 April 2015

PROJECT WORK

Unfortunately i have fallen behind with the doubly linked list functions. Even the simplest ones are giving me issues. I am spending a lot of time trying to get these done and getting no where is pretty frustrating. The joys!

I found this awesome picture online explaining doubly linked lists. Link - (http://www.equestionanswers.com/c/c-doubly-linked-list.php)

Stacks

The next project involves stacks. This data structure involves the method of (LIFO) Last in first out! objects can be inserted and removed from the “top” of the list if the sequence A,B,C,D, was used for a list the last in first out would be (D). This data type is restricted due to limited amount of operation that can take place.

Pushing

When pushing, this involves inserting a value to the top of the stack.This new top pointer has to be linked to the next address to maintain list integrity.

Newnode → after = myStack → top; Newnode = Mystack → top;

Popping

This involves copying the stacks top value. The top value will be removed/obtained therefore the stack pointer will need to be edited in order to point to the next node to maintain list integrity.

popNode = myStack → top; myStack → top = myStack → top → after;

April, 20-27 April 2015

PROJECT WORK

This week I have been working on the queues project. So far so good, still have some mismatches here and there and dequeue needs to be checked out by Matt. I hope to have this project completely finished by Wednesday with 0 mismatches! The Stacks project didn't go so well and unfortunately was submitted with more mismatches then matches.

Queues

The idea with queues involves the common idea where a queue is formed with a first in first out formation (FIFO). When we need to obtain the first member of a group when it was the first item to enter. Making this a data structure that is able to insert at the back and obtain from the front of the list.

We enqueue items at one end a dequeue items at the other end.

opus/spring2015/apardini/start.txt · Last modified: 2015/01/20 00:53 by 127.0.0.1