Create a list from its members so that all the members

Assignment Help Computer Engineering
Reference no: EM133369141

Question: Given is the IntNode class that represents an element in a linked list, and the IntList class that represents a linked list (at the end of the question).

Add a method signed to the IntList class:
public void createList(int[] a, int num)

The method will receive as a parameter an array of numbers and the number num, and will create a list from its members so that all the members in the array that are smaller than or equal to num will be at the beginning of the list, and all the members that are greater than num will be at the end of the list.
For example, if the array was {4, 2, 7, 5, 3, 8, 1} and num = 3 the list that would be created would be:
head  2  3 1 4 7 5 8 null
In this case, the numbers 1, 2, 3 are less than or equal to 3 and therefore appear at the beginning of the list, and the other numbers appear later. The internal order of the numbers in each part is not important.
Defining the departments for the question:
public class IntNode {
private int num;
private IntNode next;
public IntNode(int num, IntNode next) {
this.num = num;
this.next = next;
}
public int getNum() { return num; }
public void setNum(int num) { this.num = num; }
public IntNode getNext() { return next; }
public void setNext(IntNode next) { this.next = next; }
}

public class IntList {
private IntNode head;
public IntList() { head = null; }
}

Reference no: EM133369141

Questions Cloud

What should you do first : All the devices are enrolled in Microsoft Intune. You need to use Intune to apply Windows updates to the devices. What should you do first
Why do public utility companies usually have capital : Why do public utility companies usually have capital structures that are different from those of retail firms? Explain. Why is EBIT generally considered
What is stevens healthcare cost of capital : What are the cash flows to assets from the project in years 1-8? What is Stevens Healthcare's cost of capital (WACC) for this project?
Explain why and how they do a great job at the topic : explain why and how they do a great job at the topic you have chosen. Do this for each of the three topics from the textbook. Conclusion: Wrap-up your paper
Create a list from its members so that all the members : COMP 499 Concordia University create a list from its members so that all the members in the array that are smaller than or equal to num will be at the beginning
What type of network has no specific geographical : A network uses an IEEE 802.11 standard to establish connections. What type of network is this and What type of network has no specific geographical restrictions
What is the current value per share : XYZ Corp. has paid a constant annual dividend of $1.40 a share for several years. Yesterday, the firm announced the dividend will increase next year by 10
What happens when the signs of the numbers are the same : COMPUTER S CS 1104 CO University of the People What happens when the signs of the numbers are the same? What happens in the case of subtraction?
Write describing project schedule management : Write describing project schedule management and the purpose of a Gnatt chart. Include a reference list

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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