Data Structures Ecse
Data Structures Ecse
COMPUTER LANGUAGES
To write a program (tells what to do) for a computer, we must use a computer
language.
Over the years computer languages have evolved from machine languages to
natural languages.
1. Low Level Programming Language
a. Machine Language
b. Assembly Language or Symbolic Language
2. High Level Programming Language
The following is the summary of computer languages
1940‘s -- Machine Languages
1950‘s -- Symbolic Languages
1960‘s -- High Level Languages
Machine Language
In the earliest days of computers, the only programming languages available
were machine languages. Each computer has its own machine language which is
made of streams of 0’s and 1’s. The instructions in machine language must be in
streams of 0’s and 1’s. This is also referred as binary digits. These are so named as
the machine can directly understood the programs
Advantages:
1) High speed execution
2) The computer can understood instructions immediately
3) No translation is needed.
Disadvantages:
1) Machine dependent
2) Programming is very difficult
3) Difficult to understand
4) Difficult to write bug free programs
5) Difficult to isolate an error
Example: Additon of two numbers
20010
+30011
50101
High-Level Languages
The symbolic languages greatly improved programming efficiency they still
required programmers to concentrate on the hardware that they were using working
withsymbolic languages was also very tedious because each machine instruction had
to beindividually coded. The desire to improve programmer efficiency and to change
the focus fromthe computer to the problems being solved led to the development of
high-level languages.
High-level languages are portable to many different computer allowing the
programmerto concentrate on the application problem at hand rather than the
intricacies of the computer.
Advantages:
1) Easy to write and understand
2) Easy to isolate an error
3) Machine independent language
4) Easy to maintain
5) Better readability
6) Low Development cost
7) Easier to document
8) Portable
Disadvantages:
1) Needs translator
2) Requires high execution time
3) Poor control on hardware
4) Less efficient
Difference between Machine, Assembly, High Level Languages
Language Translators
These are the programs which are used for converting the programs in one
language intomachine language instructions, so that they can be executed by the
computer.
1. Compiler: It is a program which is used to convert the high level language
programs into machine language
2. Assembler: It is a program which is used to convert the assembly level
language programs into machine language
3. Interpreter: It is a program, it takes one statement of a high level language
program, translates it into machine language instruction and then
immediately executes the resulting machine language instruction
and so on.
Comparison between a Compiler and Interpreter
Markup Languages:
A markup language is a computer language for clarifying the contents of a
document. It was designed to process, define, and present computer text in a form
that humans can read. It specifies the code used to format text, including the style and
layout the programmer wants the document to appear. It uses tags to define these
elements.
Some of the most commonly used markup languages are:
1. HyperText Markup Language(HTML): It is perhaps the most widely used
markup language today. It is mainly used to develop the web pages we see on
the World Wide Web. Essentially, every web page can be written using a
version of HTML. That makes the code critical in ensuring that the text and
images on a website follow proper formatting. Without it, browsers would have
no clue how the content should be displayed. HTML is also responsible for
giving web pages their basic structure. It is often used with Cascading
Style Sheets (CSS) to improve page appearance.
2. eXtensible Markup Language (XML): It is highly similar to HTML. It allows
browsers to display and interpret information correctly. But as its name implies,
XML is extensible. It permits a tag to define itself based on a given description
of the content rather than just display it.
Scripting Languages
Scripting languages are usually interpreted rather than compiled and are
often used for automating tasks, controlling software applications, and writing small
programs to automate repetitive tasks. They tend to be easier to learn and use
compared to traditional programming languages.
Advantages:
It is simple to switch between operating systems.
Scripting language enhances the visual appeal of online sites.
It is easy to learn and write in comparison with other languages.
Scripts can be used as a software prototype, saving time on test projects.
It assists in the insertion of visualisation interfaces and combinations into web
pages.
Scripting languages are highly demanded for modern websites.
To build improved websites, captivated visual descriptions such as background
and foreground colours, and so forth are required.
No requirement to compile, although occasionally it is necessary.
Disdvantages:
Some businesses do not want their scripts viewed by everyone, therefore they
employ server-side scripts to prevent revealing them to the public.
Installing an interpretation programme might also be difficult.
Scripts might be slower than programs at times.
Types of statements in algorithm.
The algorithm and flowchart include following three types of control structures.
1. Sequence: In the sequence structure, statements are placed one after the other
and the execution takes place starting from top to down.
Characteristics of Algorithm:
1. Problem Definition
2. Specification of Algorithm
3. Checking the correctness of algorithm
4. Analysis of Algorithm
5. Implementation of algorithm
6. Test the program
In simple terms, data structure definition is- it is a collection of data values and the
relation between them, along with the functions or operations that can be applied to
the data.
Linear Data Structure
In a linear data structure, data elements follow a sequential order, where each element
possesses a distinct predecessor and successor. This structure operates on a single
level, facilitating the traversal of all elements in a singular pass. Implementing linear
data structures is comparatively uncomplicated due to the linear arrangement of
computer memory. Instances of linear data structures encompass arrays, stacks,
queues, and linked lists.
Non-linear data structures are typically more difficult to implement than linear data
structures, but they can be more efficient in terms of memory usage. Examples of non-
linear data structures include trees, graphs, and heaps.
Array:
An array is a data structure that contains a group of elements. Typically these elements
are all of the same data type, such as an integer or string. Arrays are commonly used
in computer programs to organize data so that a related set of values can be easily
sorted or searched.
Each element in an array has a number attached to it, called a numeric index, that
allows you to access it. Arrays start at index zero and can be manipulated with various
methods
Linked List:
Linked lists are linear collections of data very much like an array, but instead of the data
being arranged in one continuous block, each piece of data is linked to the next one in
the chain using pointers coupled with the data.
1. Singly Linked List: A Singly Linked List is the most common type of Linked
List. Each node has data and a pointer field containing an address to the next
node.
2. Doubly Linked List: A Doubly Linked List consists of an information field and
two pointer fields. The information field contains the data. The first pointer field
contains an address of the previous node, whereas another pointer field
contains a reference to the next node. Thus, we can go in both directions
(backward as well as forward).
3. Circular Linked List: The Circular Linked List is similar to the Singly Linked
List. The only key difference is that the last node contains the address of the
first node, forming a circular loop in the Circular Linked List.
Stack:
A stack is also another type of data structure, which help organize data in a particular
order. A stack is a LIFO (Last in First Out) data structure. It is a simple data structure
that allows adding and removing elements in a particular order. Every time an element
is added, it goes on the top of the stack, the only element that can be removed is the
element that was at the top of the stack, just like a pile of objects.
Queue
A queue is a type of data structure, which help organize data in a particular order. A
queue is a FIFO(First in First Out) data structure, which means that the element
inserted first will also be removed first.
Tree
A tree is a data structure that is made up of a set of linked nodes, that can be used to
represent a hierarchical relationship among data elements. In other words how it is
connected by a series of references and has a root node.
1. Binary Tree: A Tree data structure where each parent node can have at most
two children is termed a Binary Tree.
2. Binary Search Tree: A Binary Search Tree is a Tree data structure where we
can easily maintain a sorted list of numbers.
3. AVL Tree: An AVL Tree is a self-balancing Binary Search Tree where each
node maintains extra information known as a Balance Factor whose value is
either -1, 0, or +1.
4. B-Tree: A B-Tree is a special type of self-balancing Binary Search Tree where
each node consists of multiple keys and can have more than two children.
Graph
A graph is represented as a series of nodes and edges connecting those nodes. All
we need to understand is the relationship between a given node pair, and then we store
the edge connecting them. An edge is typically represented visually as a line and in
words as a pair of nodes.
A hash table (also called a hash map, object or dictionary) is a data structure that pairs
keys to values. A hash table uses a hash function to compute an index into an array of
buckets or slots, from which the desired value can be found. The idea behind a hash
function is to distribute the entries (key/value pairs) across an array of buckets.
1. Create: Create is an operation used to reserve memory for the data elements
of the program. We can perform this operation using a declaration statement.
The creation of data structure can take place either during the following:
1. Compile-time
2. Run-time
For example, the malloc() function is used in C Language to create data
structure.
2. Insertion: Insertion means inserting or adding new data elements to the
collection. For example, we can use the insertion operation to add the details
of a new employee the company has recently hired.
3. Deletion: Deletion means to remove or delete a specific data element from the
given list of data elements. For example, we can use the deleting operation to
delete the name of an employee who has left the job.
4. Traversal: Traversing a data structure means accessing each data element
exactly once so it can be administered. For example, traversing is required
while printing the names of all the employees in a department.
5. Search: Search is another data structure operation which means to find the
location of one or more data elements that meet certain constraints. Such a
data element may or may not be present in the given set of data elements. For
example, we can use the search operation to find the names of all the
employees who have the experience of more than 5 years.
6. Sorting: Sorting means to arrange the data elements in either Ascending or
Descending order depending on the type of application. For example, we can
use the sorting operation to arrange the names of employees in a department
in alphabetical order or estimate the top three performers of the month by
arranging the performance of the employees in descending order and extracting
the details of the top three.
7. Merge: Merge means to combine data elements of two sorted lists in order to
form a single list of sorted data elements.
8. Selection: Selection means selecting a particular data from the available data.
We can select any particular data by specifying conditions inside the loop.
9. Update: The Update operation allows us to update or modify the data in the
data structure. We can also update any particular data by specifying some
conditions inside the loop, like the Selection operation.
10. Splitting: The Splitting operation allows us to divide data into various subparts
decreasing the overall process completion time.
Software Development
One of the basic notions of the software development process is SDLC models
which stands for Software Development Life Cycle models. There are many
development life cycle models that have been developed in order to achieve
different required objectives. The models specify the various stages of the process
and the order in which they are carried out.
The most used, popular and important SDLC models are given below:
Waterfall model
V model
Incremental model
RAD model
Agile model
Iterative model
Spiral model
Prototype model
Waterfall Model
Agile Model