Articles in the Data Structures Category
Data Structures, Linked List, Programming »
The following code is for the ListNode class of List node objects. This example list program is built for storing strings. The list node class given here has two data members viz., Data and Link. Data is of the type string to store list item in it and Link is again of the type ListNode to refer next node in the list.
Though .Net contains inbuilt classes for creating linked lists, the recoded C# program given here is to help the readers to understand how the linked lists are really working. …
Data Structures »
Stack is an ordered list in which all insertions & deletions are made at only one end, called Top. It operates in principle of last-in-first-out (LIFO) which means the items inserted at last is removed first. For example, if the elements A,B,C and D are inserted in to the stack in the same order then the removal of all elements will be in the reverse order (D,C,B and A).
Data Structures, Linked List, Programming »
In an array, elements are physically stored in consecutive places. Since we know element number x will be available in the place A+X-1, where A is the starting location of the array, accessing elements is very faster one-by-one or randomly. But, think about rearranging these numbers. In order to place an element between two other numbers, we have to make a place empty between them. It is very tedious to move the entire elements to subsequent places to make a room for the new number. Deletion is also the same …
