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

SHS Computer Science Study Guide

The document covers fundamental concepts in computer science, focusing on algorithms and data structures. It introduces algorithms, control structures, linear and non-linear data structures, classical searching and sorting algorithms, and computational complexity with Big O notation. Key examples include linear search, binary search, and bubble sort, along with their operational mechanics and efficiency considerations.
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)
3 views2 pages

SHS Computer Science Study Guide

The document covers fundamental concepts in computer science, focusing on algorithms and data structures. It introduces algorithms, control structures, linear and non-linear data structures, classical searching and sorting algorithms, and computational complexity with Big O notation. Key examples include linear search, binary search, and bubble sort, along with their operational mechanics and efficiency considerations.
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

SHS CORE SUBJECT VOL.

SENIOR HIGH SCHOOL COMPUTER SCIENCE:


ALGORITHMS & DATA STRUCTURES

1. Introduction to Algorithms and Pseudocode


An algorithm is a well-defined, step-by-step computational procedure that takes a set of values as input and
produces a set of values as output. Writing clear algorithms independent of a formal programming language syntax
is often achieved using pseudocode.

Control Structures
Algorithms rely on three fundamental building blocks to control execution flow:

• Sequence: Executing instructions sequentially, one straight line after the next.
• Selection (Conditionals): Making decisions using structures like IF-THEN-ELSE blocks.

• Iteration (Looping): Repeating instructions using bounded blocks like FOR or WHILE.

2. Linear and Non-Linear Data Structures


Data structures organize, store, and manage data efficiently, allowing specific types of manipulations and algorithms
to run optimal operations.

Data Structure Type Core Mechanics & Access Rules

Array Linear Fixed-size, contiguous memory locations. Features fast direct


index-based random access.

Stack Linear Operates on a LIFO (Last-In, First-Out) protocol. Insertion


(Push) and removal (Pop) both occur at the same designated
"Top" boundary.

Queue Linear Operates on a FIFO (First-In, First-Out) protocol. Insertion


occurs at the "Rear" tail, and removal occurs at the "Front"
head.

Binary Tree Non-Linear Hierarchical network of nodes where each parent node points
to at most two distinct descendants (Left Child and Right
Child).

3. Classical Searching and Sorting Algorithms


The choice of sorting or searching algorithm determines the computational complexity, efficiency, and resource
demands of a system architecture.

Page 1
Binary Search vs. Linear Search
While a Linear Search checks every single slot sequentially from left to right, a Binary Search uses a divide-and-
conquer approach. It repeatedly divides a sorted search interval in half. If the target value is less than the item in
the middle of the interval, the search narrows to the lower half; otherwise, it narrows to the upper half.

Critical Condition for Binary Search


A binary search algorithm can only execute correctly if the underlying data collection is strictly pre-sorted. If
the array is unsorted, linear search must be utilized instead.

Bubble Sort Example


The Bubble Sort algorithm steps through a list repeatedly, comparing adjacent elements and swapping them if they
are in the wrong order. This pass through the list is repeated until the list is fully sorted.

Algorithm: BubbleSort(Array A)
N = Length of A
Repeat
Swapped = False
For i = 0 To N - 2
If A[i] > A[i+1] Then
Swap(A[i], A[i+1])
Swapped = True
End If
End For
Until Not Swapped

4. Computational Complexity and Big O Notation


Big O Notation quantifies the worst-case time or memory space required by an algorithm as a mathematical
function of the size of the input data set (n).

• O(1) - Constant Time: Execution runtime remains completely identical regardless of input scaling (e.g., pulling
a value directly from an explicit array index position).
• O(log n) - Logarithmic Time: The data pool size halves with every procedural step (e.g., execution of a Binary
Search path).
• O(n) - Linear Time: Execution speed drops in direct proportional scaling to data volume additions (e.g.,
scanning a sequence during a Linear Search).
• O(n²) - Quadratic Time: Processing demands grow exponentially with nested iteration sweeps over identical
inputs (e.g., standard Bubble Sort implementations).

Page 2

You might also like