CS - Algorithms

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/35

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:32 AM on 10/11/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

36 Terms

1
New cards

Computational thinking

Smart problem solving - 3 key components - abstraction, decomposition and algorithmic thinking

2
New cards

Abstraction

Involves ignoring unnecessary information and focus only on the important facts

3
New cards

Why is abstraction used?

It simplifies a problem to make it less complex - making it more straightforward to understand and create a solution

4
New cards

Decomposition

Break down a problem down into smaller tasks so that it is easier to solve

5
New cards

Why is decomposition used?

Each individual problem can be separately tested and solved - also enables different people to work on the different parts of a larger problem that can be later recombined to produce a full solution

6
New cards

Algorithmic Thinking

Coming up with a series of logical steps to get from problem to a solution

7
New cards

Algorithm

Set of instructions, presented in a logical sequence

8
New cards

Flowcharts

Can be used to visually represent an algorithm

9
New cards
term image

Start/Stop Terminator or Terminal - used at the beginning and end of an algorithm

10
New cards
term image

Input/Output - For values that are put in or taken out

11
New cards
term image

Operation (Process) - For instructions and calculations

12
New cards
term image

Decision - For a question (usually yes or no)

13
New cards
term image

Direction of flow - to connect boxes and show direction

14
New cards
term image

Subprogram - a call to a separate, reusable sequence of actions or function defined elsewhere

15
New cards

Sequence

Only has one route from start to stop

16
New cards

Selection

Has decisions which give multiple routes from start to stop

17
New cards

Iteration

Contains a loop that lets you repeat a task

18
New cards

Pseudocode

A simple way of writing an algorithm without using a specific programming language

19
New cards

Trace Tables

Track value of variables as a program is run. Each row represents another iteration and each column stores the value of the variable as it changes

20
New cards

Linear search

The most simple search algorithm - each data item is searched in order from the first value to the last as if they were all laid out in a line (the list does not have to be in any order before it is searched and its a sequential search - list is searched in sequence from first to last)

21
New cards

Pros of Linear search

Simple, works on unordered lists

22
New cards

Cons of Linear search

List must be ordered first and inefficient at searching large lists

23
New cards

Key features of linear search

Loop is used to check first value in a list and increment by 1, checking each value for a match to the target and reaching last element of list without finding a match means the value is not included

24
New cards

Binary Search

Find the middle item - for n items it’s (n+1)/2 and round up if needed. If this is the item you want, then stop search, if not compare the two items, if item you want comes after the middle item, cut the first half of the list, otherwise cut the second half. Repeat until item is found or run out of items

25
New cards

Pros of Binary search

Efficient at searching large lists

26
New cards

Cons of Binary search

Prerequisite - list must be ordered first

27
New cards

Key points of a binary search

A midpoint, lowpoint and highpoint are calculated and a while loop is used to repeatedly compare the midpoint to the target value and the upper or lower half of the data is ignored if the midpoint does not equal the target

28
New cards

Merge Sort

Divides the list in half, again and again until each data item is separated. Then the items are combined in the same way as they were divided, but now in the correct order - “divide and conquer”

29
New cards

Key features of a merge sort

Calls itself from within the subroutine (recursive algorithm) and it continually splits sublists into a left side and right side until each sublist has a length of 1

30
New cards

What’s good about Merge sort?

High efficiency in large lists

31
New cards

Bubble sort

Based on the comparison of adjacent data elements, they are swapped if they are not in the correct order. The algorithm will only stop when a complete iteration through the data is completed with no swaps made.

32
New cards

Cons of Bubble sort

Not suitable for large lists

33
New cards

Key features of Bubble sort

Uses an outer while loop (condition controlled) to check no swaps have been made, uses an inner loop (count controlled) to repeat through the length of the data set and uses a flag (boolean value) to track if a swap has been made and uses temporary values to help correctly swap elements

34
New cards

Insertion Sort

The list is logically split into sorted values on the left and unsorted on the right. Starting from the left, values from the unsorted part are checked and inserted at the correct position in the sorted part. This continues until the last item is reached and sorted.

35
New cards

Why are insertion sorts good?

Are efficient for small data sets but would be slow to sort large sets compared to a merge sort.

36
New cards

Key features of a insertion sort

Users an outer loop (count controlled) to iterate through and find each value in the list, uses an inner while loop (condition controlled) to find the current value’s correct position in the sorted part of the list and an insertion sort moves backwards to find the correct position - decreasing the index within the loop