CSD

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following data structure is non-linear type?

(Strings, Lists, Stacks)= False.

Which of the following data structure is linear type?

(Strings, Lists, Stacks)= True.

What is the correct definition of a hash table?

...used for storing items or their addresses... i = h(x) in the table.

6, 4, 7, 3, 5, 2 What is the balance factor of the node 4?(please note that the tree is still AVL)

0

How many stack will be needed for the evaluation of a prefix expression

0

The complexity of heap sort is

0(nlog n)

The complexity of Bubble sort algorithm is

O(n2)

To evaluate an expression without any embedded function calls:

One stack is enough.

Which data structure allows deleting data elements from front and inserting at rear?

Queues

Which of the following sorting algorithm is of divide-and-conquer type?

Quick sort

Which of the following data structure store the non-homogeneous data elements?

Records

An algorithm that calls itself directly or indirectly is known as

Recursion

Specify the reason for data compression (select the best answer):

Saving data storage

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)

True

Object dequeue() {if (isEmpty()) return(null); return(pool.remove(0));}

True

void inOrder(Node p){ if(p != null){ inOrder(p.left); visit(p); inOrder(p.right);} }

True

void push(Integer x){ Node p = new Node(x); p.next = head; head=p; }

True

In a Heap tree

Values in a node is greater than every value in children of it

When new data are to be inserted into a data structure, but there is no available space; this situation is usually called

overflow

What is the breadth-first traversal of a tree below after deleting the node 5 by merging?

2.1.4. 3. 7. 6. 8

Suppose the f(n) function is defined on the set of integer numbers as below. What is the value of f(-5)?

3

What is the breadth-first traversal of a tree below after deleting the node 15 by merging?

30 5 40 10 35 25 20

Consider the AVL tree below. What is the breadth first traversal of the tree after inserting a node with value 24?

35, 22, 39, 12, 32, 37, 27, 24,

Suppose T is a binary tree with 14 nodes. What is the minimum possible height of T?

4

Given a raw message 'FFFF0000FFF00FFFFF00' (without single quote). Run the run-length encoding algorithm for that message, what is the output?

4F403F205F20

What is the breadth-first traversal of a tree below after deleting the node 2 by copying?

5 1 7 4 6 8 3

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

Suppose a singly linked list of integers is given below: (head)7 10 6 4 2 13 8 3(tail)

7 10 6 4 2 13 8 5 3

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 11 6 4 3 12 8 5 2

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 13 9 8 21

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

7 4 8 1 6 9 3

(1) Put the vertex X to H (2) Check if H is a Hamilton cycle the stop, else go to (3) (3) Consider the last vertex Y in H, if there is/are vertex(es) adjacent to Y, select the first adjacent vertex Z (by alphabet order) and put it to H. if there no adjacent vertex, remove Y from H and denote it as bad selection (so you do not select it in the same way again). Go to (2)

A, B, C, E, D, A

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

AA

Using the Huffman code tree below. What is the result of decoding the string: 1100000001100 ?

AABBBCAB

The post order traversal of a binary tree is DEBFC. Find out the pre order traversal

ABDECF

Which of the following data structure can't store the non-homogeneous data elements?

Arrays

ch = top element of the stack S if ch is isolated then remove it from the stack and put it to E else select the first vetex Y (by alphabet order). which is adjacent to ch.push Y to S and remove the edge (ch.Y) from the graph

B, D, C, B, A, B

The in order traversal of tree will yield a sorted listing of elements of tree in

Binary search trees

Select the most correct statement about the complexity of selection sort

Both best and worst cases are 0(n^2)

A data structure where elements can be added or removed at either end but not in the middle

Deque

The depth of a complete binary tree is given by

Dn = log2n + 1

A binary tree whose every node has either zero or two children is called

Extended binary tree

The Order followed by stack data structure is

FIFO

Which of the following name does not relate to stacks?

FIFO lists

pointers store the next data element of a list

False

Specify the correct statement about chaining method for handling collision

In chaining ... keys or references to keys.

Which of the following is true about linked list implementation of stack?

In push operation = False.

