0% found this document useful (1 vote)
396 views

Kebere Goshu: Bahir Dar University

This document provides an introduction to data structures and algorithms. It discusses key concepts like algorithms, abstract data types, properties of algorithms, and different types of data structures. Examples of data structures mentioned include arrays, linked lists, stacks, and queues. The document also covers advantages of data structures like efficient data storage and retrieval. Disadvantages discussed are the need for qualified professionals and increased costs with larger applications.

Uploaded by

Tadele Molla
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (1 vote)
396 views

Kebere Goshu: Bahir Dar University

This document provides an introduction to data structures and algorithms. It discusses key concepts like algorithms, abstract data types, properties of algorithms, and different types of data structures. Examples of data structures mentioned include arrays, linked lists, stacks, and queues. The document also covers advantages of data structures like efficient data storage and retrieval. Disadvantages discussed are the need for qualified professionals and increased costs with larger applications.

Uploaded by

Tadele Molla
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

BAHIR DAR UNIVERSITY

COLLEGE OF SCIENCE
DEPARTMEN OF STATISTICS
Introduction Computer Power Poit Presentation

SUMMITION TO M ASRIE .H.


SBMMITED DATE 29/10/2013 E.C

KEBERE GOSHU
ACKNOWLEDGMEN
T
 Thanks bahir dar university
for sucesseful wifi accesses
and other material.and
thanks my lecture for given
my first participation to
computer to draw this
document b\c before this time
iam not Know about
computer ,and thanks my
firend for supported.

KEBERE GOSHU
INTRODUCTION OF DATA
STRUCTURE AND
ALGORITHMS
1 Introduction to Data Structures & Algorithm
  Session Objectives  To understand the concepts of – Data structures –
Types of Data Structures – Applications – Algorithms – ADTs
 Session Topics  Algorithms  ADTs  Properties of an Algorithm  Data
structures  Types of Data structures Problem Solving Phase  Stacks
and Queues
 Good Computer Program  A computer program is a series of instructions
to carry out a particular task written in a language that a computer can
understand.  The process of preparing and feeding the instructions into
the computer for execution is referred as programming.  There are a
number of features for a good program Run efficiently and correctly Have a
user friendly interface Be easy to read and understand Be easy to debug Be
easy to modify Be easy to maintain
 Good Computer Program  Programs consists of two things: Algorithms
and data structures  A Good Program is a combination of both algorithm
and a data structure  An algorithm is a step by step recipe for solving an
instance of a problem  A data structure represents the logical relationship
that exists between individual elements of data to carry out certain tasks 
A data structure defines a way of organizing all data items that consider not
only the elements stored but also stores the relationship between the
elements
 Algorithms  An algorithm is a step by step recipe for solving an instance
of a problem.  Every single procedure that a computer performs is an
algorithm.  An algorithm is a precise procedure for solving a problem in
finite number of steps.  An algorithm states the actions to be executed and
the order in which these actions are to be executed.  An algorithm is a well
ordered collection of clear and simple instructions of definite and effectively
computable operations that when executed produces a result and stops
executing at some point in a finite amount of time rather than just going on
and on infinitely.

KEBERE GOSHU
DATA STRUCTURE
 WHAT IS DATA STRUCTURE IN COMPUTER SCIENCE?
Definition Data Structure;
 In computer science, a data structure is a data organization,
management, and storage format that enables efficient access
and modification.[1][2][3] More precisely, a data structure is a
collection of data values, the relationships among them, and
the functions or operations that can be applied to the data.[4]
Data structures serve as the basis for abstract data types
 (ADT). The ADT defines the logical form of the data type. The
data structure implements the physical form of the data type.[5]
 Different types of data structures are suited to different kinds of
applications, and some are highly specialized to specific tasks.
For example, relational databases commonly use B-tree
 indexes for data retrieval,[6] while compiler implementations
usually use hash tables to look up identifiers.[7]
 Data structures provide a means to manage large amounts of
data efficiently for uses such as large databases and internet
indexing services. Usually, efficient data structures are key to
designing efficient algorithms. Some formal design methods
and programming languages emphasize data structures, rather
than algorithms, as the key organizing factor in software
design. Data structures can be used to organize the storage
and retrieval of information stored in both main memory and
secondary memory.[8]

KEBERE GOSHU
HISTORY OF DATA
STRUCTURE
 history.
