CSD201

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

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

Traversal

Which of the following methods are used to traverse a tree without using anystack or threads:

Traversal through tree Transformation

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

Trees

In shift folding method, the key is usually divided into even, The boundary folding method is applied to number data

True

In the array implementation, enqueuing can be executed in constant time O(1)

True

Polish notation eliminates all parentheses from formu, Using Polish notation, all expressions have to be brok,Expression trees do not use

True

Recursive definitions on most computers are eventually implemented using a run-time stack and this implementation is done by the operating system.

True

Run-length encoding is very efficient for text file in which only blank character has a tendency to be repeated without using any technique

True

Subclasses or derived classes inherit the fields... , An abstract datatype can be part of a program in the form of an interface.

True

The complexity of sequential Coloring algorithm is O(

V|2) ,Sequential Coloring algorithm establishes the sequence of | True about Graph coloring

Which of the following can be executed in constant time O(n)

When deleting a node of a singly linked list in the average case , in the worst case

A _____ node contains some data and one link to its successor and one link to its predecessor in the list.

doubly linked list

Insertion sort is applied to small portions of an array, Mergesort can be made more efficient by replacing

efficient sorting

Arrays are best data structures

for relatively permanent <benvung> collections of data

Linked lists are best suited

for the size of the structure and the data in the structure are constantly changing

I have implemented the queue with a linked list, keeping track of a front node and a rear node with two reference variables. Which of these reference variables will change during an insertion into an EMPTY queue?

front changes., rear changes.

int fun(int n) {if(n<0) return(fun(-n)); else if(n<5) return(2); else return(n*fun(n-2)); } Which call will result in the most recursive calls?

fun(-1012);

In the linked list implementation of the queue class, where does the insert method place the new entry on the linked list?

At the tail

Consider the implementation of the Stack using a partially-filled array. What goes wrong if we try to store the top of the Stack at location [0] and the bottom of the Stack at the last used position of the array?

Both push and pop would require linear time.

____will visit nodes of a tree starting from the highest (or lowest) level and moving down (or up) level by level and at a level, it visits nodes from left to right(or from right to left).

Breath-First Traversal

If data is a circular array of CAPACITY elements, and rear is an index into that array, what is the formula for the index after rear?

(rear + 1) % CAPACITY

To implement an AVL tree, a concept balance factor is introduced (bal = height(right)-height(left). Suppose an AVL tree is created by inserting to the tree the following keys sequentially: 6,4,7,3,5,2 What is the balance factor of the node 4? (please note that the tree is still AVL)

0

void fun(int n) {if(n > 0) { n = n/5; fun(n); System.out.print(" " + n); } } What is the output when the statement fun(23); is run?

0 4

the complexity of countting the number of items in a doubly-linked list

0(n)

the complexity of merge sort is

0(nlog2n)

Explain how you would create an algorithm that matches delimiters on the stack. Include errors in your explanation.

1. Read the characters from a string one at a time.

Given the character frequencies B : 32% C : 28% D : 16% E : 6% F : 18% Using Huffman encoding, what is the code for character D?(Suppose that when constructing a sub tree from 2 nodes we always place node with higher frequency on the left, and the left branch of a node gets value 0, the right one gets value 1)

100

Given the character frequencies B : 32% C : 28% D : 16% E : 6% F : 18% Using Huffman encoding, what is the code for character E?(Suppose that when constructing a sub tree from 2 nodes we always place node with higher frequency on the left, and the left branch of a node gets value 0, the right one gets value 1)

101

27 11 6 4 3 10 8 2

27 11 6 4 3 10 19 8 2

What does the list look like after the following java code snippet is run? intx = 19;

27 11 6 4 3 10 19 8 2

Consider the usual algorithm for determining whether a sequence of parentheses is balanced. What is the maximum number of parentheses that will appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(()))?

3

How many parts are there in a declaration statement?

3

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

3B4Y3B2Y5B2Y

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

4

