You are on page 1of 4

RAGHU ENGINEERING COLLEGE

(Department of Computer Science and Engineering)


DATA STRUCTURES UNIT -1
(Prepared by: DVS Ravi Varma,Asst Professor, CSE Dept-April/May-2016)
UNIT -1:
Preliminaries of algorithm, Algorithm analysis and complexity,
Data structure- Definition, types of data structures
Recursion: Definition, Design Methodology and Implementation of recursive algorithms, Linear
and binary recursion, recursive algorithms for factorial function, GCD computation, Fibonacci
sequence, Towers of Hanoi, Tail recursion
List Searches using Linear Search, Binary Search, Fibonacci Search
Sorting Techniques: Basic concepts, Sorting by : insertion (Insertion sort), selection (heap sort),
exchange (bubble sort, quick sort), distribution (radix sort ) and merging (merge sort ) Algorithms.
NOTES
DAY 1
1) what is an algorithm?
Ans. An Algorithm is a step by step instructions to solve a given problem.
2) What is an algorithm efficency?
Ans Algorithmic efficiency are the properties of an algorithm which relate to the amount of
computational resources used by the algorithm.if an algorithm which uses less
computational resourses then it is a efficient algorithm.
3) what are the factors that effcts the efficiency of an algorithm?
Ans. The time and space are the factors which determine the efficiency of the program.
4) what is time complexity?
Ans. The time complexity of an algorithm is the amount of computing time by an algorithm to
run to completion.
5) what is space complexity?
Ans. The space complexity of an algorithm is the amount of computing memory required during
the program execution .

6) What are the properties of an Algorithm?


Ans An algorithm should have the below mentioned properties.
Unambiguity (Definiteness): Each and every step of an algorithm should be clear and
unambiguous. Every step must be very clear, and easily
understandable to the user.
Input / Output: An algorithm must be supplied with different kinds of inputs and should
generate at least one output.
Finiteness: Every algorithm must terminate after a finite number of steps
Effectiveness: An algorithm needs to be effective, which means that steps written in an
algorithm can be easily converted to program code and can be executed in a
finite amount of time.

RAGHU ENGINEERING COLLEGE


(Department of Computer Science and Engineering)
Speed: An algorithm written should be completed with great speed to solve the problem
for any input data.
7) Discuss about the efficency and complexity of an algorithm.
Ans.Efficiency Of Algorithm:Algorithmic efficiency are the properties of an algorithm which
relate to the amount of computational resources used by the algorithm.if an algorithm
which uses less computational resourses then it is a efficient algorithm.
Complexity of an algorithm:
The complexity of an algorithm M is the function f(n) which gives the running time and/or
storage space requirement of the algorithm in terms of the size n of the input data. Mostly,
the storage space required by an algorithm is simply a multiple of the data size n.
Complexity shall refer to the running time of the algorithm.
Best Case, Worst Case and Average Case Analysis:
If an algorithm takes minimum amount of time to run to completion for a specific set of
input, then it is called BEST CASE TIME COMPLEXITY.
For Example: While searching a particular element by using sequential search, if we get
the desired element at first place itself, then it is called BEST CASE TIME COMPLEXITY.
If an algorithm takes maximum amount of time to run to completion for a specific set of
input, then it is called WORST CASE COMPLEXITY.
For example: While searching an element by using linear search method, if desired
element is placed at the end of the list , then we get WORST CASE TIME COMPLEXITY.
If the time complexity that we get for certain set of inputs is an average (i.e., in between
minimum and maximum amount of times), then for corresponding input such a time
complexity is called AVERAGE CASE TIME COMPLEXITY.
Class work:
1)write an algorithm to find the square of a given number.
Home work:
1) Write an algorithm to displatythe multiplication table of a given number up to 10 values.try ro
anlyse the algorithm.
Old JNTU questions
1)What is an algorithm? List out the properties of an algorithm. (june 2015)
2) Differentiate between time complexity and space complexity (june 2015)

RAGHU ENGINEERING COLLEGE


(Department of Computer Science and Engineering)

DAY 2
1) what is a data structure?
Ans. Data Structure: A data structure is a method of organizing the data, maintaining
relationships between data and performing possible operations on the data.
3) What is a primitive data structure?
Ans Primitive Data Structures are the basic data structures that directly operate upon the
machine instructions. They have different representations on different computers. Integers,
floating point numbers, character constants, string constants and pointers come under this
category.
3) What is a Non primitive data structure?
Ans Non-primitive data structures are more complicated data structures and are derived from
primitive data structures. They emphasize on grouping same or different data items with
relationship between each data item. Arrays, lists and files come under this category.

4) Discuss about linear and non linear data structures.


Ans.Non Primitive Data structures are primarily classified into 2 types:
Linear DataStructure
Non-linear DataStructure
A linear data structure is a way of arranging the data in sequential order where as in non
lineaR data structure, there is no sequential arrangement.
Linear Data Structure: Stacks, Queues, Linked Lists, etc.
Non-linear Data Structure: Trees, Graphs, etc
Difference between Linear and Nonlinear Data Structures
Main difference between linear and nonlinear data structures lie in the way they organize
data elements. In linear data structures, data elements are organized sequentially and
therefore they are easy to implement in the computers memory. In nonlinear data structures,
a data element can be attached to several other data elements to represent specific
relationships that exist among them. Non-Linear data structure is that if one element can be
connected to more than two adjacent element then it is known as non-linear data structures.
Block Diagram of Data Structures:

RAGHU ENGINEERING COLLEGE


(Department of Computer Science and Engineering)

Class work:
1)what are the operations of data structures.
Home work:
1) discuss tabout the characterstics of data Structures.
Old JNTU questions
1) List out some examples for linear and non-linear data structures. (june 2015)

You might also like