Data Structure (2marks)
Data Structure (2marks)
UNIT -1
1.Data Structure.
A data structure is a specialized format for organizing and storing data. General
data structure types include the array, the file, the record, the table, the tree, and
so on. Any data structure is designed to organize data to suit a specific purpose
so that it can be accessed and worked with in appropriate ways.
2.Data & Information
Data is a set of values of qualitative or quantitative variables; restated, pieces of
data are individual pieces of information. Data is measured, collected and
reported, and analyzed, whereupon it can be visualized using graphs or images.
Information is that which informs. As it regards data, the information's existence
is not necessarily coupled to an observer while in the case of knowledge, the
information requires a cognitive observer.
3.Problem solving
The term problem-solving is used in many disciplines, sometimes with different
perspectives, and often with different terminologies. For instance, it is a mental
process in psychology and a computerized process in computer science.
Problems can also be classified into two different types (ill-defined and welldefined) from which appropriate solutions are to be made.
4.Problem solving methodology
GROW model
How to Solve It
PDCA (plandocheckact)
A3 Problem Solving
elegance
readability
computational efficiency
space efficiency
correctness
completeness
6.O(n)
linear
8.Time complexity
Time complexity is a function which describes the amount of time an
algorithm takes in terms of the amount of input to the algorithm.
9.Space complexity
Space complexity is a function which describes the amount of memory
(space) an algorithm takes in terms of the amount of input to the
algorithm.
UNIT-2
10.List
A list or sequence is an abstract data type that represents a sequence of
values, where the same value may occur more than once. An instance of a
list is a computer representation of the mathematical concept of a finite
sequence. Lists are a basic example of containers.
11.Primitive operations of list
Implementation of the list data structure may provide some of the following
operations:
referring to the list consisting of all the components of a list except for its
first.
An important advantage of linked lists over arrays is that the linked list
uses exactly as much memory as it needs, and can be made to expand to
fill all available memory locations if needed.
Disadvantages.
Increased overhead for storing pointers for linking the data items.
13.STACK
A stack is a limited access data structure - elements can be added and
removed from the stack only at the top. push adds an item to the top of
the stack, pop removes the item from the top.
Advantages (Pros)
20. Give the condition for queue overflow and queue underflow.
condition for queue overflow is rear+1==front
condition for queue underflow is rear==front
UNIT-3
21.Define binary tree.
A binary tree is a tree in which no nodes can have more than two
children. It can have ATMOST two children.
23.Define AVL.
An AVL (Adelson-Velskii and Landis) tree is a binary search tree with a
balance condition. The balance condition must be easy to maintain, and
it ensures that the depth of the tree is O (log N).
The simplest idea is to require that the left and the right subtree have the
same height.
Preorder, (i) Visit the root, (ii) Traverse the left subtree, and (iii)
Traverse the right subtree.
In order, (i) Traverse the left most subtree starting at the left
external node, (ii) Visit the root, and (iii) Traverse the right
subtree starting at the left external node.
Postorder, (i) Traverse all the left external nodes starting with
the left most subtree which is then followed by bubble-up all
the internal nodes, (ii) Traverse the right subtree starting at the
left external node which is then followed by bubble-up all the
internal nodes, and (iii) Visit the root.
called as hashing.
It is represented as h(x)=a;
here h(x) is a hash function
x is a input value
a is outputted index value.
Hashing is a method used to give the index of the group.
26.What is linear Probing?
Linear probing is a scheme in computer programming for resolving hash
collisions of values of hash functions by sequentially searching the hash table
for a free location.