T is a binary tree with 14 nodes. what is the minimum possiple height of T

4

a binary tree with 14 nodes. the minimum possible height of T

4

suppose T is a binary tree with 14 nodes. what is the minimum possible height of T

4

FFFFOOOOFFFOOFFFFFOO

4F4O3F2O5F2O

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

4F4O3F2O5F2O

What is the minimum number of nodes in a full binary tree with height 4?

7

what is the minimum number of nodes in a full binary tree with height 3

7

7 1 6 4 3 9 8 2

7 1 6 4 3 8 2

7 10 6 4 2 13 8 3

7 10 6 4 2 13 8 5 3

7 11 6 14 3 9 8 12

7 11 6 14 5 3 9 8 12

7 11 6 4 3 15 8 12

7 11 6 4 3 35 15 8 12

what is the value of the Shift Folding Hash Function if K = 43-65-69-7 and Tsize = 100

84

what is the value of the shift folding hash function if K= 43-65-69-7 and Tsize = 100?

84

what is the value of the Boundary Folding Hash Function if K = 43-57-69 and Tsize = 100

87

what is the value of the Boundary Folding Hash Function if K = 45-65-79-8 and Tsize = 100

88

what is the value of the Boundary Folding Hash Function if K = 42-58-67 and Tsize = 100

94

what is the value of the Shift Folding Hash Function if K = 42-58-67 and Tsize = 100

94

what is the value of the Shift Folding Hash Function if K = 45-65-79-8 and Tsize = 100

97

What is a deque?

A double-ended queue. You can insert items and either end & delete items from either end.

How is a priority queue different than a queue?

A priority queue items are ordered by key value so that the item with the lowest key ( or in some implementations the highest key) is always at the front. Items are inserted in the proper position to maintain the order.

Select the statement that is 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

10000010011

ABBCD

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

ABDECF

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

ABDECF

The reason for using pointer is ...

Accessing arrays or string elements

The reason for using pointer is ... Choose the false option from the following sentences

Accessing arrays or string elements

Pushdown list means:

All

A connected graph T without any cycles is called

All of above

The difference between linear array and a record is

All of above

Which of the following data structure is linear type?

All of above

ushdown list means:

All of the above

Which of the following data structure is linear type?

All off string,list,queue

Which of the following is the feature of stack?

All operations are at one end

In an array queue, data is stored in an _____ element.

Array

Which of the following data structure is linear data structure?

Arrays

What of the following applications may use a stack?

Auxiliary data structure for algorithms.

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

B.e begins at u and ends at v C. u is processor and v is successor

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

Binary search trees

The size of a structure can be determined by a. size of variable name b. size of (struct tag)

Both a and b

select the most correct statement about the complexity of heapsort

Both best and worst cases are (nlogn)

Select the most correct statement about the complexity of selection sort

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

Select the most correct statement about the complexity of heapsort

Both best and worst cases are O(nlogn)

Sorting algorithm can be characterized as

Both of the above

The five items: A, B, C, D and E are pushed in a stack,one after the other starting from A. The stack is popped four times and each element is inserted in a queue. Then two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack.

D

The five items: A, B, C, D and E are pushed in a stack,one after the other starting from A. The stack is popped four times and each element is inserted in a queue. Then two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack.The popped item is.

D

If the characters 'D', 'C', 'B', 'A' are placed in a queue (in that order), and then removed one at a time, in what order will they be removed?

DCBA

How can you fix a broken sequence? What is created?

Delete enough items so that the Fron arrow wraps around. This creates a single contiguous sequence.

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

The depth of a complete binary tree is given by

Dn=log2n+1

is rearranging pairs of elements which are out of order, until no such pairs remain.

Exchange

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

Extended binary tree

When inorder traversing a tree resulted E A C K F H D B G; the preorder traversal would return

FAEKCDHGB

_______ form of access is used to add and remove nodes from a queue

FIFO , First In First Out

form of access is used to add and remove nodes from a queue

