Design of Algorithms

Algorithms

Algorithms

Table of Contents

Algorithms

Greatest common divisor

Euclid’s algorithm gcd(m, n) = gcd(n, m mod n)

For example

gcd(24, 60) = gcd(60, 24)
            = gcd(24, 12)
            = gcd(12, 0)
            = 12

Since gcd(m, 0) = m

Sieve of Eratosthenes

Algorithmic Problem Solving

Important problem types

Linear data structures

Array

Linked list

array and singly linked list doubly linked list

List

Stacks

Queue

Priority queues

Graphs

V = \{a, b, c, d, e, f\}
\newline
E = \{(a,c), (a,d), (b,c), (b,f), (c,e), (d,e), (e,f)\}

undirected_graph

  V = \{a, b, c, d, e, f\}
\newline
E = \{(a,c), (b,c), (b,f), (c,e), (d,a), (d,e), (e,c), (e,f)\}

directed_graph

Graph representations

graph_representation

Weighted graphs

Paths and Cycles

graph_connectivity Graph becomes disconnected when dashed line is removed

Trees

graph_tree_forest

Rooted trees

rooted_tree

Ordered trees

binary_search_tree

Sets and Dictionaries

Universal set

e.g.

\[U = \{1, 2, 3, 4, 5, 6, 7, 8\} \newline S = \{2, 3, 7\}\]

List structure

Dictionary


Edit this page.