0% found this document useful (0 votes)
77 views8 pages

DS VIVA Questions

The document contains questions and answers related to data structures and algorithms. It discusses key concepts like algorithms and their characteristics, complexity analysis, asymptotic notations, abstract data types, primitive operations on data structures, linear and non-linear data structures, searching, sorting, recursion, stacks, queues, trees and their applications.

Uploaded by

sreenivasraor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views8 pages

DS VIVA Questions

The document contains questions and answers related to data structures and algorithms. It discusses key concepts like algorithms and their characteristics, complexity analysis, asymptotic notations, abstract data types, primitive operations on data structures, linear and non-linear data structures, searching, sorting, recursion, stacks, queues, trees and their applications.

Uploaded by

sreenivasraor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Surana College (Autonomous)

Dept. of Computer Science

Data Structures VIVA

1. What is an algorithm?
A sequence of computational steps that transform the input into the output.

2. What are the characteristics of an algorithm?


• An algorithm should start with “start “and end with “stop”.
• An algorithm should be easy to understand.
• Algorithm should contain steps.
• Steps should have step numbers.
• Step numbers should be a positive value.
• Step numbers should be in ascending order.
• Algorithm should contain finite number of steps.
• Algorithm should accept one or more inputs and produce the output.

3. How to measure the complexity of an algorithm?


Complexity of an algorithm is measured in 2 ways ,they are;
• Time complexity: The amount of time that needs to complete the task .
• Space complexity: The amount of space that is needed in order to run the
completion.
4. What is an asymptotic notation?
It means a line that continuously approaches a given curve but does not meet at any finite
distance.

5. What is an abstract data type?


It is a data structure that can be used with the elements of the data structure and make
use of the operations associated to the data structure without knowing how they are
working.
Ex : array ..stack ..queue, linked list.etc

6. What is time complexity?


The amount of time that needs to complete the task .

7. What is space complexity?


The amount of space that is needed in order to run the completion.

8. What is an array?
It is a collection of similar data items that shares a common name.

9. Give the memory representation of an array ?


Array occupies sequential memory locations .
10 20 30 40 50
a[0] a[1] a[2] a[3] a[4]
10. What is a sparse matrix?
It is a matrix in which the number of zero(0) entries are much higher than the number of
non-zero entries.

11. What are the types of sparse matrix?


There are three types of sparse matrices , they are; ➢ Upper
triangular sparse matrix.
 Lower triangular sparse matrix.
 Tridiagonal sparse matrix.

12. Mention the operations of primitive data structures?


• Create
• Select
• Update
• Delete

13. What is linear data structure?


The elements of the data structure forms a line or a sequence . such data structures are
called linear data structures.

14. What is a searching?


It is a process of searching an element and its location from a given collection of elements.

15. What is sorting?


It is a process of arranging the elements in a specific order may be in ascending or
descending order.

16. What is the requirement for binary search?


The primary requirement for the binary search is that the elements must be in sorted
order.

17. What are the differences between linear search and binary search?
Linear search Binary search

When there are less number of When there are large number of
elements , linear search is the best elements , binary search is the best
method to search. method to search.

Best case is to find the element in Best case is to find the element in
the 1st position. the middle element.

Less efficient More efficient

18. What is the other name for Bubble sort?


Bubble sort is also called as sort by exchange.

19. Define stack?


Stack is a linear data structure in which the elements can be inserted and deleted from the
same end called as the TOP of the stack.

20. Expand LIFO.


Last in first out.

21. What is overflow and underflow?


Overflow: If the stack is full and if we try to insert an element ,this condition is called
overflow.
Underflow: If there are no elements in the stack , then we try to delete the element from
the stack, this condition is called underflow.

22. How to represent stack in memory?


 Stack can be represented using array: array occupies sequential memory locations.
hence, the elements of the stack also occupies sequential memory locations.
 Stack can be represented using linked list : the elements occupies random memory
locations.
23. What is a queue?
A queue is an ordered collection of items where an item is inserted at one end called as
the “rear” and an existing item is removed at the other end ,called as the “front”.

24. What are the types of queues?


Queues can be of four types;
• Simple queue
• Circular queue
• Priority queue
• De-queue(double ended queue)

25. What is overflow and underflow in linear queues?


Overflow: if the queue is full and if we try to insert a new item to the rear of the queue ,
this condition is called overflow.
Underflow: if the queue is full and if we try to remove the front item from the queue, this
condition is called underflow.

26. What is recursion?


Recursion is a process of calling a function by itself for a finite number of times.

27. What is the towers of Hanoi problem?


Towers of Hanoi is a game begins with three poles and n disks ,where all the n disks are
stacked on the left most pole labeled as ‘A’. the disks are of different size and stacked in
the decreasing order with the largest disk on the bottom and smallest on top.

