Facebook

Algorithms

Queues

Queues are the  data structure that stores data  in an ordered way.The  first element entered  is the  first one to be  removed.It is a  FIFO(First In First Out) data structure.The elements are added at one end called REAR end and removed from other end called as  FRONT end. In Fig 2 , FRONT = 0 and REAR = 4 Array Representation of Queue Queues can be represented by… read more »

Count number of nodes in Linked List

Counting refers to calculating number of nodes present in linked list. Program #include<stdio.h> struct node { int item; struct node *next }; int main() { struct node *start,*list,*temp; int i; start = (struct node *)malloc(sizeof(struct node)); list = start; start->next = NULL; for(i=1;i<5;i++) { list->item = i; list->next = (struct node *)malloc(sizeof(struct node)); list =… read more »

Deletion of element from array

Deleting  an  element means to remove element from the array.It is quite easy to delete the element from the end of array.On the controversial side,what is needed to delete the element from our  desired location  like somewhere in the middle of array .Deleting an element requires that all the subsequent elements must be moved one location up to… read more »

Insertion of element in an array

Inserting an element means to embed element in the array.It is quite easy to insert the element in the end of array provided sufficient memory locations are present to accommodate the additional element.On the controversial side,what is needed to insert the element at our desired location like somewhere in the middle of array .All the… read more »

Linear Search

Searching in an array refers to finding the location of a particular element in the given array. It can be done in two ways : Linear Search Binary Search Linear Search It is done by comparing each and every element of array with the data item for which index needs to be found.The data item… read more »

Traversing an Array

The various operations that are performed on arrays are : Traversal Searching Insertion Deletion Sorting and Merging Traversing in array This article explains about how to traverse in an array. Traversing means to visit/to go/travel across each and every element of an array. Program #include<stdio.h> int main() { int rank[5] = {10,20,30,13,15}; int i; printf(“\nThe… read more »

Sidebar