Job Saarnee

# ****************************************************Related Post

***********************************************************************************

Q1: Define the
term data structure. List some linear and non-linear data structures starting
the application area where they will be used?

OR
Differentiate
between Linear and Non-Linear Data structures?

Solution:

Data Structure can define as a means or way of organizing data in memory so that it can be used efficiently. or It can be define as a mathematical model of  particular organization of Data.

Data structure are broadly classified into two types

1.  Linear type Data Structure
2. non-Linear type Data Structure

Linear Type Data Structure

Linear Type Data Structure are the data structure which organize the data in linear manner means one after another like Array, linked list, Queue, Stack

Non Linear Type Data Structure

# Sol. The complexity of algorithm is a function f(n) which measures the time and space used by an algorithm in terms of input size ‘n’.

There are two type of Complexity
1. Time complexity
2. Space complexity

# Q10: What is space and time complexity of an algorithm?

#### Sol. Space complexity refers to the space used by an algorithm to solve any particular problem.Time complexity refers to the time required by an algorithm to solve any particular problem.

Q11: What are
the various asymptotic notations? Explain the Big
Oh notation?

Q12: Define

Sol. Space time tradeoff is a way of solving problems
or calculation in less time by using more storage space (on memory), or by
solving a problem in very small space by spending a long time. A space trade
can be used with the problem of data storage.

For example Suppose you want to reverse a String there are two procedure to do this

1.You can make use of Stack, Simply place all the elements in stack and print it by Appling Pop operation one by one.

2.You can perform this by applying  simple comparing the element.

In approach one there is a need of extra storage in term of stack but time require to perform this is very less, in comparison to second approach but in second approach there is no need of extra storage.
Q13: Write down
the properties of abstract data types (ADT)?

Q14: What do you
mean by an array?

Q15: What are
the merits and demerits of array data types?

Q16: Define
Pointer?

Sol. Pointer is a variable which contain the address of another variables.
Syntax: – data type   *ptr;

Q17: Differentiate
between array and pointers?

1. Array is a collection of similar type of data elements. It is a pointer variable the hold base address of array and pointing to the large set of similar type of elements.
but Pointer is a variable which contains the address of another variables.

2. Syntex for declaring array is
data type name_of_ array[size of array]
Syntax for declaring pointer variable
data type *ptr;
3. Array is used to store elements of same data type. but
Pointers are used to store address of variable.

************************

Q18:
Differentiate between overflow and underflow condition of a linked list?

Q19: Write a
function to reverse the list?

Q20: Given a 2-D
array A {-100: 100, -5: 50}. Find the address of element A {99,49} considering
the base address 10 and each element requires 4 bytes for storage. Follow row
major order
?
Sol. Given, a 2-D array A {-100:100, -5:50}.
Size of element, w = 4
A {99,49} =?
Number of rows = Upper Bound – Lower Bound + 1
= 100-(-100) +1 = 201
Number of columns = Upper Bound – Lower Bound + 1
=50-(-50) +1 = 56
Row Major: –
A {99,49} =10+ [(99-(-100))56 + (49 – (-5))]4
=10+ [(99+100)56 + (49+5)]4
=10+ [(199)56 + (54)]4
=10+ [11144+54]4
=10+ 4
=10+ 44792
=44802

*************************

Q21: What is
Sparse matrix? Explain the application of sparse
matrix?
Sol. A matrix contains more number of zero elements than non-zero elements such matrix is called Sparse matrix.

**********************

Q22: How can you
represent a sparse matrix in memory?

Sol. There are
two ways to represent a sparse matrix:

1. Array
representation

List representation

************************

Q23: List some