CIS 252 Data Structures Final

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

True or false: if you implement a heap with an array, then you should check for stack underflow or overflow

TRUE

True or false: maps (k, v) pairs are put in the data structure as unsorted data

TRUE

True or false: programs = data + algorithms

TRUE

True or false: the ADT set should be implemented to have a size method.

TRUE

True or false: the addElement method for the implementation of an adt set should check first for isElement.

TRUE

True or false: the main operations of a map are for searching, inserting, and deleting items

TRUE

True or false: to remove/pop an item from a tree, it is taken from the root of the tree

TRUE

True or false: using pointers to implement a map as a list is common.

TRUE

True or false: when an element is popped from a heap, you go to the last level and get the right most element and swap it to the root.... then you may have to shuffle it down to keep the parent child sort order

TRUE

True or false: when implementing a queue with an array, simply speaking, you should start adding data at element 1 of the array, and add 1 to the front index each time you add more data. be sure to code the array beginning and ending cross over.

TRUE

true or false: a stack is a linear data structure that has LIFO data access.

TRUE

true or false: adding and removing an element from a stack is called push and pop.

TRUE

true or false: enqueue can also be called push.

TRUE

true or false: in an adt queue, the order of the data can not be changed

TRUE

true or false: to implement an adt stack that has a fixed amount of data you can use an array.

TRUE

true or false: when implimenting a queue with an array, simply speaking, you should start removing data by subtracting 1 from the end index. be sure to code the array beginning and ending cross over.

TRUE

what is of less concern with DATA? a. big O b. uml diagram c. validation d. algorithms e. data structure selections

b

true or false: it's OK to sort data in a stack.

FALSE

true or false: you can access data in the middle of the stack.

FALSE

what is big o?

measure of how complex or efficient an algorithm is.

3 specific uses of an adt graph?

1. depth first search 2. breadth first search 3. single source shortest path algorithm

define a class

A class is a user defined type used to group functions and variables into one entity. It is basically defining the key characteristics that define a group of things.

How is a concept like a class?

A concept is like a class because they both define and explain the key characteristics of an entity or object. They both identify aspects that make objects similar to each other and group them together under one umbrella.

define ADT list

ADT list is a logical sequence of data that is not sorted or ordered

True or false: Maps with multiple entries of the same key are allowed.

FALSE

True or false: a heap is only a binary tree structure and parent child order

FALSE

True or false: all heaps must be complete

FALSE

True or false: an ADT set can have ordering

FALSE

True or false: an ADT set can never be implemented with a binary search tree

FALSE

True or false: an ADT set is the same as an ADT bag.

FALSE

True or false: an IsEmpty function is not necessarily in a heap.

FALSE

True or false: put takes O(N!) time since we need to determine whether it is already in the sequence

FALSE

True or false: the big O for the equation 2n+1 is O(2)

FALSE

True or false: heaps can be incredibly difficult to implement with pointers, which is why most heaps are implemented with arrays.

TRUE

True or False: as a programmer, you should be aware of all the steps from DATA to implementation

TRUE

True or false: The essential characteristics of an ADT tree * is a set of objects with interconnections * where the interconnections must be acyclic

TRUE

True or false: When you implement a tree, you can either use an array or pointers.

TRUE

True or false: a tree that has only 0 up to 2 nodes per parent is called a binary tree

TRUE

True or false: to access a child index you write: left child: parent index * 2 right child: (parent index * 2) + 1

TRUE

True or false: A heap can either be a min or max heap.

TRUE

True or false: An ADT list is a type of tree where each parent only has one child.

TRUE

True or false: In a complete binary heap you should add the new element to the bottom level and fill from the right.

TRUE

True or false: O(1) is better than O(N!)

TRUE

True or false: Recursion is the repetition of series of steps, and while doing so, breaks a problem down into successive smaller parts until they reach a situation where you can no longer break it into smaller parts... This smallest part is called the base or ending case.

TRUE

True or false: To remove/pop an item from a tree, it is taken from the root of the tree

TRUE

True or false: When a value is inserted in a heap, you may have to shuffle up the value to keep the right sort order.

TRUE

True or false: a balanced BST is a good way to implement a set.

TRUE

True or false: a key characteristic of of an ADT implementation is a method to check if an element is a member

TRUE

True or false: a map entry stores a key-value pair.

TRUE

True or false: a tree can have as many nodes as you need, is called an n-ary tree.

TRUE

True or false: an ADT bag can have duplicates

TRUE

True or false: an ADT does not constrain how you organize the data or how you implement the operations

TRUE

True or false: an ADT set can have no duplicate methods.

TRUE

True or false: an address book and a student record data base are two good uses of maps.

TRUE

True or false: heaps are NEVER sorted in sibling order.

TRUE

True or false: heaps are only sorted in parent-child order.

TRUE

the uml represent the stack... a. abstraction b. implementation c. the function header and body d. array data storage

a

what is data cleansing? a. inspecting data after it is stored b. inspecting data as it is entered c. insuring there is no fraud in the data d. deciding whether to use tide or chlorox to clean it

a

when you try to remove data from a stack and there is nothing there, you are experiencing stack... a. underflow b. middle flow c. go with the flow d. overflow

a

which is not an action for a stack? a. bottom b. push c. isfull d. top e. isempty

a

which is not an example of a stack? a. the line at the bus stop b. undo button c. calling a function d. castellers in spain

a

what is an adt graph?

a data structure that consists of vertexes connected by edges

what is a two way linked list?

a list with sequentially linked nodes

What is an ADT list?