Identify the data structure which allows deletions at both ends of the list but insertion at only one end.

Input-restricted deque

Which of the following applications may use a stack?

Keeping track & A parentheses & Syntax analyzer for a compiler.

The memory address of fifth element of an array can be calculated by the formula

LOC(Array[5]=Base(Array)+w(5-lower bound), where w is the number of words per memory cell for the array

Which one of the following is an application of Stack Data Structure?

Managing function calls, The stock span problem, Arithmetic expression evaluation.

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.

Most Correct

The complexity of Binary search algorithm is

O(log n)

The complexity of merge sort algorithm is

O(n log 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:

O(n)

The complexity of linear search algorithm is

O(n)

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

The best case is 0(n). and the worst case is 0(n^2)

Consider the binary tree below. Which statement is correct?

The tree is full but not complete.

Consider the binary tree below. Which statement is correct? (full binary tree = proper binary tree = 2-tree)

The tree is neither complete nor full.

Which of the following is not the required condition for binary search algorithm?

There must be mechanism to delete and/or insert elements in list

What is written to the screen for the input "HowAre**YouTo***Day" ?

ToDay

The operation of processing each element in the list is known as

Traversal

To represent hierarchical relationship between elements, which data structure is suitable?

Tree

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

Integer pop(){ if(isEmpty) return(null); return((Integer)pool.remove(pool.size()-1)); }

True

void enqueue(Object x){Node p = new Node(x); p.next = null; if(isEmpty()) head = tail = p; else {tail.next = p; tail = p;}}

True

When converting binary tree into extended binary tree, all the original nodes in binary tree are

internal nodes on extended tree

What is written to the screen for the input "FileComp****ress*ion**" ?

iserCeliF

Node f = head; while(f.next !=p) f = f.next; f.next = p.next;

it deletes the node p.

Which of the following data structures are indexed structures?

linear arrays

Multi-programming.

may use a queue

The operation for removing and returning the top element of the stack is traditionally called:

pop

void preOrder(Node p){ if(p = null) { visit(p); preOrder(p.left); preOrder(p.right); } }

pre-order traverse algorithm

What is written to the screen for the input "Go**odMorn**in***gSir"?

riSgMdo

A graph that has neither self-loops nor parallel edges are called____

simple graph

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.

singly linked list

Binary search algorithm cannot be applied to

sorted binary trees

The term "push" and "pop" is related to the

stacks

Two dimensional arrays are also called

tables arrays && matrix arrays

When representing any algebraic expression E which uses only binary operations in a 2-tree,

the variable in E will appear as external nodes and operations in internal nodes

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

thread

If the two stacks are implemented on a single array, the overflow occurs at

top1=top2 && top1=top2-1

The situation when in a linked list START=NULL is

underflow

A binary tree can easily be converted into q 2-tree

by replacing each ... new external node

What is written to the screen for the input "Go**od**Mor*ni*ng*Sir"?

oGdorig

A connected graph T without any cycles is called

a tree graph & free tree & a tree

The memory address of the first element of an array is called

base address

Which of the following is not a limitation of binary search algorithm?

binary search algorithm is not efficient when the data elements are more than 1000.

If every node u in G is adjacent to every other node v in G, A graph is said to be

complete

In a graph if e=(u, v) means

e begins at u and ends at v & u is processor and v is successor

Each data item in a record may be a group item composed of sub-items; those items which are indecomposable are called

elementary items & atoms & scalars

In a graph if e=[u, v], Then u and v are called

endpoints of e & adjacent nodes & neighbors

which call will result in the most recursive calls ?

fun(-1025)

Which of the following is two way list?

grounded header list;circular header list;linked list..nodes=False

What values of n are directly handled by the stopping (base) case?

n==0&& n<35


Ensembles d'études connexes

Electoral College and Gerrymandering

View Set

Chapter 28 Scrotal Mass and Scrotal Pain (DMS120)

View Set

Alternative ATI practice questions

View Set

Law of Contracts - Missed Questions

View Set

Introduction to Flow Cytometry: Blood Cell Identification Exam

View Set