Unit summary

  • A data structure organises data and its operations; structures are primitive or non-primitive, linear or non-linear, static or dynamic.
  • Algorithms are compared by time and space complexity, using Big-O notation.
  • An array stores elements of one type contiguously, with O(1) access and O(n) insertion and deletion.
  • Linear search is O(n) on any data, and binary search is O(log n) on sorted data.
  • Bubble, selection and insertion sort are simple O(n²) sorting methods.
  • Two-dimensional arrays are stored in row-major or column-major order, and sparse matrices are stored as triples.

Glossary

Term Meaning
Abstract data type A type described by its operations only.
Algorithm A finite sequence of well-defined steps.
Array Elements of one type in contiguous memory.
Big-O An upper bound on growth rate.
Binary search Halving a sorted range at each step.
Bubble sort Sorting by swapping adjacent pairs.
Data structure An organisation of data with its operations.
Insertion sort Sorting by inserting into a sorted part.
Linear search Checking elements one by one.
Linear structure Elements arranged in a sequence.
Merging Combining two sorted lists into one.
Non-linear structure Elements arranged as a tree or graph.
Row-major order Storing a 2D array row by row.
Selection sort Sorting by selecting the minimum.
Space complexity Memory used as a function of input size.
Sparse matrix A matrix with mostly zero elements.
Time complexity Steps taken as a function of input size.
Time-space tradeoff Exchanging memory for speed or the reverse.
Traversal Visiting each element once.

Question bank

Short Answer Questions (2 marks each)

  1. Define a data structure.
  2. Distinguish linear and non-linear data structures.
  3. What is time complexity?
  4. What is the time-space tradeoff?
  5. Write the address formula of a 1D array.
  6. Compare linear and binary search.
  7. What is the complexity of bubble sort?
  8. What is row-major order?
  9. Define a sparse matrix.
  10. What is merging?

Medium Answer Questions (5 marks each)

  1. Explain the classification and operations of data structures.
  2. Explain Big-O notation with examples.
  3. Write an algorithm to insert and delete an element in an array.
  4. Write and trace the binary search algorithm.
  5. Explain insertion sort with an example.
  6. Explain the representation of 2D arrays and sparse matrices.

Long Answer Questions (15 marks each)

  1. Explain data structures, their classification, operations, and the complexity of algorithms.
  2. Explain arrays, their representation in memory, and the operations of traversal, insertion, deletion and merging.
  3. Explain and compare linear search and binary search, and the bubble, selection and insertion sorts.
  4. Explain two-dimensional and multi-dimensional arrays, matrix operations and sparse matrices.

Sources

  • Official BCA syllabus Data Structures, course code 25BCA402DS02, Unit I