Docsity

Common Problem Types in Computer Science: Sorting, Searching, String Processing, Graphs, C, Assignments of Computer Science

Partial preview of the text

Download Common Problem Types in Computer Science: Sorting, Searching, String Processing, Graphs, C and more Assignments Computer Science in PDF only on Docsity!

Important Problem Types

Numerous Problems

Choosing problems  Of practical importance, e.g., searching problem  With interesting characteristics from theoretical research point of view, e.g., traveling salesman problem.  Important problem types  Sorting Searching String processing Graph problems Combinatorial problems Geometric problems Numerical problems  To illustrate different methods of the algorithm analysis and algorithm design techniques.

Searching Problem

 To find a given value, called a search key , in a given set.  Searching algorithms  Sequential search  Binary search  Hashing  Tree-based searches  Binary search tree  Balanced search trees such as AVL trees, 2-3 tree, B-tree.  Searching should be considered in conjunction with the “addition to” and “deletion from” the dataset of an item.

String Processing

 A string is a sequence of characters from an alphabet  Text strings, which comprise letters, numbers, special characters  Bit strings, which comprise zeros and ones  Gene sequences, which are strings of characters from A, C, G and T.  String matching: Search for a given word (or a pattern) in a text.  Algorithms:  Brute-force string matching  Algorithm by R. Boyer and J. Moore and its simplification suggested by R. Horspool.  Huffman code: a variable-length encoding scheme.

Combinatorial Problems

 Find a combinatorial object such as a permutation, a combination, or a subset that satisfies certain criteria (e.g., maximize a value or minimize a cost).  Examples:  Traveling salesman problem  Knapsack problem  Assignment problem  Graph coloring problem  Algorithms:  Johnson-Trotter algorithm for generating permutations  Generating subsets  Computing a binomial coefficient  Brute-force approaches based on exhaustive search  Algorithms based on dynamic programming and memory function method.

Geometric Problems

 Deal with geometric objects such as points, lines, and polygons.  Interesting problems  Closest-pair problem: Find the closest pair among given n points in the plane  Convex hull problem: Find the smallest convex polygon that would include all the points of a given set  Dihedral angle problem: Calculate the dihedral (torsional) angle for four points to decide whether they all lie in the same plane.  Algorithms: Brute force and divide-and-conquer methods  Quickhull algorithm.