Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 2: Lab Tasks (10 points) Note: Copy this section into a new word file then save it. You will only submit this section of

image text in transcribedimage text in transcribed
Part 2: Lab Tasks (10 points) Note: Copy this section into a new word file then save it. You will only submit this section of the lab manual. Problem Description Lucy and Jade are playing a game. In this game, both of them are initially provided with a list of n numbers. (Both have the same list but their own copy). Now, they both have a different strategy to play the game. Lucy picks the element from start of his list. Jade picks from the end of his list. You need to generate the result in form of an output list. Method to be followed at each step to build the output list is: . If the number picked by Lucy is bigger than Jade then this step's output is 1 . Jade removes the number that was picked from their list If the number picked by Lucy is smaller than Jade then this step's output is 2 . Lucy removes the number that was picked from their list If both have the same number then this step's output is Q . Both Lucy and Jade remove the number that was picked from their list. This game ends when at least one of them has no more elements to be picked i.e. when the list gets empty. Output the built output list. Input format: First line consists of a number n, size of the list provided. Next line consists of n numbers separated by space. Output format: Output the required output list. SAMPLE INPUT SAMPLE OUTPUT 3 1 ; 2 20 2 3 Explanation Ist step: Lucy picks 1. Jade picks 3. Jade > Lucy. So output is 2. Lucy removes 1. 2nd step: Lucy picks 2. Jade picks 3. Jade > Lucy. So output is 2. Lucy removes 2. 3rd step: Lucy picks 3. Jade picks 3. Jade = Lucy. So output is 0. Lucy removes 3. Jade removes 3. Output list: [2, 2, 0] Note Two data structures (array and stack) should be used to solve the problem namely Lucy and Jade.Part 1 Stack is used to implement backward and forward buttons operations of web browser. Every web browser has a Back button. As we navigate from web page to web page, those pages are placed on a stack (actually it is the URLs that are going on the stack). The current page that we are viewing is on the top and the first page we looked at is at the base. If we click on the Back button, we begin to move in reverse order through the pages. - Develop a program that store the browsing history (the visited pages) and implement this back button functionality. Provide a menu with the following two options: 1. Visit new website: If the user chose this option, s/he should provide the URL of the website. Then this URL should be pushed into the stack. 2. Go Back. If the user chose this option, you should pop the top website from stack and display the website that is currently at the top of the stack. Solve them by Struct

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

=+How would you interpret these evaluations?

Answered: 1 week ago