Computer science project
Computer science project
project
Made by: leule
arsema
abigiya
yafet
atronos
Introduction to Data
Storage
• Definition: Data storage refers
to the process of saving digital
data to physical or cloud-based
devices for access and retrieval.
• Types of Data Storage:Primary
Storage (RAM)
• Secondary Storage (HDD, SSD)
• Tertiary Storage (Optical discs,
Tape Drives)
• Purpose: Store files and data
persistently.
Data Storage
Devices
• Hard Disk Drives (HDD):
Magnetic storage for large
amounts of data.
• Solid-State Drives (SSD):
Faster, more durable than
HDDs.
• Cloud Storage: Remote data
storage accessible over the
internet.
• Optical Storage: CDs, DVDs.
• USB Flash Drives & SD
Cards: Portable and
convenient.
Measurement of
Data Storage
• Units of Data Storage:Bit
(b): Smallest unit of data.
• Byte (B): 1 byte = 8 bits.
• Kilobyte (KB) = 1,024 bytes
• Megabyte (MB) = 1,024 KB
• Gigabyte (GB) = 1,024 MB
• Terabyte (TB) = 1,024 GB
• Petabyte (PB) = 1,024 TB
• Note: Computer systems
usually use binary system
(base 2), so units are
measured as powers of 2 (1024
rather than 1000).
Calculation of File
Size
• Formula:
– File Size (in bytes) =
Number of characters × size
of each character
– Example: A text file with 1000
characters, each being 1 byte =
1000 bytes or 1 KB.
• For Images, Audio, and Video:
– Image: File size = Width ×
Height × Color Depth
– Audio: File size = Sample Rate
× Bit Depth × Channels ×
Duration
– Video: File size = Bitrate ×
Duration
File Size
Example: Text
File
• Example:
– A file with 500 characters
and ASCII encoding (1 byte
per character).
– File size = 500 bytes (0.5
KB)
• Calculating in KB, MB, GB:
– 1 KB = 1024 bytes
– 1 MB = 1024 KB
– 1 GB = 1024 MB
Introduction to
File Compression
• Definition: File compression
reduces the size of files for
storage efficiency or faster
transmission.Types of
Compression:Lossless
Compression: No data loss
(e.g., ZIP, PNG, FLAC).
• Loss y Compression: Some
data is lost for smaller file size
(e.g., JPEG, MP3, MP4).
• Why Compress?Save disk
space.
• Faster file transfers.
• Efficient storage in cloud
systems.
Compression
Algorithms
• Lossless Compression
Algorithms:
– Huffman Coding
– Lempel-Ziv-Welch
(LZW)
– Deflate (used in ZIP
files)
• Lossy Compression
Algorithms:
– JPEG (for images)
– MP3 (for audio)
– H.264 (for video)
Compression
Ratio
• Definition: The ratio of the
original file size to the
compressed file
size.Formula:
Compression Ratio=Original F
ile SizeCompressed File Size\
text{Compression Ratio} = \
frac{\text{Original File
Size}}{\text{Compressed
File
Size}}Compression Ratio=Co
mpressed File SizeOriginal Fil
e SizeExample:Original file
size = 100 MB
Benefits of File
Compression
• Storage Efficiency:
More data can be stored
in less space.
• Faster Transmission:
Smaller file sizes mean
quicker
uploads/downloads.
• Cost Savings: Reduced
storage and bandwidth
usage.
Compression
Example: Image File
• Original File:
– Image resolution: 4000 x
3000 pixels
– Color depth: 24-bit (3 bytes
per pixel)
– File size = 4000 × 3000 × 3
bytes = 36,000,000 bytes
(~34.3 MB).
• After Compression (JPEG):
– File size = 5 MB
(Compression ratio ~6.86:1).
• Trade-off: Lossy compression
results in smaller files but may
reduce image quality.
Real-World Applications
of Data Compression