a logical linear sequence of data that is unsorted

What is an ADT binary tree?

a tree that only has 0-2 nodes per parent.

What is a binary search tree

a tree with the extra restriction of being ordered (sibling order rather than parent-child), and only having 0-2 nodes.

when you try to add data to a stack and there is no more room... (choose all that apply) a. you are experiencing stack overflow b. it is probably implemented with an array c. it is probably implemented with a linked list d. you definitely designed the stack incorrectly

a, b

What is true about an ADT tree? (choose all that apply) a. a node in a tree that has no children is called a leaf b. a tree can be broken up into subtrees c. a tree can have a root node d. a tree is a recursive data structure

a, b, c, d

big o is... (select all that apply) a. is concerned with the amount of ram used b. looks at the performance of an algorithm as the quantity of data increases c. is related to the FBI checking for data Fraud and they call it the big O squad d. measuring the worst case of data quality

a, b, d

removing an element from a queue can be called... (choose all that apply) a. remove b. pop c. invisible d. dequeue

a, b, d

what is overflow (select all that apply)? a. reached maximum physical size -- array implementation b. data too big for an object in the queue c. reached maximum logical size -- pointer implementation d. bad RAM error message

a, c

the position, top of the stack, is... (check all that apply) a. set to either end of the linear sequence, but only one end b. is not used when describing the access methods of a stack c. is where you remove data from a stack d. is where you add data to the stack

a, c, d

What is an ADT?

abstract data type an outline or idea of how data should be organized and accessed

what is an ADT priority queue? what is the access and organization?

access: added in the order they come and removed based on priority organization: sorted in key-value pairs

pros of a binary search tree

already ordered, so it is easy to find the information

Define a hash table.

an array of elements that have a unique hash function associated with it

What is the best way to implement an adt graph?

arrays

What is tree underflow? a. assigning a value to an existing node b. trying to delete a node from an empty tree c. trying to traverse a tree d. trying to add a node to a full tree

b

it is common to implement a queue with... (check all that apply) a. individual variables b. circular arrays c. open two directional linked lists d. recursion

b, c

What is NOT true about recursion? a. recursion is like a loop b. recursion uses functions to call itself c. a function can be written to pass information into it and return an answer. If this function is used in recursion, it would be called Three-Way recursion.

c

what is true about a queue? a. no need to check for the underload b. it has LIFO data access c. it is a list with the added restriction of first in first out d. adding a sorting routine is ok...

c

how to resolve a collision?

chaining or linear probing

syntax of a class

class {} private: variables public: functions

what are the steps from data to implementation?

collect the data organize it in structures analyse it and cleanse it to make sure it is not fraudulent implement it in code

5 other terms for an ADT

concept, idea, class, entity, set of objects with a set of operations

what is the significance of the crow?

creates a physical need for concept formation

an implemented two-direction pointer queue have what in their nodes? a. node, double, ptrright b. ptrright, data, node c. ptrup, data, int d. ptrleft, data, ptrright

d

which is not a method for an adt queue? a. isFull b. head c. tail d. deleteMiddleValues e. isEmpty

d

what is an ADT tree?

data structure where there are a set of objects that have acyclic connections. it can be broken into subtrees, and has parent-child order. It is also has recursive data structure.

What is an array?

data type that holds a series of spots in memory

What is a class UML diagram?

diagram that shows the private and public functions and variables of a class

what is a collision?

different elements lead to the same place.

characteristics of an ADT

high level idea about how to organize and access data separate from the code and implementation helps the programmer have an idea of what they're programming during implementation and how to organize their code

What is implementation?

implementation is writing the code

what are the common methods for graphs?

isfull, isempty, and initialize

cons of implementing an adt with an array

it is not dynamic like a linked list would be

organization of a hash table

key-value pairs

what is a linked list?

like an array but utilizes dynamic memory

what is big o

measure the efficiency of an algorithm. the efficiency is based on how many times the algorithm has to iterate through a set of numbers to search/sort them.

2 key features of data structures

organization and access

what is an ADT queue?

organization: linear structure access: FIFO (first in, first out)

what is an ADT stack? what is the organization and access?

organization: linear structure access: LIFO (last in, first out)

If a key already exists in a map, what should the put(k, v) function do?

over-write the duplicate

In a complete binary heap with an array, the parent can be accessed by...

parent index / 2

How can you implement a binary search tree?

pointers, arrays, recursion

what are the three types of binary tree recursive travel?

preorder, postorder, and inorder

What is recursion?

repeating a series of steps until you reach the base case.

sorting

taking members of data structure and placing them in a specific order. This can be done in many different ways, but in essence is done through different kinds of comparisons.

What is the crow?

the limit on the amount of things you can hold in focus in your mind at once

why use hash tables?

they are sometimes more efficient, especially the hash table that can help access the right data more quickly

searching

when you look for a specific member of a data structure or list, which can either be a specific value or a memory address.

pros of implementing an adt with a linked list

you can utilize dynamic memory with pointers, which is helpful if you don't know how many spots in memory you need to allocate

pros of implementing an adt with an array

you have the address, alias and value

cons of a binary search tree

you have to regularly re-order in order to maintain the structure

cons of implementing an adt with a linked list

you only have the address


Kaugnay na mga set ng pag-aaral

Chapter 44: Guillain-Barré & Myasthenia Gravis

View Set

pharm exam 1- chapter 3 PrepU practice questions

View Set

Psych Ch. 8 Therapeutic relationships

View Set

Meteorology Chapter 5 and 6 7 and 8

View Set