Overview of Data Structure and Algorithm

Data Structure and Algorithm

  • branch of computer science that deals with creating machine-efficient and optimized computer programs

  • optimize the codes in software engineering

  • building block of the software language (software development)

Data  Structure

storage and organization of data

Algorithm

step-by-step procedure to solve a problem 

DSA IN OUR DAILY LIFE

Data Structure

  • Stack Data Structure: like a pile of plates placed on top of each other. (element can be accessed only after accessing the previous elements)

  • Queue Data Structure: like boarding a bus (FIFO - first in first out; the person who first gets into queue is the one who firsts gets on the bus)

  • Graph Data Structure: in Social Media and Google Map (every user is a node that will exists an edge (connection) within one another)

Algorithm

  • Sorting Algorithm: to arrange books in a shelf (arranging items systematically)

  • Shortest Path Finding Algorithm: to find the shortest path in google map

DATA STRUCTURE

Classification/Types

  • Linear Data Structure

    • elements are arranged in one dimension, aka linear dimension

    • example: lists, stack, queue

  • Non-Linear Data Structure

    • elements are arranged in one-many, many-one, and many-many dimensions

    • example: tree, graph, table

Array

  • collection of data items stored at a contiguous memory locations

LinkedLists

  • elements are not stored at a contiguous location; the elements are linked using pointers

Hashing Data Structure

  • designed to use a special function called the Hash Function which is used to map a given value with a particular key for faster access of elements

ABSTRACT DATA TYPES (ADT)

  • a type (or class) for objects whose behavior is defined by a set of values and a set of operations

  • “abstract” because it gives an implementation-independent view

  • abstraction: process of providing only the essentials and hiding the details

List ADT

  • data is generally stored in key sequence in a list which has a head structure consisting of count, pointers, and address of compare function needed to compare data in the list

  • the data node contains the  pointer to a data structure and a self-referential pointer which points to the next node in the lis

Stack ADT

  • instead of data being stored in each node, the pointer to data is stored

  • LIFO (Last In First Out)

Queue ADT

  • follows basic design of the stack abstract data type

Features of ADT

  • Abstraction: user does not need to know the implementation of data structure

  • Better Conceptualization of the real-world

  • Robust and has ability to catch errors