Skip to content
ExamRizzInterview readingReading
Leave

STEM · Computer Science · Foundational Concepts/Principles

Save

Algorithms and Data Structures

Significance: Fundamental building blocks. Algorithms are step-by-step procedures for computation; data structures organize information for efficient access/modification. Choosing appropriate structures affects performance dramatically. Core structures: arrays, linked lists, stacks, queues, trees (binary, AVL, B-trees), hash tables, heaps, graphs. Core algorithms: sorting (merge, quick, heap), searching (binary, DFS, BFS, Dijkstra), divide-and-conquer, dynamic programming, greedy.

Questions to think through

  1. Analyze tradeoffs: Compare arrays vs linked lists: (a) access element i: array O(1), linked list O(i) (b) insert at beginning: array O(n), linked list O(1) (c) memory: array contiguous, linked list scattered with overhead. When would you choose each? Explain why language implementations use different structures (Python lists are dynamic arrays, Scheme lists are linked lists).

    explain
  2. Design solution: Find k-th largest element in unsorted array of n elements. Three approaches: (1) sort then index (O(n log n)) (2) partial QuickSort (O(n) average) (3) maintain min-heap of k largest (O(n log k)). Explain each. Which is best for: (a) k = n/2 (b) k = 1 (c) multiple queries? Show your reasoning about time/space complexity.

    explain

Data Structures · Algorithms · Arrays · Linked Lists · Trees · Sorting · Algorithm Design