Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Option ExplicitSub generateNewProblem ( ) ' It generates a new case for knapsack problem ' It uses random numbers for weights, values and maximum weight

Option ExplicitSub generateNewProblem()'It generates a new case for knapsack problem 'It uses random numbers for weights, values and maximum weight Dim W As Long Dim n As Long Dim i As Long Dim arrCase As Variant 'this array will contain the solution W = Application.WorksheetFunction.RandBetween(10,1000) n =100'1 ile 100 arasnda deerler isteniyor ReDim arrCase(1 To n,1 To 3) For i =1 To n arrCase(i,1)= i arrCase(i,2)= Application.WorksheetFunction.RandBetween(100,1000) 'Value arrCase(i,3)= Application.WorksheetFunction.RandBetween(1,100) 'Weight Next i ' Temizleme ilemi: 100'den sonraki satrlar temizle Range("b108:d1000").ClearContents 'rnek olarak 108. satrdan 1000. satra kadar temizler ' Deerleri yerletir Range("b8").Resize(n,3)= arrCase Range("c5")= WEnd Sub
Please creare an algorithm for this code and explain the code clearly.

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions