You are on page 1of 9

2 Marks

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

APS (Applied Problem Solving)

Eight Disciplines Problem Solving

GROW model

How to Solve It

Kepner-Tregoe Problem Solving and Decision Making

OODA loop (observe, orient, decide, and act)

PDCA (plandocheckact)

RPR Problem Diagnosis (rapid problem resolution)

TRIZ (in Russian: Teoriya Resheniya Izobretatelskikh Zadatch, "theory


of solving inventor's problems")

A3 Problem Solving

5.Metrics for algorithm efficiency


In computer science, algorithmic efficiency are the properties of an algorithm
which relate to the amount of computational resources used by the algorithm.
An algorithm must be analysed to determine its resource usage.

elegance

readability

computational efficiency

space efficiency

correctness

completeness

6.O(n)
linear

Finding an item in an unsorted list or a malformed tree (worst case)


or in an unsorted array; Adding two n-bit integers by ripple carry.

7.Trade off btw memory & Computing Space and time.


Space refers to the data storage consumed in performing a given task.
Time refers to that consumed in performing a given task
A space-time or time-memory tradeoff is therefore a case where an algorithm or
program trades increased space for decreased time.

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:

creating an empty list;

testing whether or not a list is empty;

prepending an entity to a list

appending an entity to a list

determining the first component (or the "head") of a list

referring to the list consisting of all the components of a list except for its
first.

12.Advantages of linked list.

It is not necessary to know in advance the number of elements to be


stored in the list and therefore, need not allocate. d as and when
necessary.

In a linked list, insertions and deletions can be handled efficiently without


fixing the size of the memory in advance.

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.

The traversal is sequential.

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.

14.Basic Operations Performed on Stack.


1. Create
2. Push
3. Pop
4. Empty
5.

Advantages (Pros)

15.Advantages & Disadvantages


* Easy to get started
* Low Hardware Requirement
* Cross- Platform
* Anyone with access can edit the program
Disadvantages (Cons)
* Inflexible
* Lack of scalability
* Unable to Copy & Paste
16.QUEUE
The queue abstract data type is defined by the following structure and
operations. A queue is structured, as described above, as an ordered collection
of items which are added at one end, called the rear, and removed from the
other end, called the front. Queues maintain a FIFO ordering property.
17. What are the Primitive Operations of queue?
enqueue(): Put object o on the end of the queue.
dequeue():Remove and return the object at the front of the queue.
head ()Reveal the front object in the queue, but do not remove it.
size (): Return the number of objects currently in the queue.
capacity (): Return the maximum number of objects the queue can
hold.

18.List the advantages and disadvantages of queue.

* adding or removing elements can be done quickly and efficiently.


*disadvantages is that a queue is not readily searchable and adding or
removing elements from the middle of the queue is very complex.

19.Give the condition for stack overflow and stack underflow.


The condition in which stack is empty is denoted by top=-1 is known as
stack underflow.
The condition in which the stack is full is denoted by top=N-1, where N
is the size of the stack, is known as stack overflow.

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.

22.Define binary search tree.


A binary search tree is a rooted binary tree,
whose internal nodes each store a key (and optionally, an associated
value) and each have two distinguished sub-trees, commonly denoted
left and right.

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.

24.Explain in order, preorder, post order traversal.


Traversal is processing of nodes in a tree.

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.

Therefore, the Preorder traversal of the above tree will output:


7, 1, 0, 3, 2, 5, 4, 6, 9, 8, 10.
The in order traversal of the above tree will outputs:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
The Post order traversal of the above tree will output:
0, 2, 4, 6, 5, 3, 1, 8, 10, 9, 7

25.Define Hashing function.


Hashing is a technique used for performing insertion, deletion and finds
in constant average time. The implementation of hash table is frequently

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.

27. Define Priority Queue.


A priority queue is an abstract data type which is like a regular queue or stack
data structure, but where additionally each element has a "priority" associated
with it. In a priority queue, an element with high priority is served before an
element with low priority.
28.Define Binary heap?
A binary heap is a complete binary tree which satisfies the heap ordering
property.
The ordering can be one of two types: the min-heap property: the value of each
node is greater than or equal to the value of its parent, with the minimum-value
element at the root.
29.Define Siblings nodes

Nodes with the same parent are called siblings.


30.Define leaves.
The elements at the very bottom of an inverted tree (that is, those that
have no elements below them) are called leaves.
31.What is height/level if the tree?
Height of the tree = no. of edges in the longest path from root to a leaf
node. A leaf node is node with zero children.

You might also like