web 2.0

Site Update

This site will no longer be updated. Please visit ee08.net.tc from now on...















Saturday, March 6, 2010

Lab Manual 4 - Tips

Algorithm
Intersection of Lists' Function
1. Make two local position pointers, for the two input lists.
2. Make a local list, a position pointer for it and then initialize it, as in testlist.c.
3. Make two (nested) loops (by using either while or for) and populate the local list with the common elements by using the following check: "If one element of list A is same as any element of list B, then put that element in list C (local) and break the loop".  
4. Each time one element of list A has been checked with all the elements of the other list, you will move to the next element of list A and reset the position of the list B's position pointer.
5. At the end, just return the local list C.

Functions Used
1. MakeEmpty : To initialize the list e.g. A = MakeEmpty (NULL); 
2. PrintList : To print the list 
3. Retrieve : To get the contents of a particular position of list. e.g if (Retrieve(A)==Retrieve(B)), (i.e. if the elements of two lists match) then do this and that... 
4. Header : To point the position pointer to the head of list. Use it to initialize a pointer to the header of a list. 
5. First : To point the position pointer to the element next to head. It will be used to initialize a pointer to the list. 

6. Insert : To insert element e.g. Insert (Retrieve(A),I,P) to insert the element of list A to position P of list P i.e. copy it.

7. Advance : To move to next position in the list. Mostly done after check for one element is complete.


Raising a Polynomial to a Power

Just download the file polypowerN.c from the server (in the lab) and compile it to get the desired results.

2 comments:

Anonymous said...

thanks for the persons who design this web site and definitly they would be great

Anonymous said...

thanks for designing such an informative web site

Post a Comment