Monthly Archives: September 2008

  • 1

Linked list in C-Language

Link List:

Link List is a collection of Nodes. Each node consists of a Data field and Address of Next field in the linked list.

Single Linked List consists of Data and Address of next field

Single Linked List consists of Data and Address of next field

Linked is used in case of dynamic memory allocation which avoids the concept of allocating memory to variables at compile time. In this case we can creae nodes at run time, so the memory allocattion will be done at run time.

Linked list can be developed using the user defined data types. i.e Structure

struct list {
int data;
struct list * next;

Here in above example list is the name of structure which contains two field data and next. data will contain the data to be entered by user and next field will contain the address of next node in the linked list.  Here next is pointer to structure which will be pointing to object of same type.

The various operations that we can perform on Linked List are:

1.  Create Linked List
2.  Insert a new node into Linked List at any desired position
3.  Delete a node from any desired location in a linked list
4.  Calculating length of a linked list
5.  Copy Linked List to another Linked List
6.  Reverse of a linked List
7.  Concatenation of two Linked Lists
8.  Searching an element in a linked list
9.  Sorting of a Linked List

All these programs are going to be published on this website soon, Linked List users stay tuned with this website, the programs will be written in C-Language.

Bookmark and Share

  • 4

MVC Architecture

MVC architecture  is basically designed to separate the business logic and application data from the presentation data to manage easily.
MVC stands for L Model – View – Controller

1).  Model: The model object knows about all the data that need to be displayed. It is model who is aware about all the operations that can be applied to transform that object. It only represents the data of an application. The model represents enterprise data and the business rules that govern access to and updates of this data. Model is not aware about the presentation data and how that data will be displayed to the browser.

2). View : The view represents the presentation of the application. The view object refers to the model. It uses the query methods of the model to obtain the contents and renders it. The view is not dependent on the application logic. It remains same if there is any modification in the business logic. In other words, we can say that it is the responsibility of the of the view’s to maintain the consistency in its presentation when the model changes.

3). Controller:  Whenever the user sends a request for something then it always go through the controller. The controller is responsible for intercepting the requests from view and passes it to the model for the appropriate action. After the action has been taken on the data, the controller is responsible for directing the appropriate view to the user. The views and the controllers work very closely together.

Advantages of using the MVC Architecture.

1. Code developed using MVC is resuable
2. When the problems recurs, there is no need to invent a new solution, we just have to follow the pattern and adapt it as necessary.
3. By using the MVC design pattern our application becomes more expressive.
4. Expaning of an application is very easy as business logic is seperated from UI.
5. Tomorrow if you need to switch the database from, say, SQL to Oracle you dont need to change the whole application, only the Model layer will be changed.

Bookmark and Share