FIFO , First In First Out

Which of the following name does not relate to stacks?

FIFO lists

Depth-first traversal can not be implemented if ,A recursive implementation of preorder tree trav,There are six possible ordered depth-first traversal

False

In all cases, nonrecursive implementation is faster recursive implementation

False

In the array implementation, dequeuing can be executed in O(n)

False

In the array list, poping is executed in O(lgn) to the worst case

False

pointers store the next data element of a list

False

what is the correct definition of a hash function?

Hash function h(x) transform a particular key x, etc into an index i=h(x) in the table

singly linked list

In a every element contains some data and a link to the next element, which allows to keep the structure

Select the most correct statement:

In a linked list, the tail node is introduced for performance purpose only

What is the difference between a stack and a queue?

In a queue the first item inserted is the first to be removed (FIFO). In a stack the last item inserted is the first to be removed (LIFO)

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

Input-restricted deque

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

Input-restricted deque

is putting an element in the appropriate place in a sorted list yields a larger sorted order list.

Insertion

sorting algorithm is frequently used when n is small where n is total number of elements.

Insertion

How is "peek" different in a queue?

It "peeks" at the value of the item at the front of the queue without removing it as opposed to the last value in a stack.

What is "peek"?

It allows the user to read the value at the top of the stack with out removing it.

Suppose we are considering a singly linked list and p is some node in the list which has both predecessor and successor nodes. What does the java code snippet below do? Node f=head; while(f.next!=p) f=f.next; f.next=p.next;

It deletes the node p

Which graph representation is best?

It depends on the problem

Where does the term queue come from?

It is a British reference to waiting in line. Fist in, first out.

The worst case occur in linear search algorithm when

Item is the last element in the array or item is not there at all

Which of the following applications may use a stack?

Keeping track of previous choices(as in backtracking).

______ form of access is used to add and remove nodes from a stack

LIFO

form of access is used to add and remove nodes from a stack

LIFO

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 array

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

Explain LIFO

Last-In-First-Out. A stack is a LIFO storage mechanism because the last item inserted is the first one to be removed.

Each entry in a linked list is called a

Link

Each entry in a linked list is called a _______

Link

What kind of list is best to answer questions such as "What is the item at position n?"

Lists implemented with an array.

Which of the following expressions evaluates to true with approximate probability equal to P? (P is double and 0 <= P <= 1).

Math.random() < P

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

Merge sort

Whatever you can do to manipulate the data storage structure becomes our:

Methods.

Select the statement that is most correct. Which of the following applications may use a queue?

Multi-programming

which following applications may use a queue?

Multi-programming

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

None of above

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

None of string,list,stack

In the array version of the Stack class, which operations require linear time for their worst-case behavior?

None of these operations require linear time.

In the circular array version of the Queue class, which operations require linear time for their worst-case behavior?

None of these operations require linear time.

In the linked-list version of the Stack class, which operations require linear time for their worst-case behavior?

None of these operations require linear time.

Which of the following case does not exist in complexity theory

Null case

The complexity of merge sort algorithm is

O(n log n)

The complexity of merge sort algorithm is a.

O(n log n)

The complexity of linear search algorithm is

O(n)

order is the best possible for array sorting algorithm which sorts n item.

O(n+logn)

The complexity of bubble sort algorithm is

O(n2)

specify the correct implementation of pop() method of a stack. this stack uses java.util.ArrayList for storing data and the end of the list is treated as the top of the stack.

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

I have implemented the queue with a linked list, keeping track of a front node and a rear node with two reference variables. Which of these reference variables will change during an insertion into a NONEMPTY queue?

Only rear changes

A variable P is called pointer if

P contains the address of an element in DATA

A variable P is called pointer if

P contains the address of an element in DATA.

What is the "push"?

Placing a data item on top of the stack.

What are the pros and cons of using a priority queue implemented by a simple array?

Pro: Simple and appropriate when the # of items isn't high or insertion speed isn't critical.

