Docsity

COMPUTER NETWORK NOTES, Study notes of Engineering

Partial preview of the text

Download COMPUTER NETWORK NOTES and more Study notes Engineering in PDF only on Docsity!

Data Structures &

Algorithm

Module 1: Introduction, Stack and Queue

Dr. Tabassum A. Maktum

Curriculum Structure & Examination Scheme

Course Outcomes

CO No. Course outcome

CO Apply fundamental operations such as insertion, deletion, and traversal on stack and queue data structures. CO Perform various operations such as insertion, deletion, and traversal operations on linked list data structures CO Utilize tree and graph data structures to solve real-world computational problems across various domains CO Select and apply appropriate searching and sorting algorithms to efficiently solve computational problems CO Demonstrate understanding of divide and conquer and greedy algorithmic strategies. CO Apply dynamic programming techniques to solve optimization problems

Structure

  • Defines how the object or thing is kept and organized
  • Which structure is better for keeping books?

Choice of Structure

  • As we have seen examples
  • The choice of structure is user specific

Introduction to Data Structure

  • We have seen the structure, it defines the way object/things are:
    • Stored
    • Organised
  • Data structures: Data structures is a way to store and organize data in a computer, so that it can be used efficiently.
  • Selecting proper structure, makes data to be used and processed efficiently
  • Also the choice of data structure is application specific

Concept of ADT

  • ADT: Abstract Data Type
  • Let’s break ADT:
    • Data type:
    • A data type represents a set of possible values
      • such as {..., - 2, - 1, 0, 1, 2, ...}, or {true, false}
    • Classification of Data Types
      • Primitive : integer, float, character
      • Non-primitive: arrays, struct, union

Concept of ADT

  • Each primitive type has ✓ a set of values ✓ a data representation ✓ a set of operations Type Values Representation^ Operations Boolean True, False Single byte & , ||,! Char, Byte, Short, int, Long Integers of varying sizes Two’s complement +, - , *, /, others

Operation on Data Structures

  • Operation below can be performed on various data structures shown previously.
    • Insert : Add the data item.
    • Delete : Remove the data item
    • Search: locate a particular item, from given set of data
    • Sort : Sort the data on the given parameter
    • Merge : combine the data from different source/set.
  • If you see, all these above operations are probably in most of applications we are using in day to day life for managing our information/data

Concept of ADT

  • ADT enables us to specify the general operations w.r.t to data structures, we use as per application requirements.
  • In short enable us to emphasize what need to be done, rather than how it needs to be done.
  • So now lets move to type of data structures, then we see how ADT helps us define operation with out bothering about type of data we store.

ADT Example 2

  • Example:
  • Library Management System
  • Data
    • Number of books
    • Book title, author, year....
    • Book is available
    • Issue date and return date.....
    • Set of operations
      • Issue a book
      • Return a book
      • Pay fine
      • Add a new book
      • Remove any book........

Puzzle

▪ Unscramble and identify ……

Scramble srurtutec aryar gritnee tfotla inuno Unscramble structure array integer float union

Classification of Data Structure

  • Depending on the way, the elements in data structures mentioned previously can be classified into : - Primitive Data Structures : Fundamentals datatype supported by programming language e.g. int , float etc - Non-primitive Data Structures : Data structures created using combining primitive data structures. These can be further classified as: - Linear - Non-linear

Classification of Data Structure

  • Linear: Elements of the data structure forms linear relationship or sequential order.
  • Non-linear : Elements of this data structure are stored/accessed in a non-linear order