0% found this document useful (0 votes)
8 views2 pages

Data Structures & Algorithms Overview

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)
8 views2 pages

Data Structures & Algorithms Overview

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

CS201: Data Structures & Algorithms Notes

Your Name

August 26, 2025

Contents
1 Introduction to Algorithm Analysis 2
1.1 Big-O Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Example: Linear Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 Stacks and Queues 2

1
1 Introduction to Algorithm Analysis
1.1 Big-O Notation
Big-O notation describes the upper bound of an algorithm’s growth rate.
• Constant Time: O(1)
• Logarithmic Time: O(log n)
• Linear Time: O(n)
• Quadratic Time: O(n2 )

1.2 Example: Linear Search

Algorithm 1 Linear Search


1: procedure LinearSearch(A[0..n − 1], x)
2: for i ← 0 to n − 1 do
3: if A[i] = x then
4: return i ▷ Element found at index i
5: end if
6: end for
7: return −1 ▷ Element not found
8: end procedure

Time Complexity: O(n) in the worst case.

2 Stacks and Queues

You might also like