CSD201

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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.

by replacing each empty sub tree by a 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

All of above

A connected graph T without any cycles is called

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

simple graph

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

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.

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.

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

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

pop

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

Store a waiting list of printing jobs

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

Both of the above

Sorting algorithm can be characterized as

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

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

A

Specify the correct implementation of in-order traverse algorithm for binary trees. A. void inOrder(Node p) {if (p != null) {inOrder(p.left): visit(p); inOrder(p.right):} B. void inOrder(Node p) { inOrder(p.left): visit(p); inOrder(p.right):} C. void inOrder(Node p) {if (p != null) {visit(p): inOrder(p.left); inOrder(p.right):} } D. void inOrder(Node p) {if (p == null) {inOrder(p.left): visit(p); inOrder(p.right):}

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):

may use a queue

Store a waiting list of printing jobs.

True

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

4

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

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)

7 1 6 4 3 8 2

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 11 6 14 5 3 9 8 12

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 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)

False about skip list

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

underflow

The situation when in a linked list START=NULL is

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

The size of a structure can be determined by

Both a and b

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

both a and b

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

stacks

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

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

The worst case occur in linear search algorithm when

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

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

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;

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

What happens to non delimiter characters?

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

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

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

What is "peek"?

Removing a data item from the top of the stack.

What is "popping"?

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

What is a deque?

Placing a data item on top of the stack.

What is the "push"?

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?

dai nhat

What is the correct definition of a hash function?

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

What is the correct definition of a hash table?

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)

What is the difference between a stack and a queue?

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 full binary tree with height 4?

7

What is the minimum number of nodes in a nearly complete binary tree with heigh 4?

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?

All operations are at one end

Which of the following is the feature of stack?

doubly linked list

Which of the following is two way list?

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

Which of the following is two way list?

Protected, Private

Which of the following keywords are access modifier:

FIFO lists

Which of the following name does not relate to stacks?

Merge sort

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

Quick sort

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

Selection sort

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

pop

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

pointers store the next data element of a list

Which of the following statement is false?

Rotation

Which operation is used in DSW Algorithm:

pop

Which stack operation could result in stack underflow?

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.

Why is the constructor of the LinkedList class empty?

All of the above

ushdown list means:

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

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

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

Select the statement that is most correct

Multi-programming

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

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

O(n log n)

The complexity of merge sort algorithm is a.

running time

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

Accessing arrays or string elements

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

Accessing arrays or string elements

The reason for using pointer is ...

Recursion

An algorithm that calls itself directly or indirectly is known as

ABBCD

10000010011

27 11 6 4 3 10 19 8 2

27 11 6 4 3 10 8 2

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

0

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

7 1 6 4 3 8 2

7 1 6 4 3 9 8 2

7 10 6 4 2 13 8 5 3

7 10 6 4 2 13 8 3

7 11 6 14 5 3 9 8 12

7 11 6 14 3 9 8 12

7 11 6 4 3 35 15 8 12

7 11 6 4 3 15 8 12

B

9) If every node u in G is adjacent to every other node v in G,A graph is said to be ........ A. isolated B. complete C. finite D. strongly connected.

run time

A Linked list can grow and shrink in size dynamically at

run time

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

doubly linked list

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

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.

True

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

True

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

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.

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.

A variable P is called pointer if

for relatively permanent collections of data

Arrays are best data structures

True

Arrays are dense lists and static data structure

for relatively permanent collections of data

Arrays are the best data structures

O(n)

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

sorted binary trees

Binary search algorithm can not be applied to

sorted linked list

Binary search algorithm can not be applied to

sorted singly linked list

Binary search algorithm can not be applied to

pointer array\sorted linear array

Binary search algorithm cannot be applied to

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)

C

Consider the following function: 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? A. fun(1012); B. fun(I00); C. fun(-1012); D. fun(0);

fun(-1023);

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?

3

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)?

n>=0 && n<15

Consider the following function: voidfun(int n) {if (n < 0) {System, outprintlnf-"); fun(-n); } else if(n<15) System.outprintln(n): else {fun(n/15); System.outprintln(n%15): } } What values of n are directly handled by the stopping (base) case? A. n<0 B. n <15 C. n >= 15 D. n>=0&& n<15

The getFront method would require linear time.

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).

. Both push and pop would require linear time.

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.

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?

12, 13, 14, 15, 17, 19, 16, 18

Consider the list of eight integers (n-8) below: 15, 13, 18, 19, 17, 12, 16, 14 What is the list after it is partitioned with low = 0 and up = n-1 and pivot = a[0] for quicksort

3

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: (()(())(()))?

True about singly linked list

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

False

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

the first data from the set to be store

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

the first data from the set to be stored

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

Scalars, atoms, elementary items

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

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

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

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

Link

Each entry in a linked list is called a

Link

Each entry in a linked list is called a _______

Sequentially

Elements of an array are stored _______ in memory

Sequentially

Elements of an array are stored in memory

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

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

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

Explain LIFO

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

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

4F4O3F2O5F2O

FFFFOOOOFFFOOFFFFFOO

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.

Search

Finding the location of the element with a given value is

Search

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

3B4Y3B2Y5B2Y

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

4F4O3F2O5F2O

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

infinity

Give a weighted graph below and you are using the Dijkstra algorithm to find the sortest path from the vetex H to the vertex T. What is the label of the vertex D when the shortest path from H to T is determined?

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:

H, A, B, D, T

Given a weighted graph below and you are using the Dijkstra algorithm to find the sortest path from the vertex H to the vertex T. What are the correct order of vertices selected into the set S until the vertex T is selected?(Each step a vertex with minimal current distance is selected into S).

01

Given the character frequencies B : 32% C : 28% D : 16% E : 6% F : 18% Using Huffman encoding, what is the code for character C?(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 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)

101

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)

