Package topics.introduction
package topics.introduction
Introduction to algorithms, computational thinking, and fundamental data structures.
This package is the starting point for learners new to algorithm design. It covers two complementary areas:
- Algorithm introduction — what an algorithm is, how to measure its correctness and efficiency, and how to improve naive solutions step by step.
- Principles & data structures — the foundational building blocks (recursion, search, core data structures) required before studying advanced topics.
Algorithm Introduction
- Correctness — does the algorithm always produce the right answer?
- Efficiency — how does running time grow with input size (Big-O)?
- Stress testing — comparing a naive solution against an optimised one on random inputs to detect bugs.
Principles & Fundamentals
- Recursion — base cases, inductive reasoning, call-stack mechanics.
- Search algorithms — sequential search, sentinel search, binary search.
- Core data structures — arrays, linked lists, stacks, queues,
sets, priority queues (see
topics.introduction.examples).
Classes in This Package
HelloWorld— minimal sanity-check programMaxPairWiseProduct— O(n²) naive max-productMaxPairWiseProduct2— first optimised variantMaxPairWiseProduct3— second optimised variantMaxPairWiseProduct4— third optimised variantMaxPairWiseProduct5— fourth optimised variantMaxPairWiseProduct6— O(n) optimal solutionMaxPairWiseProductRandomNumbers— stress-test harnessFactorial— iterative and recursive factorialGetAdditionFromList— sum of a list of numbersGetMaximumFromList— maximum of a list of numbersSearch— sequential and binary search demonstrations
-
ClassesClassDescriptionTo calculate the factorial of a numberTo get the addition of a list of numbersTo get the maximum of a list of numbersJust to show a small example of how the project is structuredComputes the max pairwise product among different numbers E.g.: 7 3 6 => 42 However, in this example we will only work with two integer numbersComputes the max pairwise product among different numbers E.g.: 7 3 6 => 42 However, in this example we will only work with two long numbersComputes the max pairwise product among different numbers E.g.: 7 3 6 => 42 We will load the numbers from MaxPairWiseProductRandomNumbers.txtComputes the max pairwise product among different numbers E.g.: 7 3 6 => 42 We will load the numbers from MaxPairWiseProductRandomNumbers.txtComputes the max pairwise product among different numbers E.g.: 7 3 6 => 42 We will load the numbers from MaxPairWiseProductRandomNumbers.txtComputes the max pairwise product among different numbers E.g.: 7 3 6 => 42 We will load the numbers from MaxPairWiseProductRandomNumbers.txtGenerates a test data file of random integers for the MaxPairWiseProduct problem.To use different methods for searching numbers in an array