Which of the following keywords are access modifier:

Protected, Private

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

Queues

One difference between a queue and a stack is:

Queues use two ends of the structure; stacks use only one.

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

Quick sort

bitRadixsort() can be improved by implementing array , One of techniquesradix sort uses is by looking at each

Radix sort

is the method used by card sorter.

Radix 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

What is "popping"?

Removing a data item from the top of the stack.

Which operation is used in DSW Algorithm:

Rotation

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

Scalars, atoms, elementary items

Finding the location of the element with a given value is

Search

Finding the location of the element with a given value is:

Search

If the number of records to be sorted is small, then...sorting can be efficient.

Selection

Which of the following sorting algorithm is of priority queue sorting type?

Selection sort

Elements of an array are stored _______ in memory

Sequentially

Elements of an array are stored in memory

Sequentially

In a _____every element contains some data and a link to the next element, which allows to keep the structure

Singly linked list

What is the value of the postfix expression 6 3 2 4 + - *:

Something between -15 and -100

_________ is the way you groups things together by placing one thing on top of another and then removing things one at a time from the top

Stack

is the way you groups things together by placing one thing on top of another and then removing things one at a time from the top

Stack

Pushdown list means:

Stack , Queue, Linked list

which of the following applications may use a queue

Store a waiting list of printing

Select the statement that is most correct.Which of the following applications may use a stack?

Store a waiting list of printing jobs

Which of the following applications may use a stack?

Store a waiting list of printing jobs

In a singly-linked list, these is no efficient way to insert node before a given node in the middle or at the end of the list

T

Select the most conect statement about the complexify of insertion sort

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

Select the most correct statement about the complexity of merge sort

The best case is O(n^2), and The worst case is O(nlogn)

Select the most correct statement about the complexity of insertion sort

The best case is O(nlogn), and the worst case is O(n^2)

When converting a method from a recursive version into an iterative version

The brevity of program formulation lost. However, the brevity may not bean issue in Java , Program clarity can be diminished

Consider the implementation of the Queue using a circular array. What goes wrong if we try to keep all the items at the front of a partially-filled array (so that data[0] is always the front).

The getFront method would require linear time.

Entries in a stack are "ordered". What is the meaning of this statement?

There is a first entry, a second entry, and so on.

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 happens to non delimiter characters?

They are not inserted onto the stack; they are ignored.

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

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

Tree

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

Tree

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

True

An object can be saved in a life if its class type is stated, If the vectors capacity is greater than its size, then a new elem

True

Arrays are dense lists and static data structure

True

For a binary tree with n nodes, there are n! different traversals, The complexity of searching depends on the shape of the tree and the,Breath-First traversal

True

If hash function transforms different keys into different numbers, it iscalled a perfect hash function

True

In Huffman coding, both the sender and receiver must have a copy of the same code in order for the decoded file to match the encoded file.

True

The keyword implements is used to specify that a class inherits from aninterface.

True

The recursive version increases program readability, improves self-documentation and simplifies coding

True

data elements in linked list need not be stored in adjecent space in memory

True

in linked list, the tail node is introduced for performance purpose only

True

linked lists are collection of the nodes that contain information part and next pointer

True

The node which is deleted from the list will ... e garbage collection, Deleting a node at the end of...ant time O(1), Processing for adding a node tothe end of list includes six steps

True about Doubly linked list

The Java implementation of the stack is potenti, Stack can be implemented by linked list

True about Stack

The most top element is the latest added element , Operations of stack based on Last in First out structure.

True about Stack

Deleting a node at the beginning of th ...time O(1) - On the average,delete operatio... O(n) steps, There is no immediate access to the predecessorof any node in list

True about singly linked list

The height of a nonempty tree is the maximum level of node ,The level ofa node is the length of the path from the root to the node plus 1,The level ofa node must be between 1 and height of the tree

True about tree

In a Heap tree

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

The complexity of DFS is O(

V| + |E|), where |V| is number of ve, To prevent loop from happen in an algorithm for traversing a grahp | True

