CSD201_full

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

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.

How many parts are there in a declaration statement?

3

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.

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

ABDECF

The reason for using pointer is ...

Accessing arrays or string elements

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 is the feature of stack?

All operations are at one end

Select correct statements:

An abstract data type can ... && Subclasses or derived classes inherit...

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?

Arrays

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

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

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

Which of following statements are true:

If the vector痴 capacity .. && An object can be saved in a..

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

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.

Where does the term queue come from?

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

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

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

Methods.

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

None of above

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 linear search algorithm is

O(n)

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

What is "popping"?

Removing a data item from the top of the stack.

Finding the location of the element with a given value is

Search

Elements of an array are stored _______ in memory

Sequentially

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

which of the following applications may use a queue

Store a waiting list of printing

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 incorrect statements about Object ・Oriented Programming

The combination of data...&& Static methods and variables

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.

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

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

Trees

In a Heap tree

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

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

The size of a structure can be determined by

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

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

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

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?

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

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.

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

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

delete a;

Which of the following is two way list?

doubly linked list

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

Linked lists are best suited

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

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

getSize()

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

internal nodes on extended tree

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

isEmpty()

Which of the following data structures are indexed structures?

linear arrays

Two dimensional arrays are also called

matrix arrays

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

overflow

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 _______ 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 Linked list can grow and shrink in size dynamically at _______

run time

select the most correct statement

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

Binary search algorithm can not be applied to

sorted singly linked list

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

stacks

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

the first data from the set to be stored

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

The situation when in a linked list START=NULL is

underflow


Set pelajaran terkait

Structure and function; the role of the cerebral cortex

View Set

Chapter 6 Measuring The Cost of Living - Macro

View Set

Chapter 1: An Overview of Strategic Marketing

View Set

Human Development Test Questions (Chapter 12)

View Set