1/26
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
Data Structure
Data Structure is considered as a backbone of a simple or complex
system (Alheraki, 2024). It is also a part of the fundamentals of any
programming language as it enables us to store, organize and
manipulate efficiently. It also affects the speed and memory of the
software that we develop
Types of Data Structure
Primitive Data Types and Non-Primitive Data Types
Primitive
Integer
Float
String
Boolean
Non-Primitive (Linear)
Arrays
Stack
Queue
Linked-List
Tuple
Dictionary
Non-Primitive (Non-Linear)
Trees
Graphs
Hash Tables
Primitive Data Types
These data types are the most basic data due to its structure. They are
the building blocks used to help programmer understand the
fundamentals of a programming language and produce a complex
system. It is also used for assigning values for data manipulation.
Integer/s
It represents whole numbers with no fractional or decimal point from
negative infinity to infinity
Float
It stands for āfloating point numberā. It represent numbers with
fractional parts and precise decimal point.
String
It is a sequence of characters that is used to represent text. It is one of
the most common used data structure in programming for storing or
holding a value. A āstringā can be declared using letters, numbers,
symbols and whitespace.
Boolean
It is often referred to as bool, it is used for performing logical operations
and control flow decisions such as ātrueā or āfalseā.
Non-Primitive Data Types
These structures are far more complex data built using primitive data
types as foundation. This allow programmers to organize and
manipulate larger and complicated sets of data efficiently. Unlike
Primitive Data Types, it has two sub-categories which are Linear and
Non-Linear Data Structures.
Linear Data Structures
It refers to the data elements which are arranged sequentially or ālinearlyā, where each
element is connected to its previous and next adjacent elements. Data can be
accessed in order one after another following a straight-line arrangement.
1. Sequential access pattern ā access data in order.
2. Single-level structure ā each element is connected to one anotherās predecessor
and successor except for first and last.
3. Memory Utilization - Often use memory in a contiguous manner, which may be
efficient for access but may also cause wasted space if not managed properly
Array
It is a data structure that stores a fixed-size sequential collection of elements of
the same type. It is one of the simplest and most widely used data structures in
computer programming. The elements in an array are stored in contiguous
memory locations and can be accessed randomly using indices.
Stack
It is a linear data structure that follows a particular order in which operations are
performed. The order may be LIFO (Last In First Out) or FILO (First In Last Out). In a stack, the most recently added element is the first one to be removed.
Queue
It is a collection of elements that follows the principle of First in, First out (FIFO).
The first element that will be added to the queue will be the first one to be
removed from the sequence. This ensures a fair system where everyone gets
served in the sequence they arrived
Linked-List
It is a data structure in programming consisting of a sequence of elements
called nodes that contains data and a reference (pointer) to the next node. It is
most commonly used for moving data in the middle efficiently
Tuple
It is a data structure with a fixed-size collection of heterogeneous values. Unlike
array and linked-list, it can handle store data with different data types. Once an
array and tuple is created, its sizes cannot be changed.
Dictionary
It is an unordered collection of key-value pairs. Each key is unique and it maps
to a value, which can be accessed, modified, or deleted. Maps access elements
by their keys. This makes maps particularly useful for tasks that require efficient
searching, such as implementing lookup tables, caching, and storing
configurations.
Non-Linear Data Structures
These are where data elements are not arranged in sequential manner they are
arranged in a hierarchical or interconnected fashion, allowing for more complex
relationships between the elements. The most common non-linear data structures are
trees and graphs.
1. Trees - hierarchical data structures with a root node and child nodes. Each node
can have multiple child nodes, forming a tree-like structure.
2. Graphs - non-linear data structures that consist of nodes (vertices) and edges
connecting these nodes.
3. Hash Tables - data structures that use a hash function to map keys to array
indices, allowing efficient key-value pair lookups.
Trees
It is a hierarchical data structures with a root node and child nodes. Each node
can have multiple child nodes, forming a tree-like structure. There are no loops
or cycle in Trees since the nodes does not meet each other and the presence of
levels.
Graphs
It is a data structure consists of nodes (vertices) connected by edges,
representing relationships between entities. It is useful in fields such as social
network analysis, recommendation systems, and computer networks.
Algorithm
It is a step-by-step process that you follow to solve a problem or
complete a task. An efficient algorithm helps lessen space and time
consumed in completing a task. In accomplishing a conflict, a user can
generate multiple algorithm to process it, however it is crucial to ensure
to use the most fitting one
Algorithm Analysis
The best algorithm has a fine balance between time taken and
memory consumed. It is tested through algorithm analysis, to
understand it better and search for improvements.
Types of Algorithm
Sorting Algorithms
Search Algorithms
Graph Algorithms
Sorting Algorithms
It is used to arrange data in a particular/specific order
(ascending or descending). Examples include Quick Sort, Merge Sort, and Bubble
Sort.
Search Algorithms
It is used to find specific data within a structure. Examples
include Binary Search and Linear Search that are applicable for linear data
structures.
Graph Algorithms
It is used to solve problems related to graph theory, such as
finding the shortest path or detecting cycles. Examples include Depth-First Search
(DFS), Breadth-First Search (BFS), and Dijkstraās Algorithm.