Thursday, July 13, 2023

Data Structures Notes

 Data Structures Notes


  • Arrays are a linear data structure that store elements in a contiguous block of memory. They are easy to implement and access, but they can be inefficient for storing large amounts of data or for dynamic data structures.
  • Linked lists are a linear data structure that store elements in a linked list of nodes. Each node contains a data element and a pointer to the next node in the list. Linked lists are more efficient than arrays for storing large amounts of data or for dynamic data structures, but they can be more difficult to implement and access.
  • Stacks are a linear data structure that follows the last-in, first-out (LIFO) principle. Elements are added to the stack at the top and removed from the top. Stacks are often used to implement functions like undo and redo.
  • Queues are a linear data structure that follows the first-in, first-out (FIFO) principle. Elements are added to the queue at the rear and removed from the front. Queues are often used to implement data structures like priority queues.
  • Hash tables are a non-linear data structure that store elements in a hash table. Each element is assigned a hash code, which is used to determine the index of the element in the hash table. Hash tables are very efficient for searching, but they can be less efficient for insertion and deletion




















Data Structure

Type

Access Order

Applications 

Stack

Linear

LIFO

Backtracking, Undo, call stack,

Page-visited history

Queue

Linear

FIFO

Simulation, Printer queue, Process scheduling, GUI event

Tree

Non-linear

Hierarchical

Decision processes, File system, binary search, Arithmetic expressions

Graph

Non-linear

Any

Social network, shortest path, minimum spanning tree, Transportation and Computer networks, ERD








Data structure

Description

Access

Advantages

Disadvantages

Stack

LIFO (last in, first out) data structure

Top element

Easy to implement, efficient for operations that only need to access the top element

Can only access the top element

Queue

FIFO (first in, first out) data structure

Front element

Easy to implement, efficient for operations that only need to access the front element

Can only access the front element

Linked list

Linear data structure

Any element

Flexible and efficient for operations that need to access any element in the list

Can be inefficient for some operations, such as inserting and deleting elements in the middle of the list

Graph

Non-linear data structure

Any vertex

Flexible and powerful for modeling relationships between objects

Can be difficult to implement and manage

Hash table

Maps keys to values

Key

Fast lookups

Can be inefficient for some operations, such as inserting and deleting elements









No comments:

eLearning and Blackboard

  IT professional, U bring a unique set of skills and expertise that can greatly contribute to the successful development and implementati...