Write the code to implement the method

Assignment Help Data Structure & Algorithms
Reference no: EM13165317

The "linked list" has a integer "position". In an array, the position is very easy to implement as it is related to the "index" of the array. In the "linked list", the position is much more difficult. Suppose yu had a "head" of type "node" and an integer named position. Write the code to implement the method below to move to a specific position in the list.

// asume head is a class instance variable

public void setPosition(int position)

{

int setPosition = 0;

 

// your code here....

}

Reference no: EM13165317

Questions Cloud

Design is known, what advantages does keeping : Given that the design is known, what advantages does keeping the source code unavailable give the company and those who purchase the software? What disadvantages does it cause?
Type of retailing levels of service : In retailing there are three levels of service. They are  self-service, limited service, and ________.
An msp430-based system interfaces 4 external devices : An MSP430-based system interfaces 4 external devices (ED0, ED1, ED2, ED3), each capable of generating an interrupt request.
Dynamically allocates an array large enough : Write a program that dynamically allocates an array large enough to hold a number of test score. The size of the array should be input by the user
Write the code to implement the method : The "linked list" has a integer "position". In an array, the position is very easy to implement as it is related to the "index" of the array. In the "linked list", the position is much more difficult.
High-performing project teams : Describe what you believe are the four most important characteristics of high-performing project teams as being a wedding planner. Tell why you believe each is so critical, explain how they are related to each other, and give at least two specific ex..
Generates a random number between 1 and 100 : Write a program that generates a random number between 1 and 100 (inclusive) and then prompts the user to guess the number. The user should be given up to 10 chances to guess the number.
Prompt the user for and read 6 numbers : Write a program using an array that will store input data. Prompt the user for and read 6 numbers between 70 and 90. Verify the numbers should be greater than 70 and less than 90. If the number is less than or equal to 70 or greater than 90, repro..
Using one- and two-dimensional arrays with functions. : Objective using one- and two-dimensional arrays with functions.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Finding page faults for lru replacement algorithms

How many page faults would happen for the given replacement algorithms, assuming one, two, three, and four frames?

  Algorithm to find maximum sum of contiguous sublist

Using dynamic programming, write an algorithm to find the maximum sum of contiguous sublist of a given list of n real values.

  Scaled and unscaled value of solution that algorithm finds

For each value of ε, give items included and scaled and unscaled value of solution that algorithm finds. For tables, you only require to show those rows which correspond to values less than or equal to scaled value of this solution.

  Creating database for a human resources group

Construct a database for a human resources group. List a few different tables and columns to store the HR information.

  A binary search tree for link information

A binary search tree with N nodes has N + 1 null references, half the space allocated in a binary search tree for link information is wasted. Suppose that if a node has a null left child, we make its left child link to its inorder predecessor, and if..

  Contents of registers for independent memory-reference

Find out the contents of registers PC, AR, DR, AC, and IR for two independent memory-reference instructions below. Each instruction starts with given Initial values.

  Question related to ms excel

Discuss how do I insert a row in multiple tables on different sheets in the same workbook? I have twelve sheets, one for every month, and the sheets are exactly the same.

  Doubly linked list

Write a class that maintains the top 10 scores for a game application, implementing the add and remove methods but using a doubly linked list instead of an array. Program has to be written in java

  Create tree correspond to expression pre-order traversal

Let the algebraic expression E=(2x+y)(5a-b)^3. Create tree T which correspond to expression E and determine pre-order traversal of T.

  System analyst

A huge, well regarded supplier of key raw materials to your corporation's production process requires a year-end summary report of totals purchased from it.

  Diameter bounded minimum spanning tree of graph by prim-s

Modify Prim's or Kruskal's algorithm to determine diameter bounded minimum spanning tree of complete graph. A diameter bounded minimum spanning tree is spanning tree.

  Design algorithms to implement stack operations

How to design algorithms to implement stack operations. Write down the program to multiply any two matrices. (Using Basic).

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd