Data Structures, Algorithms and Programming Languages, COMP 301 – Study Notes
offline

Difficulty: Beginner | Prerequisites: None, though basic maths literacy helps.


Big Picture

This material covers the foundational building blocks of computer science: how data is organised in memory, how problems are solved step by step, and how humans communicate instructions to machines. These three topics underpin almost everything else in the degree. If you are joining late or switching from another programme, start here before touching operating systems, networks, or databases. The concepts in this set of notes will resurface in every subsequent course.


TL;DR

Computer science is the study of computation, algorithms, and programming languages. Data structures are the containers you store information in; algorithms are the recipes you follow to process it. Programming languages are the notation you use to write those recipes so a computer can execute them.


Key Terms

Computer science

The study of computation, algorithms, and programming languages. It spans both theory (what can be computed, how efficiently) and practice (building real software systems).

In simple terms, it is the discipline concerned with solving problems using computers.

Data structure

A way of organising and storing data in a computer program so it can be accessed and modified efficiently.

Think of it as a filing system: different systems (arrays, linked lists, trees) suit different kinds of work, just as a filing cabinet suits paper documents while a Rolodex suits contact cards.

Algorithm

A step-by-step procedure for solving a problem or performing a computation.

In simple terms, an algorithm is a recipe. It takes an input, follows a fixed sequence of operations, and produces an output.

Array

A data structure that stores elements in a contiguous block of memory, accessed by a numeric index starting from 0.

Think of it as a row of numbered lockers: you can go straight to locker 5 without opening lockers 1 through 4.

Linked list

A data structure in which each element (node) contains a value and a pointer (reference) to the next node in the sequence.

In simple terms, it is a chain where each link knows only about the next link. Good for inserting and removing elements, less good for jumping straight to the middle.

Tree

A hierarchical data structure made of nodes, where each node has zero or more child nodes and exactly one parent (except the root, which has none).

Think of it as an upside-down family tree: the root sits at the top, branches fan downward, and the leaves are the nodes with no children.

Sorting

An algorithm category that rearranges elements into a defined order (typically ascending or descending). Common examples include bubble sort, merge sort, and quicksort.

Searching

An algorithm category that locates a specific element within a data structure. Linear search checks every element; binary search halves the search space each step (but requires sorted data).

Graph traversal

An algorithm category for visiting every node in a graph structure. The two classic approaches are breadth-first search (BFS) and depth-first search (DFS).

Programming language

A formal language with strict syntax and semantics, used to write instructions a computer can execute.

In simple terms, it is the language you speak to the machine. Different languages exist for different jobs.

Java

A statically typed, object-oriented language widely used in enterprise software and Android development. Runs on the Java Virtual Machine (JVM), which makes compiled Java programs portable across operating systems.

Python

A dynamically typed, high-level language known for readable syntax and rapid prototyping. Popular in data science, scripting, and web back-ends.

C++

A statically typed language that extends C with object-oriented features. Offers fine-grained control over memory and hardware, making it the standard choice for systems programming, game engines, and performance-critical applications.


Core Content

How Data Structures, Algorithms and Languages Relate

  • Data structures provide the storage; algorithms provide the logic.

  • Choosing the wrong data structure can make an otherwise good algorithm slow, and vice versa.

  • Programming languages are the medium: you express both data structures and algorithms in a language the computer can parse and execute.

Data Structures at a Glance

  • Arrays: fixed-size, index-based access, O(1) lookup by index, O(n) insertion in the middle.

  • Linked lists: dynamic size, sequential access, O(1) insertion/deletion at a known position, O(n) lookup.

  • Trees: hierarchical, used for sorted data (binary search trees), file systems, and decision processes.

Core Algorithm Categories

  • Sorting: arranging data. Efficiency varies from O(n log n) for merge sort and quicksort to O(n²) for bubble sort.

  • Searching: finding data. Binary search on sorted data runs in O(log n); linear search runs in O(n).

  • Graph traversal: exploring relationships. BFS uses a queue; DFS uses a stack (or recursion).

Why Different Languages Exist

  • No single language is best at everything. Trade-offs include execution speed, safety, readability, and ecosystem support.

  • Java emphasises portability and type safety.

  • Python emphasises readability and speed of development.

  • C++ emphasises performance and hardware control.


Real-World Applications

Arrays and sorting algorithms are what make it possible to display search results in order on any website. Linked lists appear inside operating systems for managing tasks in a queue. Trees power everything from database indexing to the autocomplete suggestions on your phone keyboard. The choice of programming language shapes entire industries: Python dominates data science, Java dominates enterprise back-ends, and C++ dominates game engines.


Common Misconceptions

  • Students often think arrays and linked lists are interchangeable. They are not. Arrays give fast random access; linked lists give fast insertion and deletion. Picking the wrong one is a common source of poor performance.

  • Students often think "algorithm" means something complicated. It does not. Even making a cup of tea follows an algorithm. The formal term simply means a defined, repeatable procedure.

  • Students often confuse the language with the paradigm. Java is object-oriented, but you can write object-oriented code in Python or C++ as well. The paradigm is the style; the language is the tool.

  • Students often assume Python is "slow" and therefore bad. Python is slower at raw computation than C++, but for many tasks (scripting, prototyping, data analysis) that difference is irrelevant. The right language depends on the job.


Why It Matters / Exam Flags

⚠️ Be able to name at least three data structures and describe what each is best suited for.

⚠️ Know the difference between O(n), O(log n), and O(n²) at a conceptual level. Exam questions often ask which algorithm is more efficient and why.

⚠️ Expect a question asking you to match a programming language to a use case (e.g., "Which language would you choose for a high-performance game engine, and why?").

⚠️ Sorting and searching are the most commonly examined algorithm categories at introductory level. Know at least one example of each by name.


Quick Self-Test

  1. True or false: A linked list allows O(1) access to any element by index.

  1. Fill in the blank: An _______ is a step-by-step procedure for solving a problem.

  1. True or false: Python is a statically typed language.

  1. Fill in the blank: Binary search requires the data to be _______ before it can work.

  1. True or false: Trees are a type of hierarchical data structure.

Answers: 1. False (O(n)). 2. Algorithm. 3. False (dynamically typed). 4. Sorted. 5. True.


Practice Q&A

Q: What is the key difference between an array and a linked list?

A: An array stores elements contiguously in memory and supports O(1) access by index, while a linked list stores elements as nodes with pointers and supports O(1) insertion/deletion at a known position but O(n) access by position.

Q: Name three common algorithm categories discussed in introductory computer science and give one example of each.

A: Sorting (e.g., merge sort), searching (e.g., binary search), and graph traversal (e.g., breadth-first search).

Q: Why do different programming languages exist if they all instruct computers to do the same thing?

A: Different languages make different trade-offs between execution speed, safety, readability, and ecosystem support. No single language is optimal for every task, so languages are designed to excel in specific domains.

Q: What does it mean to say Java is "portable"?

A: Java code compiles to bytecode that runs on the Java Virtual Machine (JVM). Because the JVM exists on many operating systems, the same compiled Java program can run on Windows, macOS, or Linux without recompilation.

Q: A student needs to store a list of items where insertions and deletions happen frequently at arbitrary positions, but random access by index is rare. Which data structure is better suited, an array or a linked list, and why?

A: A linked list, because insertions and deletions at a known node are O(1), whereas an array would require shifting elements (O(n)) for each insertion or deletion.


Connections to Other Topics

This material connects directly to Operating Systems, which rely on data structures (queues, trees) to manage processes and files. It also connects to Database Systems, where algorithms for searching and sorting underpin query execution. Understanding Big-O notation here will become essential when you study algorithm analysis in later courses.


Related Terms / Search Tags

data structures, algorithms, arrays, linked lists, trees, sorting, searching, graph traversal, BFS, DFS, breadth-first search, depth-first search, Big-O notation, time complexity, programming languages, Java, Python, C++, JVM, statically typed, dynamically typed, object-oriented programming, OOP, COMP 301, Computer Science I, UCF, intro to CS