Data-Structures-and-Algorithms
Data-Structures-and-Algorithms
and Algorithms
Data structures are fundamental building blocks for organizing and
storing data in computer programs. Algorithms provide a set of
instructions for solving problems, often by manipulating data
structures.
Introduction to Data
Structures
1 Linear Data 2 Non-Linear Data
Structures Structures
Linear data structures Non-linear data structures
store elements in a allow for complex
sequential order, like relationships between
arrays and linked lists. elements, such as trees
and graphs.
Time complexity describes how the Space complexity refers to the Big O notation is a standard way to
execution time of an algorithm amount of memory an algorithm express the upper bound of an
grows with the input size. requires to operate, also algorithm's time or space
dependent on input size. complexity.
Sorting Algorithms
Bubble Sort 1
Simple but inefficient, compares adjacent elements
and swaps if out of order.
2 Merge Sort
Divide and conquer approach, recursively divides the
array, sorts subarrays, and merges them.
Quick Sort 3
Pivoting technique, partitions the array around a
pivot element, recursively sorting subarrays.
Searching Algorithms
Linear Search Binary Search
Iterates through each Efficiently searches a sorted
element in a list, comparing list by repeatedly dividing
it to the target value. the search interval in half.
Hash Tables
Use a hash function to map keys to indices in an array,
providing near-constant time search operations.
Stacks, Queues, and Trees
Stack First-In, Last-Out Used for function
(FILO) call stacks,
undo/redo
operations
Linked Lists
Linked lists store elements in nodes that point to each
other, allowing for dynamic resizing and efficient
insertion/deletion.
Applications
Arrays are used for storing lists of items, while linked
lists are useful for implementing stacks, queues, and
other data structures.
Applications and Real-
World Examples