Facebook

C

Merge Sort

Merge sort is the divide and conquer method to arrange elements in the order.The steps followed in merge sort are : Divide the sequence of n elements into two sub-sequences of n/2 elements each. Sort the sub-sequences using merge sort.If the size of sequence is 1,nothing more can be done. Merge the sub-sequences to form… read more »

Bubble Sort

Bubble Sort is a sorting technique which arranges elements in the increasing order by moving across the array and swapping the adjacent elements that are out of order. The complexity of bubble sort is O(n2). The steps followed are : Move from first to the last element of array. Swap the element if it is… read more »

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 »

Stacks

Stacks are the linear data structure which stores data in an ordered way.The first element inserted is at the bottom and last element is at the top.It can be implemented using an array or a linked list.It is a LIFO(Last In First Out) data structure.This means that last element inserted will be first element to… read more »

Insertion in Linked List

There are three ways to insert element in the linked list. Insertion in the beginning Insertion at the end At any location of user choice The following program deals with insertion in linked list. Program 1 #include<stdio.h> #include<stdlib.h> struct node { int data; struct node *next; } *head,*var,*trav; void insert_at_begning(int value) { var=(struct node *)malloc(sizeof… read more »

Linked Lists

Linked List is the data structure that stores data elements  in a sequence. Each data element is called a Node.Each node further contains data field/fields and a pointer(Refer :Pointers ) to next node(Fig 1). The  left part  of node has a data item and the right part of node has the address of succeeding node.The  address of elements may be  sequential or may be not. START  node has the address… read more »

Pointers in C

Pointer is a variable which stores address of another variable(memory location which has certain value).When we declare a variable ,a specific memory is allocated to the variable depending on the data type.Consider the following statements : int age = 25; //Fig 1 float percentage = 90.6; //Fig 2   A specific memory location(Say 200) is… read more »

Structures in C

Structure is a user defined data type which can store related information of different or same data types all together.Whether be it a employee whose information like name,salary,address,contact no  and date of joining is to be stored or whether it be a student whose name,marks,section,contact no,etc is to be stored,structures are an efficient way to… 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… 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 »

Sidebar