0% found this document useful (0 votes)
37 views22 pages

1604393139CSC 207-Slide1-Introduction and Terminologies

Uploaded by

Samlove Ojo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views22 pages

1604393139CSC 207-Slide1-Introduction and Terminologies

Uploaded by

Samlove Ojo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

CSC 207: Data Structures

TUTOR: DR. (MRS) OLATUNJI K. A.


Objectives of Data Structures
The objectives of this study are to make students
understand:
• Specification, representation, and
implementation of data types and data structures
• Basic techniques of algorithm analysis, recursive
methods.
• Applications of Data Structures
• Provide example use for these structures.
• Show how to implement some of the structures
and its operations.
Learning Outcomes
• At the end of the lectures students should be
able to understand:
• Ways to represent data and
• Algorithms to manipulate these representations.
• How to implement some of the structures and its
operations
Course Contents
• Basic Terminologies
• Elementary Data Organization
• Algorithm
• Abstract Data Types (ADT)
• Arrays: Definition, Single and Multidimensional
Arrays, Representation of Arrays: Row Major
Order, and Column Major Order, Application of
arrays.
Course Contents Contd.
• Linked lists: Array Implementation and Dynamic
Implementation of Singly Linked Lists, Doubly Linked
List, Circularly Linked List, Operations on a Linked
List. Insertion, Deletion, Traversal.
• Stacks: Abstract Data Type, Primitive Stack
operations: Push & Pop, Array and Linked
Implementation of Stack in C, Application of stack:
• Queue: Operations on Queue: Create, Add,
• Delete, Full and Empty, Circular queues, Array and
linked implementation of queues in C, Dequeue .
Course Contents Contd.
• Trees: Basic terminology, Binary Trees, Binary
Tree Representation: Array Representation and
Dynamic Representation, Complete Binary Tree,
Array and Linked Representation of Binary trees,
Tree Traversal algorithms: Inorder, Preorder and
Postorder
• Graphs: Terminology, Sequential and linked
Representations of Graphs: Adjacency Matrices,
Adjacency List, Adjacency Multi list, Graph
Traversal : Depth First Search and Breadth First
Search, Connected Component, Spanning Trees,
Basic Terminologies
• What is data?:
• Data are simply collection of facts and figures.
• Data are values or set of values.
• Data is a set of elementary items
• A data item refers to a single unit of values.
• Group items are data items that are divided into sub
item;
• Elementary items are those items that are not divided
into sub item.
• For example, an employee’s name may be divided into
three sub items – [first name, middle name and last
name] but employee’s ID would normally be treated as
a single item.
• Work to do:
• Structure the following into group or
elementary items: Name, ID, Age, Gender,
First, Middle, Last, Street, Area, Address
Data Type
• Data type is a classification identifying one of
various types of data, such as floating-point,
integer, or Boolean,
• that determines the possible values for that
type;
• the operations that can be done on values of
that type;
• and the way values of that type can be stored.
• Data Type is of two types:
• Primitive and non-primitive data type.
• Primitive data type is the basic data type that is
provided by the programming language with
built-in support.
• This data type is native to the language and is
supported by machine directly. For example: int,
float, char, double.
• Non-primitive data type is derived from primitive
data type. For example- array, linked list,
structure etc.
Variable
• It is a symbolic name given to some known or
unknown quantity or information, for the
purpose of allowing the name to be used
independently of the information it represents.
• A variable name in computer source code is
usually associated with a data storage location
and thus also its contents.
• Variable may change during the course of
program execution.
• Record: Collection of related data items is
known as record.
• Program: this is a sequence of instructions that a
computer can interpret and execute.
• Entity: An entity is something that has certain
attributes or properties which may be assigned
some values. The values themselves may be
either numeric or non-numeric. For example:
Attributes: Name Age Gender Phone Number
Values: Ola 22 Male 0812 3676 002
Funmi 21 Female 0809 5553 231
Solomon 20 Male 0803 4621 889
• Entity Set: An entity set is a group of or set of
similar entities. For example, employees of an
organization, students of a class etc.
• Each attribute of an entity set has a range of
values, the set of all possible values that could
be assigned to the particular attribute.
• Information: information is sometimes used
for data with given attributes or processed
data.
• Field: A field is a single elementary unit of
information representing an attribute of an
entity.
• File: File is a collection of records of the
entities in a given entity set. For example, file
containing records of students of a particular
class.
• Key: A key is one or more field(s) in a record
that take(s) unique values and can be used to
distinguish one record from the others.
• Algorithm: It can be defined as sequence of
computational steps that transform the input
into the output.
• An algorithm can be expressed in three ways:-
(i) in any natural language such as English, called
pseudo code.
(ii) in a programming language or
(iii) in the form of a flowchart.
• EFFICIENCY OF AN ALGORITHM
• In computer science, algorithmic efficiency are
the properties of an algorithm which relate to the
amount of resources used by the algorithm.
• An algorithm must be analyzed to determine its
resource usage.
• For maximum efficiency there is need to
minimize resource usage. However, the various
resources (e.g. time, space) can not be compared
directly, so if two algorithms are being
compared-which of two algorithms is considered
to be more efficient often depends on which
measure of efficiency is being considered as the
most important, e.g. is the requirement for high
speed, or for minimum memory usage, or for
some other measure.
• It can be of various types:
• Worst case efficiency: It is the maximum number of
steps that an algorithm can take for any collection of
data values.
• Best case efficiency: It is the minimum number of steps
that an algorithm can take any collection of data values.
• Average case efficiency: It can be defined as
- the efficiency averaged on all possible inputs
- must assume a distribution of the input
- We normally assume uniform distribution (all keys are
equally probable)
• If the input has size n, efficiency will be a function of n
TIME AND SPACE COMPLEXITY
• Complexity of algorithm is a function of size of
input of a given problem instance which
determines how much running time/memory
space is needed by the algorithm in order to run
to completion.
• Time Complexity: Time complexity of an
algorithm is the amount of time it needs in order
to run to completion.
• Space Complexity: Space Complexity of an
algorithm is the amount of space it needs in
order to run to completion.
Abstract Data Type
• It can be defined as a collection of data items
together with the operations on the data.
• The word “abstract” refers to the fact that the
data and the basic operations defined on it are
being studied independently of how they are
implemented.
• It involves what can be done with the data,
not how has to be done
ADT Contd.
• An Example: Collections
• Programs often deal with collections of items. These
collections may be organized in many ways and use
many different program structures to represent them,
yet, from an abstract point of view, there will be a few
common operations on any collection. These might
include:
Data Structure
• A data structure is a particular way of storing and organizing
data in a computer’s memory so that it can be used
efficiently.
• A data structure is a logical or mathematical model of a
particular organization of data.
Need of data structure
• It gives different level of data organization.
• It tells how data can be stored and accessed in its
elementary level.
• Provide operation on group of data, such as adding an item,
looking up highest priority item.
• Provide a means to manage huge amount of data efficiently.
• Provide fast searching and sorting of data.
Selecting a data structure
Selection of suitable data structure involve following steps: –
• Analyze the problem to determine the resource constraints a solution
must meet.
• Determine basic operation that must be supported. Quantify resource
constraint for each operation
• Select the data structure that best meets these requirements.
• Each data structure has cost and benefits. Rarely is one data structure
better than other in all situations.
• A data structure require :
Ø Space for each item it stores
Ø Time to perform each basic operation
Ø Programming effort.
• Each problem has constraints on available time and space. Best data
structure for the task requires careful analysis of problem characteristics.
• Assignment: write short note on types of data structures (linear, non
linear, dynamic and static data structures)

You might also like