Write a pseudo code for a linked list get() operation
"""""""""""""In case of doubt please comment """""""""""""""""""""""
Now our get function will return the nth element from the linked list.
Algorithmic procedure:
procedure get (start, index)
1) initialize current_element=0;
2) current_pointer = start \\ initializing current pointer to start of the linked list
2) Now run a loop for through the linked list starting from start address;
a) If current_element == index return current node
b) else:
i) current_element = current_element+1
ii) change current to point to next of the current
""""""""C++ code"""""""""""""""""""""""""""
int get (Node* start, int index)
{ Node* current_pointer = start; //it will show point the current node
int current_element = 0;
while (current_pointer != NULL)
{
if (current_element== index)
return(current_pointer -> data);
count++;
current_pointer = current_pointer->next;
}
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 program void reverse_list(list **l)in pseudo-code or C++ to reverse the direction of a given singly-linked list. In other words, after the reversal all pointers should now point backwards. Your algorithm should take linear time. The node of this singly-linked list is defined as typedef struct list { item_type item; struct list ∗ next ; } list; void reverse_list(list **l){ } Remark: 15 points for completely correct. 10 points for correctly reversing the list with minor errors.
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.
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.
Write the pseudo code using modules for the following questions 1.) write pseudo code for a program that outputs every number from 1 through 20 along with their values doubled and tripled 2.) write pseudo code for a program that outputs every number in reverse order from 25 down to 0
write the java code to convert a linked list of integers, to a stack of integers. thus your code will traverse the linked listand populate the stsck. linked list 1->2->3. becomes stack 3 First Last 2 1
Java 3) Write the-G-code to convert a linked list of integers, to a stack of integers. Thus, your code will traverse the linked list and populate the stack. [ 15 points ] Linked List 1→ 2→ 3 Stack 3 becomes First Last
Can someone write an example of a Linked list code that simply adds items to the head and to the tail of the list in PYTHON while using classes.
Given the node structure and the head pointer (headptr) of a linked list write a code to move the last element to the head of the list. struct node { int value; struct node *next; };
Write a method max() which take a generic singly linked list as an argument and returns the maximum element reference in the list. If the list is empty, please throw an empty collection exception. The method prototype is defined as follows. Please write down your code in the method body enclosed in braces: public static <T extends Comparable<T>> T max(SingleLinkedList<T> list) throws EmptyCollectionException { } 2) What is the big O notation of the max method? a) O(N)...