4.) Define Algorithm With Its Function ? ANS:-: A) Input

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

1.)What are the different characteristics of an 4.)Define algorithm with its function ?

Algorithm? ANS:- An algorithm is a set of instructions for


ANS:-- a)Input: The algorithm receives input. solving a problem or accomplishing a task. Every
Zero or more quantities are externally computerized device uses algorithms to perform its
supplied. b)Output: The algorithm produces functions in the form of hardware- or software-
output. At least one quantity is produced. based routines.
c)Precision: The steps are precisely stated. Function:-Algorithms are essential to the way
Each instruction is clear and unambiguous. computers process data, many computer program
contain algorithm. That detail the specific
d)Feasibility: It must be feasible to execute
instructions a computer should perform. In a
each instruction. e)Flexibility: It should also specific order to carry out a specified task , such
be possible to make changes in the algorithm as calculating employees paychecks or printing
without putting so much effort on it. students report card.
f)Generality: The algorithm applies to a set of 5.)Explain Linear and Non-Linear Data
inputs. h)Finiteness: Algorithm must
Structure?
complete after a finite number of instruction
ANS:-LINEAR:- a)Those data structures where
have been executed. the data elements are organised in some
2.) Explain Sparse Matrices with its ex? sequence is called linear data structure. b)Here
ANS:--In computer programming , a matrix the various operations on a data structure are
can be defined with a 2-dimensional array. possible only in a sequence i.e. we cannot insert
Any array with ‘m’ columns & ‘n’ rows the element into any location of our choice. c)
represent a mxn matrix. There may be a They can be implemented in memory using two
situation in which a matrix contains more no of ways. d)The first method is by having a linear
relationship between elements by means of
zero values than non-zero values such matrix
sequential memory locations. e)The second
is known as sparse matrix. Sparse matrix is a method is by having a linear relationship by using
matrix which contain very few non-zero links.
elements. When a sparse matrix is Examples:-array, stacks, queue, and linked list.
represented with a 2-dimensional array , we NON-Linear:-a) When the data elements are
waste a lot of space to represent that matrix. organised in some arbitrary function without any
Example:-consider a matrix of size 100x100 sequence, such data structures are called non-
containing only 10 non-zero elements. In this linear data structures. b) The relationship of
matrix, only 10 spaces are filled with non-zero adjacency is not maintained between elements of
values and remaining spaces of the matrix are a non-linear data structure.
E.X:- trees, graphs.
filled with zero. That means, totally we
allocate 100x100 x2=20000 bytes of space 6.) What is Hash Table and Hash Functions?
to store this integer matrix and to access ANS:-Hash table is a type of data structure
these 10 non-zero elements we have to make which is used for storing and accessing data
scanning for 10000. very quickly. Inseation of data type in a table
is based on a key value, hence every entry in
3.) Define Data structure with example?
the hash table is defined with some key.
ANS:- Data Structure can be defined as the 7.) Explain stack implementation and reprtion
group of data elements which provides an with its example?
efficient way of storing and organising data in
ANS:-Stacks can be implemented in two ways,
the computer so that it can be used
a)Stack implementation:-uses arrange to create
efficiently. Data Structures are the main part
of many computer science algorithms as they stack. Stack implementation thought a very simple
enable the programmers to handle the data in technique but its not a flexible way of creation, as
an efficient way. It plays a vital role in the size of stack has to be declare during program
enhancing the performance of a software or a design, after that size cannot be varied.
program as the main function of the software b)Dynamite implementation:-also called linked list
is to store and retrieve the user's data as fast representation and uses pointers to implement
as possible. the stack types of data structure.
EX:- arrays, Linked List, Stack, Queue.
8.)Explain Queue implementation and
representation and its type with example?
ANS:-Queue is an abstract data structure
sometimes similar to stacks, unlike stacks a
queue is open at both the ends. One end is
always used to insert data (queue) and the
other is used to remove data deaveue.
Its Type’s:-a)Simple Queue:-ex. “we wait in a
line for movie”.
b)Circular Queue:-ex. “Traffic light”.
c)Double ended Queue.
d)Priority Queue.

You might also like