What is wrapping around? When is it useful? What is created that must be fixed?

Wrapping around allows the user to fill in new items in the queue at index zero, assuming that the queue is empty at index zero. This creates a broken sequence (the items in the queue are in two different sequences in the array).

How does the mail sorting analogy apply to the priority queue?

You insert a letter from the postman into your pile of pending letters according to priority. The higher the priority the higher the position in the pile.

Value of the first linked list index is

Zero

Value of the first linked list index is _______

Zero

The size of a structure can be determined by

a. size of variable name + b. size of (struct tag)

The difference between linear array and a record is

all

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

all of above

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

all of above

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

all: elementary ,atom,scalar

A linked list index is ____ that represents the position of a node in a linked list.

an Integer

A linked list index is that represents the position of a node in a linked list.

an Integer

A linked list index is ____ that represents the position of a node in a linked list.

an integer

What member function places a new node at the end of the linked list?

appendNode()

In an array queue, data is stored in an _____ element.

array

New nodes are added to the _____ of the queue.

back

New nodes are added to the of the queue.

back

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

base address

Why is the constructor of the LinkedList class empty?

bc...of the LinkedList class is ...constructor of the LinkedList class.

Why is the constructor of the LinkedList class empty?

because initialization of data members of the LinkedList class is performed by the constructor of the LinkedList class.

select the most correct statement about the complexity of bubble sort

best case 0(n), worst case 0(n^2)

select the most correct statement about the complexity of insertion sort

best case O(n), worst case 0(n^2)

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.

The size of a structure can be determined by a. size of variable name b. size of (struct tag)

both a and b

select the most correct statement about the complexity of selection sort

both best and worst 0(n^2)

select the most correct statement about the complexity of heapsort

both best and worst 0(nlogn)

Two dimensional arrays are also called

both of above: table,matrix

A _______ is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out.

both of them

A is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out.

both of them

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

by replacing each empty sub tree by a new external node

The elements of an array are stored successively in memory cells because

by this way computer can keep track only the address of the first element and the addresses of elements can be calculated

The elements of an array are stored successively in memory cells because

by this way computer can keep track only the address of the first element and the addresses of other elements can be calculated

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

complete

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

complete

What is the correct definition of a hash function?

dai nhat

Suppose we have an array implementation of the stack class, with ten items in the stack stored at data[0] through data[9]. The CAPACITY is 42. Where does the push method place the new entry in the array?

data[10]

To delete a dynamically allocated array named `a`, the correct statement is

delete a

To delete a dynamically allocated array named `a`, the correct statement is

delete a;

the operator for removing and returning the end element of the queue is traditionally called

dequeue

which of following queue operations cold result in queue underflow

dequeue

which of the following queue operations could result in queue underflow (become empty)?

dequeue

a node contains some data and one link to its successor and one link to its predecessor in the list

double linked list

Which of the following is two way list?

doubly linked list

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

e begin, u is profe

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

e begins at u and ends at v

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

endpoints,adjacent node,neighbors

The operation for adding an entry to a queue is traditionally called

enqueue

the operator for adding an entry to a queue is traditionally called

enqueue

Unlike a stack, the items in a queue don't always:

extend all the way down to index 0.

Arrays are best data structures

for relatively permanent collections of data

Arrays are the best data structures

for relatively permanent collections of data

arrays are the best data structures

for relatively permanent collections of data

linked list are best suited

for relatively permanent collections of data

Consider the following function: void fun(int n) {if (n<0) {System.out.println("-"); fun(-n); } else if(n<10) System.out.println(n); else {fun(n/10); System.out.println(n%10); } } Which call will result in the most recursive calls?

fun(-1023);

The _______ function retrieves the value of the size member of the LinkedList class

getSize()

The function retrieves the value of the size member of the LinkedList class

getSize()

correct statement about hasing algorithm

if the coalesced method is used for collision resolution, insertion and searching always take constant time 0(1)

