CSD201
P contains the address of an element in DATA.
A variable P is called pointer if
Recursion
An algorithm that calls itself directly or indirectly is known as
elementary items & atoms & scalars
Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called
for relatively permanent collections of data.
Linked lists are best suited
may use a queue
Multi-programming.
it deletes the node p.
Node f = head; while(f.next !=p) f = f.next; f.next = p.next;
True
Object dequeue() {if (isEmpty()) return(null); return(pool.remove(0));}
True
Integer pop(){ if(isEmpty) return(null); return((Integer)pool.remove(pool.size()-1)); }
O(log n)
The complexity of Binary search algorithm is
O(n2)
The complexity of Bubble sort algorithm is
0(nlog n)
The complexity of heap sort is
O(n)
The complexity of linear search algorithm is
O(n log n)
The complexity of merge sort algorithm is
Dn = log2n + 1
The depth of a complete binary tree is given by
Binary search trees
The in order traversal of tree will yield a sorted listing of elements of tree in
LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array
The memory address of fifth element of an array can be calculated by the formula
base address
The memory address of the first element of an array is called
pop
The operation for removing and returning the top element of the stack is traditionally called:
Traversal
The operation of processing each element in the list is known as
ABDECF
The post order traversal of a binary tree is DEBFC. Find out the pre order traversal
underflow
The situation when in a linked list START=NULL is
Auxiliary data structure for algorithms.
Which of the following applications may use a stack?
Keeping track & A parentheses & Syntax analyzer for a compiler.
Which of the following applications may use a stack?
Arrays
Which of the following data structure can't store the non-homogeneous data elements?
(Strings, Lists, Stacks)= True.
Which of the following data structure is linear type?
(Strings, Lists, Stacks)= False.
Which of the following data structure is non-linear type?
Records
Which of the following data structure store the non-homogeneous data elements?
linear arrays
Which of the following data structures are indexed structures?
binary search algorithm is not efficient when the data elements are more than 1000.
Which of the following is not a limitation of binary search algorithm?
There must be mechanism to delete and/or insert elements in list
Which of the following is not the required condition for binary search algorithm?
In push operation = False.
Which of the following is true about linked list implementation of stack?
grounded header list;circular header list;linked list..nodes=False
Which of the following is two way list?
FIFO lists
Which of the following name does not relate to stacks?
False
pointers store the next data element of a list
30 5 40 10 35 25 20
What is the breadth-first traversal of a tree below after deleting the node 15 by merging?
5 1 7 4 6 8 3
What is the breadth-first traversal of a tree below after deleting the node 2 by copying?
2.1.4. 3. 7. 6. 8
What is the breadth-first traversal of a tree below after deleting the node 5 by merging?
...used for storing items or their addresses... i = h(x) in the table.
What is the correct definition of a hash table?
7
What is the minimum number of nodes in a full binary tree with height 3? find a tree the height of root is 1. and in a full binary tree every node other than tle leaves has two children).
7
What is the minimum number of nodes in a nearly complete binary tree with heigh 4?
7 4 8 1 6 9 3
What is the result of the breadth first traverse of the binary search tree T, after inserting the following keys into the tree sequentially(suppose T is empty before insertion): 7, 8, 4, 1, 3, 6, 9
True
void enqueue(Object x){Node p = new Node(x); p.next = null; if(isEmpty()) head = tail = p; else {tail.next = p; tail = p;}}
pre-order traverse algorithm
void preOrder(Node p){ if(p = null) { visit(p); preOrder(p.left); preOrder(p.right); } }
True
void push(Integer x){ Node p = new Node(x); p.next = head; head=p; }
fun(-1025)
which call will result in the most recursive calls ?
0
6, 4, 7, 3, 5, 2 What is the balance factor of the node 4?(please note that the tree is still AVL)
by replacing each ... new external node
A binary tree can easily be converted into q 2-tree
Extended binary tree
A binary tree whose every node has either zero or two children is called
a tree graph & free tree & a tree
A connected graph T without any cycles is called
Deque
A data structure where elements can be added or removed at either end but not in the middle
Most Correct
A recursive method is a method that invokes itself directly or indirectly. For a recursive method to terminate there must be one or more base cases.
sorted binary trees
Binary search algorithm cannot be applied to
35, 22, 39, 12, 32, 37, 27, 24,
Consider the AVL tree below. What is the breadth first traversal of the tree after inserting a node with value 24?
The tree is full but not complete.
Consider the binary tree below. Which statement is correct?
The tree is neither complete nor full.
Consider the binary tree below. Which statement is correct? (full binary tree = proper binary tree = 2-tree)
singly linked list
Fill in the blank of the statement to form the most correct one: In a every element contains some data and a link to the next element which allows to keep the structure.
4F403F205F20
Given a raw message 'FFFF0000FFF00FFFFF00' (without single quote). Run the run-length encoding algorithm for that message, what is the output?
O(n)
Given a search() method in a binary search tree: Node search(int x) { Node p = root; while(p!=null && p.info != x){if(p<p.info) p = p.left; else p=p.right;} return(p);} The complexity of this algorithm is:
0
How many stack will be needed for the evaluation of a prefix expression
Input-restricted deque
Identify the data structure which allows deletions at both ends of the list but insertion at only one end.
complete
If every node u in G is adjacent to every other node v in G, A graph is said to be
top1=top2 && top1=top2-1
If the two stacks are implemented on a single array, the overflow occurs at
Values in a node is greater than every value in children of it
In a Heap tree
thread
In a binary tree, certain null entries are replaced by special pointers which point to nodes higher in the tree for efficiency. These special pointers are called
e begins at u and ends at v & u is processor and v is successor
In a graph if e=(u, v) means
endpoints of e & adjacent nodes & neighbors
In a graph if e=[u, v], Then u and v are called
True
In a linked list, the tail node is introduced for performance purpose only.
True
In a singly-linked list every element contains some data and a link to the next element, which allows to keep the structure
True
In a singly-linked list there is no efficient way to insert a node before a given node in the middle of the list (the action is considered efficient if it's complexity is 0(1)).
True
In a singly-linked list we can insert a node after a given node with time complexity 0(1)
True
In a singly-linked list, there is no efficient way to insert a node before a given node in the middle or at the end of the list, but we can insert a node after a given node or at the beginning of the list with time complexity O(1)
The best case is 0(n). and the worst case is 0(n~2)
Select the most correct statement about the complexity of bubble sort *
The best case is 0(n). and the worst case is 0(n~2)
Select the most correct statement about the complexity of insertion sort
Both best and worst cases are 0(n^2)
Select the most correct statement about the complexity of selection sort
In chaining ... keys or references to keys.
Specify the correct statement about chaining method for handling collision
Saving data storage
Specify the reason for data compression (select the best answer):
4
Suppose T is a binary tree with 14 nodes. What is the minimum possible height of T?
7 11 6 4 3 13 9 8 21
Suppose a singly linked list of integers is given below and p is a reference to the node with value 9 in the list (i.e. p.info=9): (head) 7 11 6 4 3 9 8 21 (tail)
7 11 6 4 3 12 8 5 2
Suppose a singly linked list of integers is given below. (head) 7 11 6 4 3 12 8 2 (tail) What does the list look like after the following java code snippet is run?
7 10 6 4 2 13 8 5 3
Suppose a singly linked list of integers is given below: (head)7 10 6 4 2 13 8 3(tail)
3
Suppose the f(n) function is defined on the set of integer numbers as below. What is the value of f(-5)?
AA
Suppose you are using the LZW algorithm to encode the message AABCADAB contents of the dictionary at the beginning of encoding are: (1) A (2) B (3) C (4) D What string is denoted by code word (5)7
FIFO
The Order followed by stack data structure is
stacks
The term "push" and "pop" is related to the
One stack is enough.
To evaluate an expression without any embedded function calls:
Tree
To represent hierarchical relationship between elements, which data structure is suitable?
tables arrays && matrix arrays
Two dimensional arrays are also called
AABBBCAB
Using the Huffman code tree below. What is the result of decoding the string: 1100000001100 ?
iserCeliF
What is written to the screen for the input "FileComp****ress*ion**" ?
oGdorig
What is written to the screen for the input "Go**od**Mor*ni*ng*Sir"?
riSgMdo
What is written to the screen for the input "Go**odMorn**in***gSir"?
ToDay
What is written to the screen for the input "HowAre**YouTo***Day" ?
n==0&& n<35
What values of n are directly handled by the stopping (base) case?
internal nodes on extended tree
When converting binary tree into extended binary tree, all the original nodes in binary tree are
overflow
When new data are to be inserted into a data structure, but there is no available space; this situation is usually called
the variable in E will appear as external nodes and operations in internal nodes
When representing any algebraic expression E which uses only binary operations in a 2-tree,
fun(-1012);
Which call will result in the most recursive calls?
Queues
Which data structure allows deleting data elements from front and inserting at rear?
Quick sort
Which of the following sorting algorithm is of divide-and-conquer type?
Managing function calls, The stock span problem, Arithmetic expression evaluation.
Which one of the following is an application of Stack Data Structure?