Question

Submit the pseudo code. Write a member function PrintReverse that prints the elements on a list...

Submit the pseudo code. Write a member function PrintReverse that prints the elements on a list in reverse order. For instance, for the list X Y Z, list. PrintReverse() would output element in the list. You may assume that the list is not empty.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

function PrintReverse( arr )

BEGIN

    // traverse the list inreverse order

    for i = length(arr) down to 1

    BEGIN

         print(arr[i])


    END

END

Add a comment
Know the answer?
Add Answer to:
Submit the pseudo code. Write a member function PrintReverse that prints the elements on a list...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • ngu Cons eY Ja Question 1 a) Write pseudo code to output a singly-linked list in...

    ngu Cons eY Ja Question 1 a) Write pseudo code to output a singly-linked list in reverse order when you are NOT allowed to allocate memory dynamically. What is the running time of the algorithm? b) Write pseudo code to output a singly-linked list in reverse order when you are ALLOWED to allocate memory dynamically. What is the running time of the algorithm? c) You have an increasingly-sorted circular list (using an array) of n elements that is full. The...

  • Write a method named printReverse() that accepts an int array as its parameter and prints that...

    Write a method named printReverse() that accepts an int array as its parameter and prints that array in reverse order. This method should not have a return statement (void). - All elements should be printed on the same line, separated by a space - A new line should be printed after the entire array prints - If the array passed in held the values: {3,2,1} - Output: 1 2 3 //newline printed here

  • In c++, write a function that prints every other element in a linked list. Assume that...

    In c++, write a function that prints every other element in a linked list. Assume that it is a member function of a doubly linked list. This means you will need to use pointer operations.

  • In java Write a method public void printReverse() that prints the elements of a doubly linked...

    In java Write a method public void printReverse() that prints the elements of a doubly linked list in reverse. Write a method public void delete5FromTheEnd() which deletes the 5th element from end of the list. Note that if you reach the end then you have to reverse the direction of counting. In the main() method of the test class, create a randomly generated Doubly-Linked list of 10 Integers. Next, call the delete5FromTheEnd() method and print the lists iteratively until the...

  • In java Write a method public void printReverse() that prints the elements of a doubly linked...

    In java Write a method public void printReverse() that prints the elements of a doubly linked list in reverse. Write a method public void delete5FromTheEnd() which deletes the 5th element from end of the list. Note that if you reach the end then you have to reverse the direction of counting. In the main() method of the test class, create a randomly generated Doubly-Linked list of 10 Integers. Next, call the delete5FromTheEnd() method and print the lists iteratively until the...

  • Write a function cycle(input_list) that performs an "in-place" cycling of the elements of a list, moving...

    Write a function cycle(input_list) that performs an "in-place" cycling of the elements of a list, moving each element one position earlier in the list. Here "in place" means the operation should be performed by mutating the original list, and your function should not return anything. Note that you may assume that input_list is non-empty (i.e. contains at least one element) For example: >>> l = [1, 2, 4, 5, 'd'] >>> cycle(l) >>> l [2, 4, 5, 'd', 1] >>>...

  • v. 15 points) implementing data structure operations C++ code for a new public member function to...

    v. 15 points) implementing data structure operations C++ code for a new public member function to be added to the doubly linked list data structure used in class. Return the average value of all elements in the list ple a list of integers) Throws a length error exception if the list is empty. template «typename E> E& 0; average You may use loops or recursion as needed. If necessary, you may add private helper function0s) The definition of the DLinkedList...

  • Write the pseudo code for function node* list search(node* head ptr, const node::value type& target); where...

    Write the pseudo code for function node* list search(node* head ptr, const node::value type& target); where head ptr is the head pointer of a linked list. The function returns a pointer to the first node containing the specified target in its data field. If there is no such node, the null pointer is returned. You can also use C++ code as you prefer.

  • Write MARIE assembly language programs that do the following: I. Write a program that inputs thre...

    Write MARIE assembly language programs that do the following: I. Write a program that inputs three integers, a, b, and c, in that order. It computes the following ia-bi-fc+ c The result should be written to output 2. Write a program that inputs integers, s. y, and z. It outputs the difference of the langest and first element entered. You may assume x. y, and z all have different values. So if 8, 12, and 9 are input, the output...

  • Draw a sketch of a singly linked list containing the following int values: 3, 1, 4,...

    Draw a sketch of a singly linked list containing the following int values: 3, 1, 4, 1, 5. The 3 should be at the front of the list. Remember to sketch the head pointer, each node, and each node's next pointer. 2. Write the code for the following new member function for our SinglyLinkedList class. You should write out the definition of the function, but do not need to write out all of the rest of the class. Your code...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT