Data Structure Tutorial

Introduction to Pointer

Introduction to Pointer To understand pointers, you need a basic knowledge of how your computer stores infor-mation in memory. The following is a somewhat simplified account of PC memory storage. Pointers are so commonly used as references that sometimes people use the word “pointer” to refer to references in general; however, more properly it only …

Introduction to Pointer Read More »

Introduction to Arrays

Introduction to Arrays An array is a data structure used to process multiple elements with the same data type when a number of such elements are known. You would use an array when, for example, you want to find out the average grades of a class based on the grades of 50 students in the class. …

Introduction to Arrays Read More »

Application of Arrays

Application of Arrays Whenever we require a collection of data objects of the same type and want to process them as a single unit, an array can be used, provided the number of data items is constant or fixed. Arrays have a wide range of applications ranging from business data processing to scientific calculations to …

Application of Arrays Read More »

Array Manipulation

Array Manipulation Shown next are C programs for carrying out manipulations such as finding the sum of elements of an array, adding two arrays, and reversing an array. Program ADDITION OF THE ELEMENTS OF THE LIST #include<stdio.h> #include<conio.h> void main() { void read(int *,int); void dis(int *,int); int a[5],i,sum=0;   clrscr(); printf(“Enter the elements of …

Array Manipulation Read More »

What is Merging Array?

Merging Array Assume that two lists to be merged are sorted in descending order. Compare the first element of the first list with the first element of the second list. If the element of the first list is greater, then place it in the resultant list. Advance the index of the first list and the …

What is Merging Array? Read More »

What is Sorting Arrays?

Sorting Arrays We encounter several applications that require an ordered list. So it is required to order the elements of a given list either in ascending/increasing order or descending/decreasing order, as per the requirement. This process is called sorting. Sorting Array using Bubble Sort Bubble sorting is a simple sorting technique in which we arrange the elements of the list …

What is Sorting Arrays? Read More »

Working with Stacks | Stack and Queue Data Structure

Working with Stacks A stack is simply a list of elements with insertions and deletions permitted at one end—called the stack top. That means that it is possible to remove elements from a stack in reverse order from the insertion of elements into the stack. Thus, a stack data structure exhibits the LIFO (last in first out) property. Push and pop are the operations that are provided for …

Working with Stacks | Stack and Queue Data Structure Read More »

Working with Queues | Stack and Queue Data Structure

Working with Queues One of the applications of the stack is in expression evaluation. A complex assignment statement such as a = b + c*d/e–f may be interpreted in many different ways. Therefore, to give a unique meaning, the precedence and associativity rules are used. But still it is difficult to evaluate an expression by computer in …

Working with Queues | Stack and Queue Data Structure Read More »

Concept of Linked List

A linked list is one of the fundamental data structures, and can be used to implement other data structures. It consists of a sequence of nodes, each containing arbitrary data fields and one or two references (“links”) pointing to the next and/or previous nodes. The principal benefit of a linked list over a conventional array …

Concept of Linked List Read More »

Counting No. of Nodes in a List | Linked List Data Structure

Counting the number of nodes of a singly linked list requires maintaining a counter that is initialized to 0 and incremented by 1 each time a node is encountered in the process of traversing a list from the start. Here is a complete program that counts the number of nodes in a singly linked chain p, where p is a pointer to the …

Counting No. of Nodes in a List | Linked List Data Structure Read More »

Concept of Tree

Definition of Tree A tree is a widely-used data structure that emulates a tree structure with a set of linked nodes. A tree is a set of one or more nodes T such that: there is a specially designated node called a root The remaining nodes are partitioned into n disjointed set of nodes T1, T2,…,Tn, each of which is a …

Concept of Tree Read More »

Scroll to Top