Explore tens of thousands of sets crafted by our community.
Classic Computer Science Problems
12
Flashcards
0/12
Traveling Salesman Problem (TSP)
Problem Statement: Find the shortest possible route that visits a set of cities exactly once and returns to the origin city. Known Solutions: Approximation algorithms like the Christofides algorithm, heuristics such as nearest neighbor and genetic algorithms, and exact solutions using branch and bound.
Hash Table Collision Resolution
Problem Statement: Handle situations where two keys map to the same index in a hash table. Known Solutions: Collision resolution techniques like separate chaining, open addressing (linear probing, quadratic probing, double hashing), and using a dynamic size for the hash table (resizing).
Producer-Consumer Problem
Problem Statement: In concurrent programming, ensure that a producer does not overflow a buffer and a consumer does not start consuming with an empty buffer. Known Solutions: Use synchronization mechanisms such as semaphores, monitors, or condition variables to handle the concurrent access to the buffer.
Binary Search
Problem Statement: Efficiently find the position of a target value within a sorted array. Known Solutions: Iterative or recursive implementation of binary search algorithm.
Graph Search Algorithms
Problem Statement: Traverse or search through a graph data structure to visit nodes or find a particular node. Known Solutions: Algorithms like Depth-First Search (DFS), Breadth-First Search (BFS), Dijkstra's algorithm for shortest paths, and A* search algorithm.
Dining Philosophers Problem
Problem Statement: Simulate a scenario where philosophers seated around a table must either think or eat; however, they need two forks to eat and the forks are shared with neighbors. Known Solutions: Use algorithms such as the resource hierarchy solution, Chandy/Misra solution, and the arbitration solution.
Sorting Algorithms
Problem Statement: Arrange a sequence of elements in a particular order such as ascending or descending. Known Solutions: Algorithms like Merge Sort, Quick Sort, Bubble Sort, Insertion Sort, and Heap Sort.
Memory Allocation Problem
Problem Statement: Allocate and manage memory efficiently in a computer program to avoid issues like memory leaks and fragmentation. Known Solutions: Techniques and algorithms such as garbage collection, reference counting, memory pools, and the buddy system.
Finite State Machines
Problem Statement: Model computation by representing a system with a limited number of states and transitions between those states. Known Solutions: Design deterministic or non-deterministic finite automata, state diagrams, or transition tables.
Deadlock Detection
Problem Statement: Identify a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. Known Solutions: Resource allocation graphs, Banker's algorithm, wait-for graphs, and various heuristics to prevent or avoid deadlocks.
Tower of Hanoi Problem
Problem Statement: Move a stack of disks from one peg to another, with one auxiliary peg, obeying the rules that only one disk can be moved at a time, and no disk may be placed on top of a smaller disk. Known Solutions: Recursive algorithm, iterative solutions using a systematic approach like frame-stewart algorithm.
Knapsack Problem
Problem Statement: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is maximized. Known Solutions: Dynamic programming approach, greedy algorithms for the fractional knapsack, and branch and bound.
© Hypatia.Tech. 2024 All rights reserved.