Skip to main content

Posts

Showing posts with the label data structure.

Definition of Queue and its types with algorithms (Data structure)

                                 Queue  A queue is non-premitive linear data structure . It is based on first-in-first-out (FIFO) mechanism.In queue deletion can take place at one end of the list , the front of the list. And insertion can take place at the other end of the list , rear of the list.     Queues are often usde in programming networks , operating systems , and other situations in which many different processes must share resources such as CPU time. * Working Process on Queue :- By incrementing rear pointer we can insert an element in queue. By incrementing front pointer we can removew element from queue. If queue is empty then front and rear pointer must be incremented by 1 first time. When rear=size- 1 then queue is full. When front=rear then reset front=-1 and rear=-1. When front=rear=-1 then the queue is empty. Queue is different from stack in many cases. Both are  non-premitive linear data structure but the mechanisms on insertion and dele

Definition of Stack and its algorithm with working process(data structure)

                  Stack                           A Stack is  an ordered collection of items where the addition of items and the removal of existing items always takes place at the same end. This end is commonly referred to as the “top". * working method of stack :- i> Initially top=-1 ii> By increasing top pointer we can insert element    in the stack. iii> when top=size of stack-1  then stack is full. iv> By decreasing the top pointer we can remove   the   element from stack. v> when top=-1 then the stack is empty. figure shows run time stack * The fundamental operations which are possible on a stack are:-         1. push operation (insertion).    2. pop operation (deletion).    3. peep opetation(extract information).   4. update operation (change value at any position). 1. push operation:-   In case of stack Insertion of any item in stack is called   push . In stack any item is inserted from

Data Structure & its types:-

  The logical or mathematical model of a particular organisation of data is called data structure. It is the representation of the logical relationship existing between individual elements of the data.   In other words data structure is collection of data elements whose organisation is characterized by accessing operations that are used to store and retrieve the individual data elements.  A data structure mainly specifies the following things:-    i> Organisation of data.   ii> Accessing methods.  iii> degree of associativity.  iv> Processing alternative code for information. * Data structure is the basic building blocks of the program. * |The data structure is of two types:-  1. Primitive data structure.  2. Non-Primitive data structure. 1. Primitive data structure:-    These are the basic data structures and they are directly operated by a machine instructions.       In general they have different representations for different computers. It is also k