DSA
DISADVANTAGES OF DATA STRUCTURE
1. Complex 2. Time 3. Cumbersome
BENEFITS OF DATA STRUCTURE
1. Efficiency of the application or program 2. A data structure exhibits time complexity 3. Reusable 4. Data storage 5. Access the data anytime
5 Main Algorithm Design Techniques
1. Greedy algorithms 2. Divide and conquer 3. Dynamic Programming 4. Randomized Algorithms 5. Backtracking Algorithms
DATA STRUCTURES ARE CLASSIFIED BASED ON
1. Primitive and Non-Primitive Data 2. Linear (Static and Dynamic) Data Structure and Non-linear Data
2 Methods of specifying an algorithm
1. Pseudocode 2. Flowchart
Is a finite sequence of well-defined computer-implementable instructions, typically to solve a class of problems or to perform a computation
ALGORITHM
simply a finite set of elements having the same type referenced under a common name.
Array type or array
examples of Structure Type.
Arrays, strings, and records
represent a set of individual data and is frequently used to create a program. - Sometimes called atomic data structure as they represent a form where data can no longer be divided or have no parts.
BASIC DATA TYPE OR PRIMITIVE DATA STRUCTURES
concerned with basic arithmetic problems like finding the sum, product or quotient of two numbers.
Basic numerical algorithms
is a mathematical notation that describes the limiting behavior of a function when the argument tends towards a particular value or infinity. It is a member of a family of notations invented by Paul Bachmann, Edmund Landau, and others, collectively called Bachmann-Landau notation or asymptotic notation.
Big O notation
notation gives the 'worst case' time complexity for a given algorithm. It represents a curve that bounds an algorithmic function from above. It is the set of functions that grow slower than or at the same rate as expression. It indicates the maximum required by an algorithm for all input values.
Big O notation
_______ linked lists can exist in both singly linked list and doubly linked list. - Since the last node and the first node of the circular linked list are connected, the traversal in this linked list will go on forever until it is broken
CIRCULAR LINKED LIST
comprised of alphabets, numerals, and symbols as characters. A character code is expressed as a binary number inside a computer.
Character type
are important in games and are also heavily used in CAD software
Computational geometry algorithms
allow software to recognize features in images, from your cellphone scanning a QR code all the way to autonomous cars probing their environment with laser scanners.
Computer vision algorithms
Algorithms that use a fixed amount of memory regardless of input size
Constant Space (0(1))
Operations that take the same amount of time regardless of the input size
Constant Time (0(1))
Every instruction must be sufficiently basic that it can in principle, be carried out by a person by manual means and must generate a correct output.
Correctness
digitally sign and encrypt your data when it's sent over the internet and help protect you from people spying on your data or stealing your identity.
Cryptographic algorithms
are structures programmed to store ordered data, so that various operations can be performed on it easily
DATA STRUCTURES
should be designed and implemented in such a way that it reduces the complexity and increases the efficiency.
DATA STRUCTURES
is a set of values from which a variable, constant, function, or other expression may take its value.
DATA TYPE
is another term usually used synonymously with data structures but in itself is different from data structures
DATA TYPE
_______ Linked Lists contain three "buckets" in one node; one bucket holds the data and the other buckets hold the addresses of the previous and next nodes in the list.
DOUBLY LINKED LIST
Each instruction must be clear and unambiguous, meaning each step of an algorithm must be precisely defined.
Definiteness
deletes an element at the given index
Deletion
displays the contents of the array
Display
______ structures are those which expands or shrinks depending upon the program need and its execution. Also, their associated memory location changes
Dynamic
a data type that enumerates all possible values of variables.
Enumeration type
Time complexity grows exponentially, often seen in recursive algorithms
Exponential Time (0(2^n))
If we trace out the instructions of an algorithm, then for all cases the algorithm will terminate after a finite number of steps.
Finiteness
They are most successfully used for any kind of problem where you need to find an efficient path through some kind of network — be it a computer network, a road network, or something else.
Graph algorithms
A _______ stores a collection of items in a non-linear fashion. _______ are made up of a finite set of nodes, also known as vertices, and lines that connect them, also known as edges. These are useful for representing real-life systems such as computer networks.
Graphs
A _________, stores a collection of items in an associative array that plots keys to values. A ______ uses a hash function to convert an index into an array of buckets that contain the desired data item.
Hash Table
_________ data structures represent a structure whose elements are of the same type
Homogeneous
An algorithm has zero or more input quantities which are externally supplied taken from a set of objects called the domain of the algorithm.
Input
adds an element at the given index
Insertion
represents integers or whole numbers where in the maximum or minimum value is the unit of data that a computer can process at one time and is determined by the length of one word
Integer
are particularly useful when dynamic data storage and efficient data manipulation are essential.
LINKED LIST
are the foundation of more complex data structures and algorithms, such as stacks, queues, and various graph structures
LINKED LIST
is a collection of nodes.
LINKED LIST
is a fundamental data structure in computer science and programming that is used to organize and store a collection of data elements.
LINKED LIST
Memory usage grows linearly with the input size
Linear Space (0(n)
Time complexity grows linearly with the input size
Linear Time (0(n))
A ______ stores a collection of items in a linear order. Each element, or node, in a _______ contains a data item as well as a reference, or link, to the next item in the list.
Linked list
Common in divide-and-conquer algorithms, where the input is repeatedly divided
Logarithmic Time (0(log n))
sometimes referred to as Boolean type where the values are used in performing logical operations such as AND, OR, and NOT.
Logical type
In ________ data structure, the elements may or may not be of the same type
Non-Homogeneous
simulate the physical behavior of their systems and optimize them for performance before they are even built.
Numerical analysis
notation gives the 'best case' time complexity for an algorithm. It represents a curve that bounds an algorithmic function from below. It is the set of functions that grow faster than or at the same rate as expression. It indicates the minimum time required by an algorithm for all input values.
Omega
Where elements are stored one after another
One-dimensional array (1D arrays)
is how the time of execution of a program, depends on the length of the input. We use different notations to describe the behavior of a function. Big O, Omega and Theta notation
Order of growth
It has one or more output quantities which generate a set called the range of the algorithm.
Output
_______ type are addresses that are allocated in a main memory unit. Pointer types are used to refer to variables, file records, or functions.
POINTER TYPE
used to specify an original-value subset by constraining existing data types, that is identifying upper and lower limits of a variable.
Partial type
Accessing the content while removing it from the stack, is known as a _________. In an array implementation of pop() operation, the data element is not actually removed, instead top is decremented to a lower position in the stack to point to the next value. But in a linked-list implementation, pop() actually removes data element and deallocates memory space.
Pop Operation
The process of putting a new data element onto stack is known as a
Push Operation
Memory usage grows quadratically with the input size
Quadratic Space (0(n^2))
Time complexity grows quadratically with the input size
Quadratic Time (0(n^2))
A ________ stores a collection of items similar to a stack; however, the operation order can only be first in first out.
Queues
represent fixed-point and floating-point numbers
Real number type
is also a set of elements but this time of different data types referenced under a common name.
Record type
generate more and more photo-realistic images out of some artificial scene.
Rendering algorithms in computer graphics
the most basic data type which is usually declared according to the syntax rule of a programming language.
SIMPLE TYPE
is a linear data structure implementing a particular kind of abstract data type (ADT), which is assembled by following the LIFO (Last In, First Out) strategy
STACK
is a data structure that contains a basic data type or any of the defined data types as its elements.
STRUCTURE TYPE OR SIMPLE DATA STRUCTURE
searches an element using the given index or by the value
Search
Finding the minimum or maximum elements in the data structure. This operation is often used in priority queues or finding extreme values in datasets
Searching for Min/Max
they are used to compress audio and video data very efficiently and allow us to store a whole 3-hour UHD movie on a single plastic disc, or stream it live over the internet.
Signal processing algorithms
BASIC DATA TYPE OR PRIMITIVE DATA STRUCTURES can be divided into 2 types, what are those?
Simple Type and Pointer Type.
______ linked lists contain two "buckets" in one node; one bucket holds the data and the other bucket holds the address of the next node of the list
Singly Linked Lists
3 types of linked list
Singly, Doubly, Circular
allow programmers to arrange data in memory in many different ways so that specific pieces of data can later be retrieved efficiently when they are needed.
Sorting and searching algorithms
is crucial when working with limited memory resources, such as in embedded systems or when dealing with large datasets
Space complexity
is similar to time complexity but focuses on the amount of memory or space an algorithm uses in relation to its input size
Space complexity
refers to the amount of memory space required by the algorithm, during the course of its execution. Space complexity must be taken seriously for multi-user systems and in situations where limited memory is available.
Space complexity
A ____ stores a collection of items in the linear order that operations are applied. This order could be last in first out (LIFO) or first in first out (FIFO).
Stacks
________ data structures are those whose sizes and structures associated memory locations are fixed, at compile time
Static
is a way to find the greatest common divisor of two positive integers, m and n
THE EUCLIDEAN ALGORITHM
notation gives the 'average' time complexity for an algorithm. It consist of all the functions that lie in both O(expression) and Omega(expression).
Theta
Contains three dimensions, so it can be considered an array of two-dimensional arrays
Three-dimensional array (3D arrays)
helps analyze and compare different algorithms' efficiency in solving a particular problem. It tells us how the runtime of an algorithm scales with input size
Time complexity
is a measure of the amount of time an algorithm to run as a function of the size of its input
Time complexity
way to represent the amount of time required by the program to run till its completion. It's generally a good practice to try to keep the time required minimum, so that our algorithm completes its execution in the minimum time possible.
Time complexity
print all the array elements one by one
Traverse
A _____ stores a collection of items in an abstract, hierarchical way. Each node is linked to other nodes and can have multiple sub-values, also known as children.
Trees
Can be considered as an array of arrays or as a matrix consisting of rows and columns
Two-dimensional array (2D arrays)
updates an element at the given index
Update
CHARACTERISTICS OF AN ALGORITHM
Well-defined inputs Clear and unambiguous Language independent Well-defined output Finiteness Feasible
An ______ stores a collection of items at adjoining memory locations. Items that are the same type get stored together so that the position of each element can be calculated or retrieved easily. _______ can be fixed or flexible in length.
array
Removing existing data from the data structures is called
deleting
Adding a new data into the data structures is called
inserting
In ___________ data structures, the data items are arranged in a linear sequence
linear
Combining the data from two data structures (or files) into a single is called
merging
For _________ data structures, the data items are not in sequence
non-linear
Finding the location(s) of data satisfies one or more conditions is
searching
Arranging the data in a specified order (ascending or descending) is
sorting
If this type is a character type, we refer to it as a _______ or a collection of character elements.
string
Accessing or visiting each storage location where the data is stored is called
traversing