specify the correct statement about chaining method for handling collision

in chaining, only some possition of the table is associated with a linked list of chain of structrures whose info fields strore keys or references to keys

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

internal nodes on extended tree

what is the correct definition of a hash table?

is a array in memory used ... into an index i=h(x) in the table

The pop() member function determines if the stack is empty by calling the _____ member function

isEmpty()

The pop() member function determines if the stack is empty by calling the member function

isEmpty()

Node p1,p2; p1 = p.next; p2 = p1.next; p.next = p2; if(p2!=null) p2.prev=p;

it deletes the node after p.

which of following applications may use a queue

keeping track of local variables at run time

Which of the following data structures are indexed structures?

linear arrays

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

n>=0 && n<15

Which of the following case does not exist in complexity theory

null case

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

overflow

Binary search algorithm cannot be applied to

pointer array\sorted linear array

To create a linked list, we can allocate space and make something point to it, by writing: struct-name *pointer-variable; Which of the following statement will correctly allocate the space

pointer-variable = malloc(sizeof(struct struct-name));

Which of the following statement is false?

pointers store the next data element of a list

A operation for moving and returning the top element of the stact is traditionally called

pop

The operation for removing an entry from a stack is traditionally called:

pop

A _______ is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out.

queue linked list

A is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out.

queue linked list

Partition and exchange sort is

quick sort

What is written to the screen for the input "Good**Mor*ni***ngSir"?

risgnMog

A Linked list can grow and shrink in size dynamically at

run time

A Linked list can grow and shrink in size dynamically at _______

run time

The complexity of sorting algorithm measures the ...... as a function of the number n of items to be sorter.

running time

specify the reason for data compression

saving data strorage

a graph that has neither self-loop nor parallel edges are called

simple graph

in a every element contains some data and a link to the next element, which allow to keep the structure

singly linked list

specify thof the e correct statement about chaining method for handling collision

some possition of the table is associated with a linked list or chain of structures whose info fields store keys or references to keys

Binary search algorithm can not be applied to

sorted binary trees

binary tree algorithm cannot be applied to

sorted linear array

Binary search algorithm can not be applied to

sorted linked list

Binary search algorithm can not be applied to

sorted singly linked list

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

stacks

What is written to the screen for the input "carpets"?

steprac

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

strongly connected

if every node in G is adjiacent to every other node v in G, a graph said to be

strongly connected

Each array declaration need not give, implicitly or explicitly, the information about

the first data from the set to be store

What happens when you push a new node onto a stack?

the new node is placed at the front of the linked list.

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

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

tree

A connected graph T without any cycles is called

tree graph,free tree,a tree

in a singly-linked list there is no effecient way to insert a node before a given node in the middle of the list

true

in a singly-linked list we can insert a node after a given node with time complexity O(n)

true

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

u is processor and v is successor

The situation when in a linked list START=NULL is

underflow

which of following applications may use stack?

undo sequence in a text editor, auxiliary data structure for algorithms

which of the following applications may use a stack

undo sequence in the text editor

Specify the correct implementation of in-order traverse algorithm for binary trees

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

push() method of the stack

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

The Average case occurs in linear search algorithm

when item is somewhere in the middle of the array

What is written to the screen for the input "Good**Mor*ni***ng"?

dorino

void fun(int n) {if (n <=0) System.out.println("That's all!"); else {for(int i = 1; i <= n; i++) System.out.print("*"); System.out.println(); fun(n - 2); } } What is the output when the statement fun(5); is run?

*(/n)***(/n)*****(/n)That's all!

void fun(int n) {if(n > 0) { fun(n-2); System.out.print(" " +n ); } } What is the output when the statement fun(9); is run?

1 3 5 7 9

int fun(int n) {if(n < 0) return(fun(-n)); else if(n<5) return(2); else return(n*fun(n/2)); } What is the value of fun(5) ?

10

Each array declaration need not give, implicitly or explicitly, the information about

