Saturday, March 13, 2010

A class to perform like Linked list

Linked list is a common data structure type. FIFO (First In First Out) is its principle. Click here to see more about linked list.

Here is my solution:
A class named queue that can perform like a doubly-linked list.

It's really a basic version that only works for int right now, but it can be improved to associate with other data types and derived data types.

1 comment:

  1. Actually... Linked list is a common data structure but that just means that it is the underlying storage method. It does not have to be FIFO. That would be a Queue.

    A Queue is what is called an abstract data type. That is, no one really cares how a queue is implemented. It can be done with an linked list or an array even. Its job is organize the data coming in so that that the data it stores is added and removed in the FIFO manner.

    If you are interested, here you can find both (on matrix)in the directory /home/catherine.leung/dsa555/

    queuelist.h for linked list implementation of a queue (you will also need clist.h)

    and

    queuearr.h for array implementation of a queue

    queuemain.cpp for the tester for them.

    ReplyDelete