Sunteți pe pagina 1din 4

Bonventure Odhiambo

BSC YEAR II, SEMESTER I


DATA STRUCTURE AND ALGORITHM

ASSIGNMENT
The first step in OOP is to define the objects you want to
manipulate and how they relate to each other called data
modeling
The next step is to define the data and logic associated by each
object, each distinct logic is known as a method
Object's interface consists of commands, each command
performing specific tasks. Objects communicate with each other
through defined interfaces called messages
The requesting(sending object) is referred to as the sender and
the receiving object is referred to as the receiver
Method; how do receiving objects interpret messages from the
senders? Each message has a code associated with it. When a
receiving object receives a message, code is executed. The code
that is associated with each message is called a method
Simula - the first oop language. others include;
Java;Python,C++,VB.Net;Ruby;Delphi
Program is a list of instructions that when executed causes the
computer to behave in a predetermined manner
The three main characteristics of OOP are encapsulation,
inheritance, and polymorphism.
Data structure
This is a particular way of storing and organizing data in a
computer so that it can be used efficiently.
Data structures are used in almost every program or software
system. Different data structures are suited for different kinds of
applications.

B-trees are well suited for implementation of databases


Hash tables are used to look up identifiers in compiler
implementations

Any data structure which organizes the data elements one after
the other is a linear data structure
Examples of linear data structures include;
List; ordered list keep items in a specific order such as
alphabetical or numerical. Whenever an item is added to the list,
it is placed in the correct sorted position so that the entire list is
always sorted.
Stacks; this emulates a "last-in-first-out" or lifo. Entry is only
allowed from one end.(operations restricted to one end). The last
item to enter the stack is the first to leave the stack; involves
push and pop. (pushing means adding an item to the stack while
pop means removes an item from the stack)
Queues; this data structure allows items to be added at one end
of the list and removed at the other end.
Non-linear data structures
Examples; tree, multidimensional arrays, graphs
Tree;

Node is a simple structure that holds data and links to other


nodes
Leaves/leaf nodes; these are nodes that are at the end of the
branch and don't link to any other node
Arcs/edges; nodes are what connect one node to another
Parent/child relationship in nodes
Parent node; nodes that have at least one edge to a node lower
in the tree, the lower node in the tree is called child node. Nodes
can have more than one child but children can have only single
parent. The root node has no parent, and the leaf nodes have no
children.
Subtree;
Arrays; in this data structure data are represented in terms of
columns and rows
Graphs; This data structure emulates the tree except that it has
now well defined parent/child relationship between the nodes. In
tree data structure, we have parent node which has one or more
child(ren) nodes. Any node can be connected with any other
node. Nodes are called neighbours if they are connected.

Data types
Primitive
Composite
Abstract

Composite; composite data types are data types which can be


constructed in a program using its programming language's
primitive data types

S-ar putea să vă placă și