the first data from the set to be stored

Consider the following function: void quiz(int n) {if (n > 1) {quiz(n / 2); quiz(n / 2); } System.out.print("* "); } How many asterisks are printed by the function call quiz(5)?

3

Given the division hash function h(x) = x%M, where M = 10 and Collision Resolution is quadratic probing. i.e. when inserting a key x, the collision is resolved by finding an available position at (h(x) + i^2)%M), i=1, 2, ... How the hash table looks like after inserting the following keys sequentially?

3

Given the division hash function h(x) = x%M, where M = 10 and Collision Resolution is linear probing. How the hash table looks like after inserting the following keys sequentially? 95,33,221,204,53,243

4

Suppose T is a binary tree with 14 nodes. What is the minimum possible height of T? (Note: In a tree the height of root is 1)

4

Suppose a doubly linked list of integers is given below and p is a reference to the node with value 3 in the list(i.e. p.info=3): (head)7 1 6 4 3 9 8 2(tail) What does the list look like after the following java code sippet is run?

7 1 6 4 3 8 2

Suppose a singly linked list of integers is given below and p is a reference to the node with value 3 in the list(i.e. p.info=3): (head)7 11 6 14 3 9 8 12(tail) What does the list look like after the following java code snippet is run?

7 11 6 14 5 3 9 8 12

Suppose a doubly linked list of integers is given below and p is a reference to the node with value 15 in the list(i.e. p.info=15): (head)7 11 6 4 3 15 8 12(tail) What does the list look like after the following java code snippet is run?

7 11 6 4 3 35 15 8 12

What is the value of the Shift Folding Hash Function if K = 43-65-69-7 and TSize = 100?

84

What is value of the Boundary Folding Hash Function if K = 43-57-69 and TSize = 100?

87

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

Arrays

In the linked list implementation of the stack class, where does the push method place the new entry on the linked list?

At the head

The search time is O(lgn) in the worst case , In 20-element skip lists, the node in position 3 points to the

False about skip list

In the linked-list version of the Queue class, which operations require linear time for their worst-case behavior?

False=(getFront, isEmpty, insert )

Which of the following statements about finding the shortest path are true:

For label-correcting method, information of any ,The complexity of Dijkstras algorithm is O(|V|2)

Basically, the complexity of inserting new element before a given node in the middle of a singly linked lists is

O(n)

In a record, there may not be a natural ordering in opposed to linear array.

difference bw linear and record

I have implemented the queue with a circular array, keeping track of front, rear, and manyItems (the number of items in the array). Suppose front is zero, and rear is one less than the current capacity. What can you tell me about manyItems?

count could be zero or the capacity, but no other values could occur.

Suppose we have a circular array implementation of the queue class, with ten items in the queue stored at data[2] through data[11]. The current capacity is 42. Where does the insert method place the new entry in the array?

data[12]

A record form a hierarchical structure but a lienear array does not

difference bw linear and record

An array is suitable for homogeneous data but hte data items in a record may have different data type

difference bw linear and record

Suppose we are considering a doubly linked list and p is some node in the list which has successor node. What does the java code snippet below do? Node p1, p2; p1 = new Node(x); p2 = p.next; p.next = p1; p1.prev = p; p1.next = p2; p2.prev = p1;

it inserts new node with value x after the node p.

Node q = new Node(x); q.prev=null; q.next = head; head.prev = q; head = q;

it inserts new node with value x at the head of the list.

Two dimensional arrays are also called

matrix arrays

Store a waiting list of printing jobs.

may use a queue

Which of the following stack operations could result in stack underflow?

pop

The operation for adding an entry to a stack is traditionally called:

push


Kaugnay na mga set ng pag-aaral

Chapter 1 | Vocabulary | Windows Server

View Set

GEOPO thème 3 : axe 1 > dates guerre d'Algérie / histoire et mémoire

View Set

Chapter 4, Documentation for Statistical Reporting and Public Health

View Set