4

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

E

Given the graph G = (V.E) and X is a vertex of G. Suppose there exists at least one Hamilton Cycle for the graph. The following is a backtracking algorithm for finding the first Hamilton cycle from the vertex X: declare an empty array H (which will contain Hamilton cycle) (1) Put the vertex X to H (2) Check if H is a Hamilton cycle then 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 a bad selection (so you do not select it in the same way again). Go to (2). Suppose a G is given below (view picture). Which of the followings is the Hamilton cycle from the vertex A. created by above algorithm? A. A.C. D. E.B.A B. A.D.E.C.B.A C. A.B.C. D. E. A D. A.B.C. D. E.C.A E. A.B.C. E. D. A

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

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

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.

How does the mail sorting analogy apply to the priority 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.

How is "peek" different in 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.

How is a priority queue different than a queue?

3

How many parts are there in a declaration statement?

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 en

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

complete

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 u in G is adjacent to every other node v in G, a graph is said to be

True

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

DCBA

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?

Selection

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

top1=top2 && top1=top2-1

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

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.

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

In a Heap tree

Singly linked list

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

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

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

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

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) means

u is processor and v is successor

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

all of above

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

endpoints,adjacent node,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)

T

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

False

In all cases, nonrecursive implementation is faster recursive implementation

Array

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

array

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

True

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

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

None of these operations require linear time.

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?

At the tail

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

At the head

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

The listLength() method is O(n) and the alternative is O(1).

In the linked list version of the Bag class an instance variable manyNodes is used to keep track of how long the linked list is. Why not just make a call to the IntNode method listLength()?

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?

True

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

for relatively permanent collections of data.

Linked lists are best suited

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

Linked lists are best suited

may use a queue

Multi-programming.

back

New nodes are added to the _____ of the queue.

back

New nodes are added to the of the queue.

it deletes the node p.

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

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

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

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

One difference between a queue and a stack is:

quick sort

Partition and exchange sort is

True

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

All

Pushdown list means:

Stack , Queue, Linked list

Pushdown list means:

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

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

Select the most conect statement about the complexify of insertion sort

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 *

Both best and worst cases are O(nlogn)

Select the most correct statement about the complexity of heapsort

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 O(n^2), and The worst case is O(nlogn)

Select the most correct statement about the complexity of merge sort

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

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 selection sort

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

Select the most correct statement:

A

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) What does the list look like after the following java code snippet is run? intx = 13: Node f= head: while(f.next != p) f = f.next Node q = new Node(x); q.next= p: f.next = q: A. 7 11 6 4 3 13 9 8 21 B. 13 7 11 6 4 3 9 8 21 C. 7 13 11 6 4 3 9 8 21 D. 7 11 6 4 3 9 8 21 13 E. 7 11 6 4 3 9 13 8 21

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)

cursor = cursor.link;

Suppose cursor refers to a node in a linked list (using the IntNode class with instance variables called data and link). What statement changes cursor so that it refers to the next node?

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

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 deletes the node p

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;

data[10]

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?

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

4

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

when item is somewhere in the middle of the array

The Average case occurs in linear search algorithm

True about Stack

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

FIFO

The Order followed by stack data structure is

getSize()

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

O(log n)

The complexity of Binary search algorithm is

O(n2)

The complexity of Bubble sort algorithm is

O(n2)

The complexity of bubble sort algorithm is

Dn = log2n + 1

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

The depth of a complete binary tree is given by

All of above

The difference between linear array and a record is

all

The difference between linear array and a record is

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

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

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.

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.

E

The following is an algorithm for finding Euler cycle from the vertex X using stack: * Answer declare a stack S of characters (a vertex is labeled by a character) declare an empty array E (which will contain Euler cycle) push the vertex X to S while(S is not empty) {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 vertex Y (by alphabet order), which is adjacent to ch.push Y to S and remove the edge (ch.Y) from the graph } The last array E obtained is an Euler cycle of the graph Suppose a multigraph G is given below (view picture). Which of the following is the Euler cycle from the vertex B. created by above algorithm? A. B.A.B.D.C.B B. B.C.D.A.B C. B.C.D.B.A.B D. B.A.C.D.B E. B.D.C.B.A.B E. A.B.C. E. D. A

