1. What is data structure?
Ans: The logical and mathematical model of a particular organization of data is called data structure. There are two types of data structure
i) Linear
ii) Nonlinear
Ans: The logical and mathematical model of a particular organization of data is called data structure. There are two types of data structure
i) Linear
ii) Nonlinear
2. What are the goals of Data
Structure?
Ans: It must rich enough in structure to reflect the actual relationship of data in real world. The structure should be simple enough for efficient processing of data.
Ans: It must rich enough in structure to reflect the actual relationship of data in real world. The structure should be simple enough for efficient processing of data.
3. What does abstract Data Type
Mean?
Ans: Data type is a collection of values and a set of operations on these values. Abstract data type refer to the mathematical concept that define the data type.
It is a useful tool for specifying the logical properties of a data type.
ADT consists of two parts
1) Values definition
2) Operation definition
Example:-The value definition for the ADT RATIONAL states that RATIONAL value consists of two integers, second doesn’t equal to zero.
The operator definition for ADT RATIONAL includes the operation of creation (make rational) addition, multiplication and test for equality.
Ans: Data type is a collection of values and a set of operations on these values. Abstract data type refer to the mathematical concept that define the data type.
It is a useful tool for specifying the logical properties of a data type.
ADT consists of two parts
1) Values definition
2) Operation definition
Example:-The value definition for the ADT RATIONAL states that RATIONAL value consists of two integers, second doesn’t equal to zero.
The operator definition for ADT RATIONAL includes the operation of creation (make rational) addition, multiplication and test for equality.
4. What is the difference between a
Stack and an Array?
Ans:
Ans:
STACK
i) Stack is a ordered collection of items
ii) Stack is a dynamic object whose size is constantly changing as items are pushed and popped .
iii) Stack may contain different data types
iv) Stack is declared as a structure containing an array to hold the element of the stack, and an integer to indicate the current stack top within the array.
ARRAY
i) Array is an ordered collection of items
ii) Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array
iii) It contains same data types.
iv) Array can be home of a stack i.e. array can be declared large enough for maximum size of the stack.
ii) Stack is a dynamic object whose size is constantly changing as items are pushed and popped .
iii) Stack may contain different data types
iv) Stack is declared as a structure containing an array to hold the element of the stack, and an integer to indicate the current stack top within the array.
ARRAY
i) Array is an ordered collection of items
ii) Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array
iii) It contains same data types.
iv) Array can be home of a stack i.e. array can be declared large enough for maximum size of the stack.
5. What do you mean by recursive
definition?
Ans: The definition which defines an object in terms of simpler cases of itself is called recursive definition.
Ans: The definition which defines an object in terms of simpler cases of itself is called recursive definition.
6. What is sequential search?
Ans: In sequential search each item in the array is compared with the item being searched until a match occurs. It is applicable to a table organized either as an array or as a linked list.
Ans: In sequential search each item in the array is compared with the item being searched until a match occurs. It is applicable to a table organized either as an array or as a linked list.
7. What actions are performed when a
function is called?
Ans: When a function is called
i) arguments are passed
ii) local variables are allocated and initialized
ii) transferring control to the function
Ans: When a function is called
i) arguments are passed
ii) local variables are allocated and initialized
ii) transferring control to the function
8. What actions are performed when a
function returns?
Ans:
i) Return address is retrieved
ii) Function’s data area is freed
iii) Branch is taken to the return address
Ans:
i) Return address is retrieved
ii) Function’s data area is freed
iii) Branch is taken to the return address
9. What is a linked list?
Ans: A linked list is a linear collection of data elements, called nodes, where the linear order is given by pointers. Each node has two parts first part contain the information of the element second part contains the address of the next node in the list.
Ans: A linked list is a linear collection of data elements, called nodes, where the linear order is given by pointers. Each node has two parts first part contain the information of the element second part contains the address of the next node in the list.
10. What are the advantages of
linked list over array (static data structure)?
Ans:
The disadvantages of array are
i) unlike linked list it is expensive to insert and delete elements in the array
ii) One can’t double or triple the size of array as it occupies block of memory space.
Ans:
The disadvantages of array are
i) unlike linked list it is expensive to insert and delete elements in the array
ii) One can’t double or triple the size of array as it occupies block of memory space.
In linked list
i) each element in list contains a field, called a link or pointer which contains the address of the next element
ii) Successive element’s need not occupy adjacent space in memory.
i) each element in list contains a field, called a link or pointer which contains the address of the next element
ii) Successive element’s need not occupy adjacent space in memory.
No comments:
Post a Comment