1. Firstly having no history is the simplest, in such a case, you don't
care about the previous states, only the present matters. For
stateful applications, there are 5 different ways of managing the
history of state:
2. No History - Living in the moment. - Examples: Any stateful
application that doesn't discards all previous states upon mutation.
3. Ad Hoc Snapshotting - Allows restoration to manually saved
snapshots. - Examples: Memento Pattern.
4. Singleton - Only remembers the previous snapshot, where
undoing the undo is just another undo. - Examples: Xerox PARC
Bravo.
5. Stack - Allows linear undo. - Examples: AtariWriter.
6. Stack - Allows linear undo and redo. - Examples: Browser
History, Microsoft Word, Adobe Photoshop Append-Only Log -
Allows moving forward with reversed patches/deltas (a.k.a.
compensating transactions). - Examples: Git-Revert, Datomic,
Blockchain, Event Sourcing.Tree - The Multiverse Approach. -
Examples: Git, Vim, Emacs with UndoTree, Delorean.
There's variations and hybrid approaches that have to deal with
special cases involving multi-user history, which is relevant to
operational transformation applications such as Google Docs.
7 I'm going to attempt to explain some of the characteristics,
advantages, and disadvantages of the 5 different ways of
managing

KEBERE GOSHU
ADVANTAGE OF
DATA STRUCTURE
 Given below are important advantages of data structure:
 Data structure helps in efficient storage of data in the storage
device.
 Data structure usage provides convenience while retrieving the
data from storage device.
 Data structure provides effective and efficient processing of small
as well as large amount of data.
 Usage of proper data structure, can help programmer save lots of
time or processing time while operations such as storage,
retrieval or processing of data.
 Manipulation of large amount of data can be carried out easily
with the use of good data structure approach.
 Most of the well organized data structures like Array, stack,
queues, graph, tree, linked list has well built and pre-planned
approach for operations like storage, addition, retrieval,
manipulation, deletion, etc. While using them, programmer can be
completely rely on these data structures.
 Data structure usage can simply encourage reusability in long run
as well.
 Data structure like array, linked list, tree, graph, stack, etc. are
well tested and proven one so any one can easily use them
directly without need to research and development on them. If
you decide to create your own data structure that may need some
research work but then it would definitely be to solve something
more complex than what these can provide. Isn't it?
  

KEBERE GOSHU
DISADVATAGE OF
DATA STRUCTURE
 Given below are important disadvantages of data structure:
 An application using data structure requires highly qualified
professional resource to manage the operations related to data
structure. For example, consider the array example that we explained
above. If we need to get the elements of the above array in
ascending or descending order then we must know sorting technique
algorithms like insertion sort, bubble sort, etc. Or a good coder will
also be able to design their own sorting algorithm. Similarly there
may be other complex operations to be performed which may require
dedicated professional.
 Bigger the application or data structure involved in creating and
maintaining application more is the requirement of man power. This
can increase maintaining data structure costs. For example, we have
several data structure available like array, queue, stack, linked list,
tree, graph, etc. Bigger the application is more the amount of such
data structures will be involved. Thus you may need several
professional to create and maintain the application.
 Designing your own data structure may involve complex algorithm
and may require lot of time and testing to conclude they are full-proof
and ready to use for organization purpose. This again will come with
increase cost. And after development is complete it may be found
that the new data structure designed is not that effective as was
expected.
 However these disadvantages can be ignored because of the whole
bunch of advantages data structures offer can easily compensate the
disadvantages. Or it can also happen that with research and
development these issues may be eleminated.
  

KEBERE GOSHU
EXAMPLE OF DATA
STRUCTURE
 There are numerous types of data structures, generally built upon simpler 
primitive data types:[10]
 An array is a number of elements in a specific order, typically all of the same type
(depending on the language, individual elements may either all be forced to be
the same type, or may be of almost any type). Elements are accessed using an
integer index to specify which element is required. Typical implementations
allocate contiguous memory words for the elements of arrays (but this is not
always a necessity). Arrays may be fixed-length or resizable.
 A linked list (also just called list) is a linear collection of data elements of any type,
called nodes, where each node has itself a value, and points to the next node in
the linked list. The principal advantage of a linked list over an array is that values
can always be efficiently inserted and removed without relocating the rest of the
list. Certain other operations, such as random access to a certain element, are
however slower on lists than on arrays.
 A record (also called tuple or struct) is an aggregate data structure. A record is a
value that contains other values, typically in fixed number and sequence and
typically indexed by names. The elements of records are usually
called fields or members.
 A union is a data structure that specifies which of a number of permitted primitive
types may be stored in its instances, e.g. float or long integer. Contrast with a 
record, which could be defined to contain a float and an integer; whereas in a
union, there is only one value at a time. Enough space is allocated to contain the
widest member datatype.
 A tagged union (also called variant, variant record, discriminated union, or disjoint
union) contains an additional field indicating its current type, for enhanced type
safety.
 An object is a data structure that contains data fields, like a record does, as well
