Nepal's open education portal

EduNepalEduNepal

Data Structures and Algorithms — Complete Course Notes (BCA 3rd Sem)

Comprehensive lecture notes on asymptotic analysis, stacks, queues, linked lists, trees, graphs, and sorting algorithms for TU BCA.

Data Structures and Algorithms · CACS201 · Semester 3

BCA Curriculum 2079

Unit 4•Unit 4 of 5

Unit 4: 3. Non-Linear Structures: Binary Search Tree (BST)

A Binary Search Tree is a binary tree where:

  • For every node N, values in the left subtree are strictly less than N.key.
  • Values in the right subtree are strictly greater than N.key.
  • Inorder traversal of a BST always yields sorted keys!

```c struct Node { int key; struct Node left, right; };

struct Node* search(struct Node* root, int key) { if (root NULL || root->key key) return root; if (key < root->key) return search(root->left, key); return search(root->right, key); } ```

Related video lessons

View all →

Practice questions

View all →
  • What is the worst-case time complexity of Quick Sort algorithm? (a) O(n) (b) O(n log n) (c) O(n^2) (d) O(log n)objective · 1 marks
  • Differentiate between Linear Queue and Circular Queue. Explain how modulo arithmetic prevents false overflow.short · 5 marks

View all questions for this subject →

← Back to all notes