UNIVERSITY OF GONDAR
INSTITUTE OF TECHNOLOGY
Name : AYICHEW MULUSEW
id : 02668/14
1. Search Algorithms
A. Linear Search
Linear Search is a simple algorithm that checks each element in a list sequentially
until a match is found or the entire list has been searched.
⚫ Contact Search: Searching for a contact name in a phone-book or address book.
⚫ Database Lookup: Searching through a small list of records where sorting isn't feasible.
⚫ Inventory Search: Checking for the presence of a particular product in a retail store inventory.
⚫ Text Search: Searching for a keyword or phrase in an unsorted text document or file.
⚫ Error Detection: Searching for a specific error code or log entry in a system log file.
B. Binary Search
Binary Search is an efficient algorithm for finding an item from a sorted list by
repeatedly dividing the search interval in half. If the value of the search key is less
than the value in the middle, the search continues in the lower half, or if it's greater,
the search continues in the upper [Link] incude:
⚫ Dictionary Search: Finding a word in a dictionary or thesaurus (sorted list of words).
⚫ GPS Navigation: Searching for a location in a sorted map or route system.
⚫ Database Indexing: Fast lookup of data in a database (e.g., finding a record in a sorted table).
⚫ File Search: Searching for a file in a large directory structure where files are sorted.
⚫ Game AI: Used in game algorithms for searching sorted lists of moves or states.
2. Sorting Algorithms
A. Insertion Sort
Insertion Sort builds the final sorted array one item at a time by repeatedly taking an
element from the unsorted portion and placing it in the correct position within the
sorted portion.
Sorting small data sets: Insertion Sort is often used when the data set is small or nearly sorted, like
arranging playing cards in hand.
⚫ Card Sorting: Sorting a hand of playing cards.
⚫ Small-Scale Sorting: Sorting small datasets in memory, like student scores or small database
queries.
⚫ Real-Time Systems: Sorting data in real-time systems where new elements are continuously
added.
⚫ List Management: Sorting personal to-do lists or task lists that evolve over time.
⚫ Text Processing: Sorting characters or words in a string in text analysis tools.
B. Selection Sort
Selection Sort improves upon the Bubble Sort algorithm by repeatedly selecting the
smallest (or largest) element from the unsorted portion of the list and swapping it with
the leftmost unsorted element.
⚫ Sorting Small Arrays: Sorting small datasets, like a handful of test scores or rankings.
⚫ Direct Selection Problems: Selecting the smallest or largest element from a set, like in
scheduling tasks.
⚫ Gaming Algorithms: Sorting in games where rankings need to be determined from a few
elements.
⚫ Database Operations: Sorting a small subset of database rows or records for quick access.
⚫ Teaching Sorting Concepts: Educational tools for teaching sorting algorithms.
C. Bubble Sort
Bubble Sort is a simple comparison-based algorithm that repeatedly steps through the
list, compares adjacent elements, and swaps them if they are in the wrong order. This
process continues until the list is sorted.
⚫ Bubble Sort in User Interfaces: Used in sorting a small number of elements in applications
where computational efficiency is less critical (e.g., UI lists).
⚫ Order Books in Trading Systems: Sorting buy and sell orders in a trading system with small
datasets.
⚫ Simple Sorting Operations: Sorting small-scale datasets in low-resource environments.
⚫ Game Development: Sorting game elements (e.g., inventory items) when performance is not
the primary concern.
⚫ Automated Testing: Sorting simple test case results or logs.
D. Quick Sort
⚫ Web Data Indexing: Sorting URL lists in search engines to optimize query results.
⚫ Database Sorting: Sorting large volumes of records in databases where high performance
critical.
⚫ Graphics Rendering: Sorting pixels or colors in image processing or video rendering.
⚫ Operating Systems: Sorting job queues in scheduling algorithms for tasks in operating
systems.
⚫ Data Analytic : Sorting high-dimensional data in big data applications for faster query
processing.
3. Heap Algorithms
Heap algorithms are used to create a priority queue. A heap is a specialized binary
tree where the parent node is either greater than or less than its child nodes. In a max
heap, the parent is greater than the child, and in a min heap, the parent is less than the
child.
A. Priority Queue
⚫ Task Scheduling: Managing task execution priorities in operating systems .
⚫ Resource Management: Allocating resources like memory to tasks based on priority.
⚫ Dijkstra's Algorithm: shortest path algorithms where nodes are processed based on priority.
⚫ Load Balancing: Distributing tasks to servers in a data center based on priority queues
⚫ Event Simulation: In simulation systems , where events are processed in order of priority.
B. Dijkstra’s Shortest Path Algorithm
Dijkstra's algorithm finds the shortest path from a starting node to all other nodes in a
graph, where each edge has a non-negative weight. The algorithm maintains a set of
nodes whose shortest distance from the source is known, and iteratively selects the
node with the smallest tentative distance.
⚫ GPS Navigation: Calculating the shortest route between two locations in a map.
⚫ Network Routing: Finding the best route for data packets across a network.
⚫ Logistics and Delivery: Determining the shortest delivery routes for couriers or delivery
services.
⚫ Robot Navigation: Path finding for robots in environments with obstacles, ensuring they take
the shortest route.
⚫ Urban Planning: Optimizing road networks for city planning by finding the most efficient
paths.
4. Tree Algorithms
A. Binary Search Tree (BST)
A Binary Search Tree (BST) is a data structure where each node has at most two
children, and the left child is less than the parent, and the right child is greater. Tree
algorithms include operations like searching, insertion, and deletion in binary search
trees.
⚫ Database Indexing: Searching and inserting records in databases (e.g., SQL databases) based
on keys.
⚫ Auto-completion: Storing and searching prefixes of strings for auto-completion in search
engines.
⚫ Expression Parsing: Parsing and evaluating mathematical expressions.
⚫ File System Indexing: Organizing files and directories in hierarchical structures for fast
searching.
⚫ Data Organization: Organizing large datasets for faster look upslookups in various
applications, such as in dictionary-based search systems.
[Link] Algorithm :
takes input data of arbitrary size and converts it into a fixed-size value, called a hash or hash code.
Hash functions are widely used in data integrity checks, cryptography, and various other applications.
real-life applications of hash algorithms:
⚫ Data Integrity and Verification (Checksum)
⚫ Password Storage and Authentication
⚫ Digital Signatures and Authentication
⚫ Blockchain and Cryptocurrencies
⚫ Data Deduplication