Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask E-Commerce Expert

You need the Html and javaScript separate. You need a working jsfiddle please

Assignment

You are going to create a Queue. (alternately you can create a list and simply implement enqueue and dequeue functions in the List - that will technically make it a queue).

You will fill the first list with numbers consecutively numbered from 2 to n where n is entered by the user (we will call this Q1). When creating your Queue object use the correct function names for enqueue and dequeue functions.

Again - sorry, cannot use an Javascript array in your implementation - you need to implement enqueue and dequeue.

Create a second empty Queue Q2.

Once you have the first Queue filled we are going to use a technique called Sieve of Eratosthenes which uses first queue to fill the second queue.

Here is the algorithm;

1. Dequeue 1st element in Q1 (which will be 2). You will need to remember the value of this element - we will call it X.

2. Enqueue this element into Q2 (Q2 is the list of primes)

3. Iterate and Dequeue each successive element of Q1

If the value is divisible by X, go to the next element

if the value is not divisible by X enqueue back onto Q1, go to the next element.

4. Print the values of Q1 and Q2 after each time through.

5. When done go back to the beginning of the Q1 and repeat steps 1-3 (the first value will be 3 the second time around)

Sample output with input 10

Iteration 0: Q1 = 2 3 4 5 6 7 8 9 10, Q2 = ,

Iteration 1: Q1 = 3 5 7 9, Q2 = 2

Iteration 2: Q1 = 5 7, Q2 = 2 3

Iteration 3: Q1 = 7, Q2 = 2 3 5

Iteration 4: Q1 = , Q2 = 2 3 5 7

E-Commerce, Computer Science

  • Category:- E-Commerce
  • Reference No.:- M93067604

Have any Question?


Related Questions in E-Commerce

Mobile web application development assignment - android

Mobile Web Application Development Assignment - Android Apps Development Purpose of the assessment - Students are required to design and develop four different Apps. Apply Java programming concepts, models/architectures ...

Mobile applications assignment - an ios recipe application

Mobile Applications Assignment - An iOS Recipe Application - Introduction - In this assignment, you will create a simple Recipe application for iOS using Xcode (Swift). This application allows users to view food recipes. ...

Html - css assignments assignment 1 - internet programming

HTML - CSS Assignments Assignment 1 - Internet Programming   My grandfather, like many men who lived in rural America, owned a large machine shed where he stored tools, farm equipment, vehicles, lumber, and wonderful gad ...

Research and discuss html 5what are its main featureswhat

Research and discuss HTML 5. What are its main features? What resources are available to support it? Put it in your own words please.

Purpose of the assessment with ulo mapping students are

Purpose of the assessment (with ULO Mapping) Students are required to design and develop four different Apps. Students will be able to: b. Apply Java programming concepts, models/architectures and patterns to Android app ...

Assignment - creating dynamic websites and web-based

Assignment - CREATING DYNAMIC WEBSITES AND WEB-BASED APPLICATIONS - AN OVERVIEW This assignment is an overview of the concepts, technologies and design techniques required to build dynamic websites and web-based applicat ...

Assignment requirementsyour web site proposal and

Assignment Requirements Your web site proposal and presentation (Assignment 1) was accepted, subject to any feedback you may have received. You company has been asked to develop website you suggested and build the featur ...

Secure electronic commerce assignment -part a -based on

Secure Electronic Commerce Assignment - Part A - Based on your practices in labs, develop an online e-commerce (shopping) system using html, javascript and php. You can assume any products for sales. Please create a fold ...

Overviewassignment 2 asked you to build the front end of

Overview Assignment 2 asked you to build the front end of the assignment, now the client wants you to build the full eCommerce website to the point that orders can be made and stored in a spreadsheet. Requirements 1. Web ...

Create testcase for given project first use piki design to

Create testcase for given project, first use piki design to do test case Want to do it like testcase one file and you can also get right information from saeed testcases Want to piki design all of it and informat like te ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As