Assignment 1: Linked Lists, Stacks & Queues Reminder

Submission must be on time as discussed in class. Your grade in all the homework assignments and exams depends on the correctness andspeed of your algorithms. Assigned: 1/19/16 Due: 1/28/16 1. (2.5 points) Singly linked lists. a) Write an algorithm that puts numbersinto a singly linked list, L1, in ascending order. You may use pseudo code or C++. b) Demonstrate its operation (step-by-step) addingnodes with the following keys: {3, 8, 6, 2}. 2. (2.5 points) Doubly linked lists. a) Write an algorithm that adds a node into themiddle of a doubly linked list, L2. You may use pseudo code or C++. b) Demonstrate its operation (step-by-step) by adding a node withkey ‘5’ to an existing list with the keys: {3, 8, 6, 2}. 3. (2.5 points) Stacks. Reverse the content of stack S1: a) using twoadditional stacks (S2 and S3) b) using one additional queue (Q1) c) using one additional stack (S4) and some additional variables. 4.(2.5 points) Queues. a) Write an algorithm that provides queue functionality using a stack data structure and stack operations. Youshould provide operations to enqueue new elements, dequeue elements, peek at the value of the ‘next’ element for dequeuing, and test ifthe queue is empty. b) Demonstrate its operation using a small dataset (such as {3, 8, 6, 2}). Submit an archive (zip file) of the wordprocessing document with your solutions. If you use images of your handwritten solutions, paste them into a single document and thencheck to ensure they are oriented correctly and legible. If I can’t read your solutions, I can’t provide maximum credit!