getSize()

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

True about tree

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

Binary search trees

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

True

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

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

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

True about Doubly linked list

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

enqueue

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

enqueue

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

push

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

pop

The operation for removing an entry from a stack is traditionally 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

isEmpty()

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

ABDECF

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 DEBFC. Find out the pre order traversal

ABDECF

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

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

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

delete a

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

0

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)

Tree

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

Tree

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

tree

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

both of above: table,matrix

Two dimensional arrays are also called

matrix arrays

Two dimensional arrays are also called

tables arrays && matrix arrays

Two dimensional arrays are also called

extend all the way down to index 0.

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

AABBBCAB

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

Zero

Value of the first linked list index is

Zero

Value of the first linked list index is _______

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

84

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

Something between -15 and -100

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

94

What is value of the Boundary Folding Hash Function if K = 42-58-67 and TSize = 100? (42+85+67)%100

87

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

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).

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

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" ?

steprac

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

Lists implemented with an array.

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

appendNode()

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

Auxiliary data structure for algorithms.

What of the following applications may use a stack?

n==0&& n<35

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

n>=0 && n<15

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

Methods.

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

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

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

internal nodes on extended tree

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

FAEKCDHGB

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

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,

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

Where does the term queue come from?

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?

B

Which of the following applications may use a queue? A. Undo sequence in a text editor. B. Multi-programming. C. Keeping track of local variables at run time. D. Store all variables in a program.

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?

Keeping track of previous choices(as in backtracking).

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?

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

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

Null case

Which of the following case does not exist in complexity theory

null case

Which of the following case does not exist in complexity theory

Arrays

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

Arrays

Which of the following data structure is linear data structure?

All of above

Which of the following data structure is linear type?

All off string,list,queue

Which of the following data structure is linear type?

Trees

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

None of above

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

None of string,list,stack

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?

LIFO

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

FIFO , First In First Out

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

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

Breath-First Traversal

____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).

4

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

simple graph

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

double linked list

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

for relatively permanent collections of data

arrays are the best data structures

sorted linear array

binary tree algorithm cannot be applied to

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

correct statement about hasing algorithm

True

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

FIFO , First In First Out

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

LIFO

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

strongly connected

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

singly linked list

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

true

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 linked list, the tail node is introduced for performance purpose only

10

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) ?

12

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(6)?

fun(-1012);

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?

Insertion

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

Exchange

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

Radix sort

is the method used by card sorter.

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

for relatively permanent collections of data

linked list are best suited

True

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

O(n+logn)

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

False

pointers store the next data element of a list

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

push() method of the stack

sort is 0(n^2), best case it is O(n)

select the most correct statement

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

select the most correct statement about the complexity of bubble sort

Both best and worst cases are (nlogn)

select the most correct statement about the complexity of heapsort

both best and worst 0(nlogn)

select the most correct statement about the complexity of heapsort

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

select the most correct statement about the complexity of insertion sort

both best and worst 0(n^2)

select the most correct statement about the complexity of selection sort

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

singly linked list

Insertion

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

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

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.

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

specify the correct statement about chaining method for handling collision

saving data strorage

specify the reason for data compression

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

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

4

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

0(n)

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

0(nlogn)

the complexity of merge sort is

enqueue

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

dequeue

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

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

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?

1 3 5 7 9

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?

0 4

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?

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; }

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

what is the correct definition of a hash function?

is a array in memory used ... into an index 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

94

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

87

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

88

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

94

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

84

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

97

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

84

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

fun(-1025)

which call will result in the most recursive calls ?

Multi-programming

which following applications may use a queue?

keeping track of local variables at run time

which of following applications may use a queue

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

which of following applications may use stack?

dequeue

which of following queue operations cold result in queue underflow

Store a waiting list of printing

which of the following applications may use a queue

undo sequence in the text editor

which of the following applications may use a stack

B

{if(n > 0) {System.outprint(" " + n % 5); fun(n): } } What will happen if the statement fun(33); is run? A. The results are nondeterministic B. The operating system detects the infinite recursion because of the "repeated state" C. The program keeps running until you press Ctrl-C D. The run-time stack overflows, halting the program


Set pelajaran terkait

Estimating Square Roots, Rational and Irrational Numbers Vocabulary, The Real Number System, The Real Number System, Repeating Decimals as Fractions, Ordering and Comparing Rational Numbers, Classifying Real Numbers, Classifying numbers

View Set

Sun Salutation C (lunging salutations)

View Set

Principles of Accounting - D074: UNIT 4 & UNIT 5

View Set

Kinn's Chapter 1 The Professional MA and Healthcare Team

View Set

Leadership, Managing and Delegating ch.10 PrepU

View Set

Lee cuidadosamente cada enunciado y selecciona la respuesta correcta.

View Set

SB 8.3-8.5 & 8.6A. 8.7 Cell Cycle/Mitosis/ Cell Cycle Control/Cancer/Cell Death

View Set