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
Please explain this code line by line and how the values of each variable changes as you go down the code.
Scilla [17]

Answer:

hope this helps. I am also a learner like you. Please cross check my explanation.

Explanation:

#include

#include

using namespace std;

int main()

{

int a[ ] = {0, 0, 0};  //array declared initializing a0=0, a1=0, a3=0

int* p = &a[1]; //pointer p is initialized it will be holding the address of a1 which means when p will be called it will point to whatever is present at the address a1, right now it hold 0.

int* q = &a[0];  //pointer q is initialized it will be holding the address of a0 which means when q will be called it will point to whatever is present at the address a0, right now it hold 0.

q=p; // now q is also pointing towards what p is pointing both holds the same address that is &a[1]

*q=1 ; //&a[0] gets overwritten and now pointer q has integer 1......i am not sure abut this one

p = a; //p is now holding address of complete array a

*p=1; // a gets overwritten and now pointer q has integer 1......i am not sure abut this one  

int*& r = p; //not sure

int** s = &q; s is a double pointer means it has more capacity of storage than single pointer and is now holding address of q

r = *s + 1; //not sure

s= &r; //explained above

**s = 1; //explained above

return 0;

}

6 0
2 years ago
Again, consider what you believe to be the goal of performing a penetration test. Why would you worry about doing any privilege
Strike441 [17]

Answer:

Penetration monitoring is conducted based on the vulnerability evaluation (Were a susceptibility evaluated and mentioned).

Explanation:

Penetration Test

  • Penetration testing is carried out from both within (the network or application) as well as outside that aims to gain access to the system to evaluate if any suspicious activity or improper behavior is likely within the device.
  • When there are some other potential security vulnerabilities, they are all found in the integration check that involves vulnerability assessment for frameworks and checking for network management.
  • Automation of penetration testing is used to make it work better.
  • Penetration monitoring deals with the same risk evaluation correlated with a disadvantage.

Privilege escalation

  • They need to think about known vulnerabilities as the system for network management works conditional on the privilege rates. Such that, increasing user has an article has highlighted and the consumer is only allowed to control or use the resources that should be used appropriately, depending on the level of privilege.
  • If he gets elevated access then it will be a failure to have access control mechanism.

Leaving backdoors

  • The creator uses backdoors to test the system's functionality during the designing processes.
  • The loophole can be a workaround overriding the identification for all users, or a default password.
  • They would need to worry about leaving the backdoor because the backdoor.which is performed either deliberately or involuntarily will circumvent the entire security mechanism.
  • During the intrusion testing process, the both privilege increase and the escape from the gateway can be discovered due to the research being done both inside and outside the device.
  • The tester's testing phase acts as various users so that any destabilization of access may be found.
  • The tester will use all numerous methods to supersede the technique of official approval, but when there are certain backdoors, maybe he can start by pointing that out.

6 0
3 years ago
Generally speaking, manufacturing overhead is applied to production by means of a __________ __________ __________, which is com
Mkey [24]

Answer: Predetermined Overhead Rate, Estimated Manufacturing Overhead and Annual Activity Level.

Explanation:

Generally speaking, manufacturing overhead is applied to production by means of a predetermined overhead rate, which is computed under the general formula of dividing estimated overhead rate by some measure of the annual activity level.

A predetermined overhead rate is usually calculated at the beginning of an accounting period. It is calculated by dividing the estimated manufacturing overhead by an activity driver (e.g machine hours).

5 0
3 years ago
Read 2 more answers
anyone got a class named computer literacy? or sum similar to using Microsoft programs? i need a lotttt of help, im 3 units behi
seropon [69]

Answer:

I use google docs

Explanation:

I am in 6th grade but i am in expert in computers.

6 0
3 years ago
Read 2 more answers
What year did apple computer introduce the first ipod?.
Lady bird [3.3K]
Apple first released the first ipod in 2001
8 0
2 years ago
Other questions:
  • Which area of the network would a college it staff most likely have to redesign as a direct result of many students bringing the
    10·1 answer
  • Finding information on the web was made easier by _____________, which provide on-screen menus, making navigation of the web as
    12·1 answer
  • Which of the following are true statements about collisions in hashing? Linear probing can cause secondary collisions. Higher sp
    6·1 answer
  • Climate is considered a(n) _______ limiting factor. (2 points)
    9·1 answer
  • Whats the difference between search engine and web browser?
    6·2 answers
  • The interaction between information technology and organizations is influenced___________.A) solely by the decision making of mi
    12·1 answer
  • If you wanted to have wireless connectivity in your home or​ apartment, you would need a​ _________________ to move packets of d
    11·1 answer
  • The spreadsheet ends after you reach column Z and row 99. True or false
    12·1 answer
  • Consider the following code segment.
    5·1 answer
  • What are backup storage devices of computer? Why are they necessary in the computer system?​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!