chapter 4 data structures

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

what is the rear of a queue?

(back or tail or end)

what is a stack overflow?

(stack full) - cannot push(normally error condition or special processing needed.

what are deques?

a double-ended queue that can insert() , ,delete() from either end and can insertLeft() and insertRight().

stacks

accèss to only one item at a time. think of a stack of dishes. evaluate arithmetic expressions even with lots of parenthesis.

what is a queue?

another conceptual data structure (logical data structure) can be implemented using an array, linked list or other structure.

the access (interface)

arrays: theoretically, access is immediate via index or by searching through cells sequentially. if ordered, can access more quickly via binary search.

what should a delimiter always do?

balance- the first right parenthesis balances the most recent unbalanced left parenthesis.

what is the best approach for in push() and pop()?

check for isEmpty and isFull within these methods.

what is insert() and remove() considered?

o(1) times; that is , a constant

what is a second basic operation?

pop(top item off of stack)

in what kind of operating systems are queues found?

print queues, job queues, ready queues and keyboard queues.

what is one basic operation?

push (onto top of stack)

what should we always check about the items?

see if there are items on the stack before popping the stack or if there is room before pushing the stack.

what happens if no closing delimiter is found (or if unbalanced)?

syntax error

what happens when the algorithm encounters closing delimiter or operator of lesser precedence?

the algorithm may pop the stack and perform the evaluation thus creating a temporary (or partial) value.

what is the front of a queue?

the head

what happens for pairs of delimiters, such as 'parenthesis'?

the one opened last and closed first.

what happens if different delimiters are used such as (brackets, parenthesis, etc.)?

then the correct delimiter must be found, if syntax of the expression is valid.

why does a push() and pop() take O(1) time- a constant?

there is no dependency on number of items in stack, there is no comparisons or moves necessary and for many applications, this is a very convenient logical data structure.

what are arrays good for?

they are good for inserting into, deleting from, and search for specific items.

what are delimiters?

they are normally special characters (e.g. commas, white space, braces, brackets, parenthesis. they normally set something off or bracket something.

how are queues very useful?

they are used to model waiting lines, such as planes waiting to take off; waiting lines at mcdonalds, etc. and much more.

what kind of limited access is there for the stack elements?

via push() and pop()

what happens once a stack (very reusable) is set up?

you don't have to keep track of indices.


Kaugnay na mga set ng pag-aaral

Health and illness Pearson quizzes

View Set

patho chapter 8 practice quizzes, Prep U CH.8, Chapter 8- PrepU, Pathophysiology Chapter 8 PrepU

View Set

Chap 10, 11 ECON 102 practice test

View Set

Levels of Measurement Stats Exam 1

View Set