as various methods which operate on the data contents. An object is an in-
memory instance of a class from a taxonomy. In the context of 
object-oriented programming, records are known as plain old data structures to
distinguish them from objects.[11]
 In addition, graphs and binary trees are other commonly used data structures.

KEBERE GOSHU
APPLICATION AREA
OF DATA STRUCTURE
 Data structures are used in
any program or software.
 They are used in
the areas of.
 Compiler Design.
 DBMS.
 Graphics.
 Simulation.
 Numerical Analysis.
 Artificial Intelligence.

KEBERE GOSHU
ALGORITHMS
 DEFINITION ABOUT ALGORITHM;
 An algorithm is a specific procedure for
solving a well-defined computational
 problem. The development and 
analysis of algorithms is fundamental to all
aspects of computer science: 
artificial intelligence, databases, graphics,
networking, operating systems, security, and
so on. Algorithm development is more than
just programming. It requires an
understanding of the alternatives available for
solving a computational problem, including
the hardware, networking, programming
language, and performance constraints that
accompany any particular solution. It also
requires understanding what it means for an
algorithm to be “correct” in the sense that it
fully and efficiently solves the problem at
hand.

KEBERE GOSHU
DEFINITION OF
ALGORITHMS
 An accompanying notion is the design of a
particular data structure that enables an
algorithm to run efficiently. The importance of 
data structures stems from the fact that the 
main memory of a computer (where the data is
stored) is linear, consisting of a sequence of
memory cells that are serially numbered 0, 1,
2,…. Thus, the simplest data structure is
a linear array, in which adjacent elements are
numbered with consecutive integer “indexes”
and an element’s value is accessed by its
unique index. An array can be used, for
example, to store a list of names, and efficient
methods are needed to efficiently search for
and retrieve a particular name from the array.
For example, sorting the list into alphabetical
order permits a so-called binary search
technique to be used, in which the remainder
of the list to be searched at each step is cut in
half.

KEBERE GOSHU
DEFINITION OF
ALGORITHM
 This search technique is similar to
searching a telephone book for a
particular name. Knowing that the book
is in alphabetical order allows one to
turn quickly to a page that is close to the
page containing the desired name.
Many algorithms have been developed
for sorting and searching lists of data
efficiently.
 Although data items are stored
consecutively in memory, they may be
linked together by pointers (essentially,
memory addresses stored with an item
to indicate where the next item or items
in the structure are found) so that the
data can be organized in ways similar to
those in which they will be accessed.

KEBERE GOSHU
HISTORY OF
ALGORITHM
 Nowadays every person uses the word “Algorithm” as a
matter of course, but for the most the exact definition is a
mystery. The intention of this site is to get into the secrets
of this mystery and become acquainted with the culprits of
this nomenclature. The focus is not on the state of the art
implementation of specific algorithms but on interesting
stories and the involved individuals.
 Beside the history of the name we will point out the
methodological aspects of algorithmic work and the
different programming techniques. In our investigation we
will try to summarize and to give an impression of the
historical dimension of algorithms. The Babylonian-Sumer-
Method of extracting a root, one of the first documented
examples of mathematical algorithms, and names like
“Euklid” or “al-Khwarizmi” will not be secrets any more.
 Algorithms have a long history and the word can be traced
back to the 9th century. At this time the Persian scientist,
astronomer and mathematician Abdullah Muhammad bin
Musa al-Khwarizmi, often cited as “The father of Algebra”,
was indirect responsible for the creation of the term
“Algorithm”. In the 12th century one of his books was
translated into Latin, where his name was rendered in Latin
as “Algorithmi”. But this was not the beginning of
algorithms. Be curious about more

KEBERE GOSHU
SOME TYPE OF
ALGORITHM
 Brute Force Algorithm
  
 A brute force algorithm essentially attempts all the chances until an
acceptable result is found. This is the most fundamental and least
complex type of algorithm. Such types of algorithms are moreover
used to locate the ideal or best solution as it checks all the potential
solutions.
  
 Also, it is used for finding an agreeable solution (not the best),
basically stopping when an answer to the issue is found. It is a clear
way to deal with an issue that is the first approach that strikes our
mind after observing the issue.
  
 (Must check: Top Deep Learning Algorithms)
  
 Recursive Algorithm 
  
 This type of algorithm depends on recursion. In recursion, an issue is
comprehended by breaking it into subproblems of a similar kind and
calling itself over and over until the issue is unravelled with the
assistance of a base condition.
  
 It solves the base case legitimately and afterwards recurs with a more
straightforward or simpler input every time. It is used to take care of
the issues which can be broken into less complex or more modest
issues of the same sort.
  

