Notes of Data Structure, Study notes of Data Structures and Algorithms

Hello... This is the Notes of Data Structure , that is very usefull for computer science students.

Typology: Study notes

2022/2023

Uploaded on 10/30/2023

tejashree-mashal
tejashree-mashal 🇮🇳

1 document

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Two marks.
1. What is linear data structure? Give an example.
Ans:A linear data structure is known as a data structure that allows data
elements to be arranged in a sequential or linear fashion. Each element
is attached with its next and previous adjacent. A linear data structure
only has one level and performs linear searching in the data structure.
We can therefore traverse all elements in a single run. Because computer
memory is linearly arranged, linear data structures are simple to
implement. Linear data structure examples are array, linked list, stack,
queue, etc.
2. Define the space and time complexities of an algorithm.
Ans:The valid algorithm takes a finite amount of time for execution. The
time required by the algorithm to solve given problem is called time
complexity of the algorithm. Problem-solving using computer requires
memory to hold temporary data or final result while the program is in
execution. The amount of memory required by the algorithm to solve given
problem is called space complexity of the algorithm.
3. What is recursion?
Ans: Recursion is defined as a process which calls itself directly or
indirectly and the corresponding function is called a recursive function.
4. What is dynamic memory allocation?
Ans: The mechanism by which storage/memory/cells can be allocated to
variables during the run time is called Dynamic Memory Allocation (not to
be confused with DMA). So, as we have been going through it all, we can
tell that it allocates the memory during the run time which enables us to
use as much storage as we want, without worrying about any wastage.
5. Define stack.
Ans: Stack is a linear data structure that follows a particular order in
which the operations are performed. The order may be LIFO(Last In First
Out) or FILO(First In Last Out). LIFO implies that the element that is
inserted last, comes out first and FILO implies that the element that is
inserted first, comes out last.
6. Compare linear search and binary search methods.
Ans:
Linear Search Binary Search
1. In linear search input data
need not to be in sorted.
1. In binary search input data
need to be in sorted order.
2. It is also called sequential
search.
2. It is also called half-interval
search.
3. The time complexity of linear
search O(n).
3. The time complexity of binary
search O(log n).
4. Multidimensional array can be
used.
4. Only single dimensional array
is used.
5. Linear search performs equality
comparisons.
5. Binary search performs ordering
comparisons.
6. It is less complex. 6. It is more complex.
7. It is very slow process. 7. It is very fast process.
pf3

Partial preview of the text

Download Notes of Data Structure and more Study notes Data Structures and Algorithms in PDF only on Docsity!

Two marks.

  1. What is linear data structure? Give an example. Ans:A linear data structure is known as a data structure that allows data elements to be arranged in a sequential or linear fashion. Each element is attached with its next and previous adjacent. A linear data structure only has one level and performs linear searching in the data structure. We can therefore traverse all elements in a single run. Because computer memory is linearly arranged, linear data structures are simple to implement. Linear data structure examples are array, linked list, stack, queue, etc.
  2. Define the space and time complexities of an algorithm. Ans:The valid algorithm takes a finite amount of time for execution. The time required by the algorithm to solve given problem is called time complexity of the algorithm. Problem-solving using computer requires memory to hold temporary data or final result while the program is in execution. The amount of memory required by the algorithm to solve given problem is called space complexity of the algorithm.
  3. What is recursion? Ans: Recursion is defined as a process which calls itself directly or indirectly and the corresponding function is called a recursive function.
  4. What is dynamic memory allocation? Ans: The mechanism by which storage/memory/cells can be allocated to variables during the run time is called Dynamic Memory Allocation (not to be confused with DMA). So, as we have been going through it all, we can tell that it allocates the memory during the run time which enables us to use as much storage as we want, without worrying about any wastage.
  5. Define stack. Ans: Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out) or FILO(First In Last Out). LIFO implies that the element that is inserted last, comes out first and FILO implies that the element that is inserted first, comes out last.
  6. Compare linear search and binary search methods. Ans: Linear Search Binary Search
    1. In linear search input data need not to be in sorted.
      1. In binary search input data need to be in sorted order.
    2. It is also called sequential search.
      1. It is also called half-interval search.
    3. The time complexity of linear search O(n).
      1. The time complexity of binary search O(log n).
    4. Multidimensional array can be used.
      1. Only single dimensional array is used.
    5. Linear search performs equality comparisons.
      1. Binary search performs ordering comparisons.
    6. It is less complex. 6. It is more complex.
    7. It is very slow process. 7. It is very fast process.
  1. What is a circular queue? Ans: A circular queue is the extended version of a regular queue where the last element is connected to the first element. Thus forming a circle-like structure.
  2. Write the differences between stack and queue. Ans:
  3. Give the node structure of a doubly linked list.
  4. Define the terms : i) Binary tree. ii) Complete binary tree.
  5. Mention the different ways of tree traversal.
  6. Mention the graph traversal methods.
  7. Define the data structure.
  8. What are linear data structures? Name any two linear data structures.
  9. Define the terms : i) Space complexity. ii) Time complexity.
  10. Mention the disadvantages of an array.
  11. Define sparse matrix.
  12. What is a linked list?
  13. Mention various types of linked lists.
  14. Differentiate between stacks and queues.
  15. Mention the applications of stack.
  16. What is a circular queue?
  17. Define the terms : i) Graph ii) Tree.
  18. Give examples for : i) Complete binary tree. ii) Degree of the vertex.
  19. What is a non-linear data structure?
  20. Define the space and time complexity of an algorithm.
  21. What is recursion?
  22. What is dynamic memory allocation?
  23. What is a circular queue?
  24. Compare linear search and binary search techniques.
  25. Write 'C' function to find the number of characters in a string.
  26. Differentiate between the terminal and non-terminal nodes of a tree.
  27. List the disadvantages of a Linked List.
  28. Mention different ways of graph traversals.
  29. List different operations on Binary Tree.
  30. What is a Binary Search Tree? Four marks.
  1. Explain various types of data structures.
  2. Briefly explain any four string handling functions.
  3. Explain the selection sort algorithm.
  4. Write an algorithm to delete an element from the array.
  5. Define the linked list. Mention the applications of the linked list.
  6. Write an algorithm for searching a node in the singly linked list.
  7. Mention various applications of the stack.
  8. Evaluate the following postfix expression 95 + 36++97 1.