CEG's Linux User Group

  • Increase font size
  • Default font size
  • Decrease font size
Home Labs
Labs

Merge lists

E-mail Print
User Rating: / 8
PoorBest 

MERGE LISTS

Introduction :


The objective of this program is to merge two lists into one. Merging two lists will just insert the elements of both the lists into the new one and will not delete the duplicate elements. Consider two lists each of 2 nodes. Let l1 and l2 be the pointers pointing to the first elements of lists 1 and 2 respectively. The lists l1 and l2 are shown below.
Last Updated on Monday, 08 June 2009 16:49 Read more...
 

Singly Linked List

E-mail Print
User Rating: / 13
PoorBest 

SINGLY LINKED LIST

Linked list is one of the fundamental data structures which can be used to implement other data structures.A linked list is essentially a collection of nodes.Each node consists of two fields. The first field, known as the data field holds the value or data and the second field, known as the address field holds the reference to the next node or is assigned NULL(if the linked list is empty). The main feature that distinguishes a linked list from an array and makes it advantageous is the fact that the elements in a linked list are not stored in contiguous memory locations(like array elements).

Last Updated on Thursday, 11 June 2009 13:54 Read more...
 

Double stack implementation(with structures)

E-mail Print
User Rating: / 15
PoorBest 

DOUBLE STACK IMPLEMENTATION

(with structures)

Introduction :

Double stack means two stacks which are implemented using a single array. To prevent memory wastage, the two stacks are grown in opposite direction.

Structure has the following advantages.

  • Clarity

As programs get bigger, they get more confusing if they're not structured. Restricting programming logic to structures that have only one point of exit and entry makes it much easier to track the 'flow' of logic.

  • Efficiency

  • Maintenance
    Programs that follow a consistent set of clearly defined structures (having single points of entry and exit) are much easier to read and debug. Especially when maintenance issues arise long after the program is written.

    Last Updated on Saturday, 06 June 2009 19:43 Read more...
 

Double-stack implementation

E-mail Print
User Rating: / 8
PoorBest 

DOUBLE STACK - ARRAY IMPLEMENTATION

Introduction :

Double stack means two stacks which are implemented using a single array. To prevent memory wastage, the two stacks are grown in opposite direction. The pointer tops1 and tops2 points to top-most element of stack 1 and stack 2 respectively. Initially, tops1 is initialized as -1 and tops2 is initialized the capacity. As the elements are pushed into stack 1, tops1 is incremented. Similarly, as the elements are pushed into stack 2, tops2 is decremented. So, the array is full when tops1=tops2-1. Beyond this, pushing an element into any stack will lead to overflow condition.

Last Updated on Friday, 05 June 2009 16:56 Read more...
 

DeleteDuplicate elements in List

E-mail Print
User Rating: / 8
PoorBest 

DELETE DUPLICATE ELEMENTS IN A LIST

Introduction :

Linked lists are used to organize data in specific desired logical order, independent of the memory address each node is assigned to. Linked list data storage works best with data arrays in which one doesn’t know how large the array will need to be or when there is a certainty of more data being added or subtracted at later times.

Last Updated on Tuesday, 09 June 2009 12:59 Read more...
 

Sort list

E-mail Print
User Rating: / 9
PoorBest 

SORTING A LIST

Introduction :

The aim of this program is to sort the elements of the list. This is done by considering each element and placing it before an element greater to it. Consider the following list of 3 nodes.

Last Updated on Saturday, 06 June 2009 19:00 Read more...
 

Split list

E-mail Print
User Rating: / 9
PoorBest 

SPLIT LIST

Introduction :

A linked list is data structure that consists of a sequence of data records such that in each record there field is a that contains a link to the next record in the sequence. Consider the following list which has 4 nodes in it. The fourth node point to NULL marking the end of the list. The 'header' pointer points to the first node. The list is split at second position as shown below

Last Updated on Saturday, 06 June 2009 19:42 Read more...
 


Page 3 of 4