28. What are the applications stacks?


• A general example that can be given to use stack is the calculator .almost all the
calculators accept standard format of expression called “infix notation”.
• Recursion- to implement the concept of recursion we use stack , a recursive
function has 2 parts in it , they are; ▪ Base condition ▪ Recursive call.
29. What is an infix notation expression?
If the operator is in between two operands, such expressions is called an infix notation
expression.

30. What is a prefix notation expression?


If the operator is before he operands, then such expression is called prefix notation
expression.

31. What is a postfix expression?


If the operator is after the operand , such expression are called as postfix expression.

32. What is a double ended queue?


It is a queue in which insertion and deletion takes place at both ends of the queue.

33. What is a priority queue?


It is a queue that contains items that have some present priority.an element can be
inserted or removed from any position depending upon some priority.

34. What is the difference between linear queue and circular queue?
Linear queue Circular queue

In linear queue insertion occurs at A circular queue in which all nodes


the rear end of the list and deletion are treated as circular such that the
occurs at the front end of the list. last node follows the first node.

35. Mention the applications of the queues?


• Multi-programming platform systems
• Different type of scheduling algorithm
• Round robin technique
• Pointer server routines
• Various applications software is also based on queue of processes that are ready to
execute or that are waiting for a particular event to occur.

36. What is dynamic memory allocation?


In dynamic memory allocation the array is declared at the run time.

37. What is a pointer?


It is a variable that stores the address of another variable.

38. What is the use of malloc() function?


malloc() function is used to assign the specific amount of memory (block of memory) at
runtime (at dynamic time)

39. What is the use of calloc() function?


calloc() function is used for allocating n blocks of memory .
40. How to clear the memory allocated?
Free() is used to clear or delete the memory that is allocated with malloc() and calloc().
41. What is a tree?
Tree is a non linear data structure, where the elements are represented as nodes. Nodes
are represented as hierarchical manner.
42. What is a binary tree?
Binary tree is a tree where the root node consists of 2 child nodes , right child and left
child.
43. Mentioned different tree traversal techniques?
• In order
• Pre order
• Post order

44. What is an AVL tree?


AVL Tree can be defined as height balanced binary search tree in which each node is
associated with a balance factor which is calculated by subtracting the height of its right
sub-tree from that of its left sub-tree.
45. What is a B Tree?
B Tree is a specialized m-way tree that can be widely used for disk access. A B-Tree of
order m can have at most m-1 keys and m children.
One of the main reason of using B tree is its capability to store large number of keys in a
single node and large key values by keeping the height of the tree relatively small.
46. What are the applications of trees?
• Storing naturally hierarchical data: Trees are used to store the data in the hierarchical
structure. For example, the file system. The file system stored on the disc drive, the
file and folder are in the form of the naturally hierarchical data and stored in the form
of trees.
• Organize data: It is used to organize data for efficient insertion, deletion and
searching. For example, a binary tree has a logN time for searching an element.
• Trie: It is a special kind of tree that is used to store the dictionary. It is a fast and
efficient way for dynamic spell checking.
• Heap: It is also a tree data structure implemented using arrays. It is used to implement
priority queues.
• B-Tree and B+Tree: B-Tree and B+Tree are the tree data structures used to implement
indexing in databases.
• Routing table: The tree data structure is also used to store the data in routing tables
in the routers.
47. What is a graph?
A graph is a non linear data structure that consists of a finite set of nodes (or vertices) and
a set of edges connecting them. A pair (x,y) is referred to as an edge, which communicates
that the x vertex connects to the y vertex.
48. Define hashing?
a technique of 0mapping a large chunk of data into small tables using a hashing function. It
is also known as the message digest function. It is a technique that uniquely identifies a
specific item from a collection of similar items
49. How to represent graphs?
Graph is represented using adjacency matrix.
50. Mention the graph traversal techniques?

• Breadth-first search

• Depth-first search

51. What is a linked list?


A linked list is a linear collection of data elements called nodes. Where the linear order is
given by means of pointer.

52. What are the types of linked list?


• Singly linked list
• Circular linked list
• Doubly linked list
• Header linked list
53. Mention the operations on linked list?
• Creating a linked list
• Traversing
• Insertion
• Deletion
• Sorting
• Searching
• Merging
54. Mention differences between linked list and array?

Linked list array

• A linked list is a linear • It is a collection of similar data


collection of data elements items that shares a common
called nodes. Where the linear name.
order is given by means of
pointer.
• Element location is allocated • Element position is assigned
during the time of compile. during the run time.

55. Mention the disadvantage of Arrays?


• The array allows storing only a fixed number of elements as per the size defined
initially.
• Only elements of same data types can be stored in an array.

You might also like