Analysis of a Linear Search Algorithm

A linear search algorithm solves the problem of searching for an index by going through each index within the list/set/array until it comes across the index which contains the value matching that of the value being searched for. Below is an example of a linear search algorithm: Figure one: Code of a linear search algorithm […]

Vector Algorithm

The Algorithm Purpose of Algorithm The algorithm created will find the distance between all of the predetermined vectors, and return the which two vectors were the closest in the list of 4 vectors. The inputs for this particular algorithm are four vectors, which are held as the indexes a, b, c and d, and the […]

Binary Search Algorithms

Set ADT’s When it comes to binary search algorithms, one frequently used data type is the Set. The set ADT is a type of data structure that can contain many different values in any order, but cannot contain a repeated value. There are static and dynamic sets, the latter allowing additions and removals from the set, […]

Edge List and Weighted Graph

What is a Weighted Graph? A weighted graph is a graph where there is a number/value along each edge within the graph. An example of a weighted graph would be a graph that shows different cities, with the values on the edges represented the distance in miles between those cities. As such, they are commonly […]

Binary Trees

Binary Trees vs General Trees The main difference between a general tree and a binary tree is that a general tree can have an infinite number of children to a node, whereas a binary tree can only have two children per node. A general tree also cannot be empty, whereas a binary tree can be […]

Linked Lists

The list ADT represents a countable number of values that can occur more than once. Lists are a finite sequence and are supported by a great many programming languages, and items in the list are separated by comma’s, semicolons etc. With linked lists, the size of the list can change. In a linked list, values […]

Default Dictionaries

What data this type can represent Dictionaries can be used to store a set of keys and values in pairs, with the keys being unique throughout the dictionary. The keys can be either a string or an int, with the only requirement being that they aren’t a mutable data type – that is, one that […]

Computers, Integers and Binary

Computers represent numbers through binary by converting the numbers into a series of 1’s and 0’s. Binary numbers may be shown as 8 0’s or 1’s, and this is normally the case with 8 bit computing. Each 0/1 will represent a different number, with the right most number being 1, and the order following being […]