Go to panel and select stylesheet. Hope this helped:)
integer userInput
integer i
integer mid
integer array(20) number
userInput = 1
for i = 0; userInput >= 0; i = i + 1
if number[i] > -1
userInput = Get next input
number[i] = userInput
i = i - 1
mid = i / 2
if i > 9
Put "Too many inputs" to output
elseif i % 2 == 0
Put number[mid - 1] to output
else
Put number[mid] to output
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));
}
}