1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tanya [424]
3 years ago
10

Write a method max() which take a generic singly linked list as an argument and returns the maximum element reference in the lis

t.If the list is empty, please throw an empty collection exception.The method prototype is defined as follows.public static > T max(SingleLinkedList list) throws EmptyCollectionException.
Computers and Technology
1 answer:
max2010maxim [7]3 years ago
6 0

Answer:

See explaination

Explanation:

java code:

class DONALD

{

static class Node

{

int data;

Node next;

}

static Node head=null;

static int largestElement(Node head)

{

Int max=Integer.MIN_VALUE;

while(head!=null)

{

if(max<head.data)

max=head.data;

head=head.next;

}

return max;

}

static int smallestElement(Node head)

{

int min=Integer.MAX_VALUE;

while(head!=null)

{

if(min>head.data)

min=head.data;

head=head.next;

}

return min;

}

static void push(int data)

{

Node newNode=new Node();

newNode.data= data;

newNode.next=(head);

(head)=newNode;

}

static void printList(Node head)

{

while(head!=null)

{

System.out.println(head.data + " -> ");

head=head.next;

}

System.out.println("NULL");

}

public static void main(String[] args)

push(15);

push(14);

push(13);

push(22);

push(17);

System.out.println("Linked list is : ");

printList(head);

System.out.println("Maximum element in linked list: ");

System.out.println(largestelement(head));

System.out.print("Maximum element in Linked List: " );

System.out.print(smallestElement(head));

}

}

You might be interested in
Smith wants to get a job in network systems. Which major should he choose to give him the best chance of getting a job?
Sever21 [200]
<span>computer engineering</span>
5 0
4 years ago
Read 2 more answers
What are experts in technology who use their knowledge to break into computers and networks, for profit or just as a challenge k
insens350 [35]

Answer:

Hacker

Explanation:

Hacker -

It refers to the computer software expert , who is responsible to break into the unauthorized networks or computer , is referred to as a hacker .

The hacker is skilled with exceptional computer and computer software knowledge .

Hacking is an illegal practice , as the person is able to access some confidential and personal data and information of any other person or organisation .

Hence , from the given information of the question ,

The correct term is hacker .

3 0
3 years ago
Determine whether the relation represents a function. If it is a​ function, state the domain and range.
slava [35]

Answer:

Yes, the relation is a function

Domain = {-3,1,3,7}

Range = {7,3,1-1}

Explanation:

Given

{(-3,7),(1,3),(3,1),(7,-1)}

To determine if the relation is a function or not, we check if every output has only one corresponding input.

The output are (7,3,1-1) while the input are (-3,1,3,7)

-3 ----;> 7

1 -------> 3

3 -------> 1

7 -------> -1

It is a function since every output only has one corresponding input

To find the domain, we look at the set of input values

Domain = {-3,1,3,7}

To find the range, we look at the set of output values

Range = {7,3,1-1}

3 0
3 years ago
All of the following are tips for a great presentation except
Burka [1]

Answer: B. Use a variety of animations on most slides to keep your audiences attention.

Explanation:

While animations can serve as a tool to make your presentation more engaging, too many of them can end up being a distraction and can end up potentially frustrating the audience.

5 0
3 years ago
Read 2 more answers
You are instructing a user on how to properly use a new laptop. He asks about the special function keys that are used to perform
ruslelena [56]

Answer:

The Fn key.

Explanation:

In this scenario, you are instructing a user on how to properly use a new laptop. He asks about the special function keys that are used to perform tasks such as toggling the display or adjusting the display brightness.

The user should strike the "Fn" key in combination with the special function keys.

In Computer science, the special function keys found on the top row of a keyboard are the F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, and F12 keys. Each of the special function keys just like their name suggests are used to perform different tasks respectively as defined by the operating system of a computer.

Fn is an acronym for function. In order to use the special function keys, a user must first hold down the Fn key before pressing the specific special function key which then triggers functions configured to use this key.

<em>For instance, </em><em>"Fn+F2" </em><em>is to reduce brightness on the Windows operating system. Also, </em><em>"Fn+F12"</em><em> is to increase audio volume on the Mac operating system. </em>

6 0
3 years ago
Other questions:
  • Develop a program that will calculate the area and perimeter of a rectangle. The length and width can be given as constant.(LENG
    8·1 answer
  • When cleaning a computer, you need only worry about what you can see.
    11·1 answer
  • Which best describes the benefits of renting a home?
    15·1 answer
  • Which part of a touchscreen responds to pressure applied to its surface?
    6·1 answer
  • Genetics Vocabulary: no <br> Allele: Different versions of the same qene (Aa, Bb)
    11·1 answer
  • Stacy is in the process of creating a storyboard for her personal website, but she is unable to decide which storyboarding techn
    13·1 answer
  • Use the drop-down menus to complete statements about the two formats for importing contacts.
    11·2 answers
  • WILL MARK BRAIN LIST!
    9·2 answers
  • A manager suspects that one of his team members has been fraudulently accessing confidential and sensitive information and breac
    8·2 answers
  • The project objective is the detailed description of the characteristics of the project. True or False?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!