0% found this document useful (0 votes)
10 views2 pages

Datastruct Note#1

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

Datastruct Note#1

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

DATASTRUCT NOTE#1  The factor a programmer can control

DEFINITIONS
 Data – means value or set of values.
 Data item – a single unit of value.
o A collection of data may be organized
into fields, records, or file.
 Entity – is something that has attributes
or properties which maybe grouped
together to form an entity set.
 Field – a single elementary unit of
information representing an attribute of
an entity.
 Record – the collection of field values of
a given entity.
 File – a collection of records of the
entities in a given entity set.
o Primary key – a value in a certain
field which may uniquely determine
the record in the file.

DATA STRUCTURE
– is a logical or mathematical model of a
particular organization of data.
– It is a collection of related data and set of
values for organizing and accessing it.
– Note!!
o The choice of a particular data
model depends on the following:
1. It must be rich in structure to
mirror the actual relationships
of the data in the real world
2. It must be enough that one can
effectively process the data
when necessary.

ALGORITHM
– Is a procedure in terms of the action to
be executed and the order in which these
actions are to be executed.
– According to Niklaus Wirth,
DATA STRUCTURE + ALGORITHMS =
PROGRAM

COMPLEXITY OF ALGORITHMS
1. Time complexity – the no. of steps
executed by an algorithm.
2. Memory complexity – the amount of
memory needed in the execution of an
algorithm.

FACTORS AFFECTING THE RUNNING


TIME OF A PROGRAM:
1. The input of the program.
2. The quality of code generated by the
compiler to create the object code.
3. The nature and speed of the
instructions on the machine used to
execute the program.
4. The time complexity of the algorithm
underlying the program.
BASIC DATA STRUCTURE 3. Insertion
OPERTATIONS: 4. Deletion

1. Traversal – accessing each element Searching – the process that examines a


exactly once. list to locate one or more elements
2. Search – find the location of an element containing a designated value known as a
in the list. search argument.
3. Insert – add a new element to the  The key value being looked for in a
structure. search.
4. Delete – remove an element from the
structure.
5. Sort – arrange the elements logically. TWO BASIC SEARCHING METHODS
6. Merging – combine the elements from FOR ARRAYS:
different structures into a single 1. Sequential Search
structure. 2. Binary Search
7. Update – visit and apply changes to the - A search algorithm in which the
structure. search value is located by
repeatedly dividing the list in
TYPES OF DATA STRUCTURES: half. This requires an
1. Arrays – group of contiguous memory ordered/sorted list.
locations that all have the same name (insert example)
and the same type. Its elements are
stored consecutively.
2. Linked list – a linear collection of
homogeneous data elements which are
not necessarily stored consecutively.
 Nodes – the elements of a linked
list. Each NODE has 2 parts:
1. INFO part
2. Linkfield / nextfield pointer –
contains the address of its next
element.
 There is also a special value
Start/Head that contains the
address of the 1st element of the list.
(write down katong gisuwat ni miss)

3. Stack – a linear collection of


homogeneous elements wherein an
element maybe added or removed from
only one end called TOP. Also called a
LIFO structure.
 PUSH – to insert.
 POP – to delete.
4. Queue – a linear structure in which
insertion and deletion are done at
different ends of the list. This is called a
FIFO structure.
5. Tree – a nonlinear structure which
consists of a finite set of elements called
nodes. If the tree is nonempty, it has a
root but every other node can be
reached from it by following a unique
sequence of connective arcs.
6. Graph – consists of a set of nodes
(vertices) and a set of arcs (edges).
Each arc in a graph is specified by a pair
of nodes.

4 Operations associated with linear lists:


1. Traversal
2. Retrieval

You might also like