Assume you are working with a doubly linked list, based on the following node: W
ID: 3770608 • Letter: A
Question
Assume you are working with a doubly linked list, based on the following node: Write an insert method - which takes a "head" pointer as a parameter (along with the data to be inserted), and inserts to the head of the list. Consider the empty list case. Consider this method declaration: How many asterisks are printed by the method call quiz(7) ? I have a stack implemented with an array (20 cells) of string objects. There is an integer variable called Top which holds the index of first open cell on the stack (the top) (example shown below). Write out the pseudocode for a "pop" method. Create an "is_empty" method which returns a Boolean value (true for empty, false for not empty), then call it from your pop method.Explanation / Answer
8)
9)
seven number of asteriks are printed.
10)
//if top = -1 the function true otherwise it returns false
function is_empty()
if top is -1
return true
else
return false
//The below function prints stack when the function is called on empty stack
//otherwise element in stack at index 'top' is deleted i.e empty string is assigned and top value is decremented
function pop()
if is_empty()
print stack is empty
else
stack[top]= empty_string
top=top-1
return
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.