KEBERE GOSHU
ADVANTAGE OF
ALGORITHM
 It is a stepwise representation of solutions to a
given problem, which makes it easy to
understand.
 Every step in an algorithm has its own logical
sequence so it is easy to debug.
 By using an algorithm the problem is broken
down into smaller pieces or steps hence, it is
easier for a programmer to convert it into an
actual program.
 An algorithm acts as a blueprint of a program
and helps during program development.
 An algorithm uses a definite procedure.
 It easy to first develop an algorithm and then
convert it into a flowchart and then into a
computer program.
 It is not dependent on any programming
language, so it is easy to understand for
anyone even without programming knowledge.

KEBERE GOSHU
DISADVANTAGE OG
ALGORITHM
 Algorithms are time-consuming.
 Big tasks are difficult to put in
algorithms.
 Difficult to show branching and
looping in algorithms.
 Understanding complex logic
through algorithms can be very
difficult.
 Thank you for reading this article.
If you have any queries regarding
our article on the advantages and
disadvantages of
the Algorithm then do comment
in the comment section below.

KEBERE GOSHU
EXAMPLE OF
ALGORITHM
 these three examples, will help us build a solid
foundation so we can tackle future algorithm
problems with confidence!
 Algorithm Examples, #1: Binary Search
 Binary search is an essential search algorithm
that takes in a sorted array and returns the
index of the value we are searching for. We do
this with the following steps:
 Find the midpoint of the sorted array.
 Compare the midpoint to the value of interest.
 If the midpoint is larger than the value, perform
binary search on right half of the array.
 If the midpoint is smaller than the value,
perform binary search on left half of the array.
 Repeat these steps until the midpoint value is
equal to the value of interest or we know the
value is not in the array.

KEBERE GOSHU
Algorithm Examples,
#2: Merge Sort

 Merge sort,uses a similar


“divide and conquer”
methodology to efficiently
sort arrays. See the following
steps for how merge sort is
implemented.
 Return if array is only one
element long, because it is
already sorted.
 Divide array into two halves
until it cannot be divided
anymore.

KEBERE GOSHU
Algorithm Examples, #3: Adding and Removing
From a Linked List

 The linked list is a fundamental computer science


data structure, that is most useful for it’s constant
time insertion and deletion. By using nodes and
pointers, we can perform some processes much
more efficiently than if we were to use an array.
See below for a schematic:
 A linked list is made up of nodes which each have
a piece of data and a pointer to the next node. We
represent this in Ruby by creating a struct, Node,
with two arguments, :data and :next_node. Now,
we just have to define two
methods, insert_node and delete_node that take
in a head node and a location of where to
insert/delete. The insert_node method has an
additional argument, node, which is the node
struct we want to insert. We then loop until we find
the location we would like to insert into or delete
from. When we arrive at our desired location, and
rearrange the pointers to reflect our
insertion/deletion.

KEBERE GOSHU
Conclusion

 Data structures and their associated


algorithms are fundamental even today
in providing the means for data storage
and manipulation (Sage 2006). Core
and complex computer processing
involving memory management
functions for operating systems, the
database management systems cache
implementation rely on data structures
and their associated algorithms to
execute efficiently and effectively. It is
therefore becomes necessary that an
adequate study of these data structures
and algorithms is carefully studied and
understood by system programmers to
ensure the design of efficient and
effective software.

KEBERE GOSHU
REFERENCE
  Cormen, Thomas H.; Leiserson, Charles E.; Rivest,
Ronald L.; Stein, Clifford (2009). 
Introduction to Algorithms, Third Edition (3rd ed.). The MIT
Press. ISBN 978-0262033848.
 ^ Black, Paul E. (15 December 2004). "data structure". In
Pieterse, Vreda; Black, Paul E. (eds.). Dictionary of
Algorithms and Data Structures [online]. 
National Institute of Standards and Technology.
Retrieved 2018-11-06.
 ^ "Data structure". Encyclopaedia Britannica. 17 April
2017. Retrieved 2018-11-06.
 ^ Wegner, Peter; Reilly, Edwin D. (2003-08-29). 
Encyclopedia of Computer Science. Chichester, UK: John
Wiley and Sons. pp. 507–512. ISBN 978-0470864128.
 ^ "Abstract Data Types". Virginia Tech - CS3 Data
Structures & Algorithms.
 ^ Gavin Powell (2006). 
"Chapter 8: Building Fast-Performing Database Models"
. Beginning Database Design. Wrox Publishing. ISBN 
978-0-7645-7490-0.
 ^ "1.5 Applications of a Hash Table". University of Regina
- CS210 Lab: Hash T
  

KEBERE GOSHU
 THE END

KEBERE GOSHU

You might also like