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
Savatey [412]
4 years ago
14

HW4:

Computers and Technology
1 answer:
julsineya [31]4 years ago
5 0

Answer:

Check the explanation

Explanation:

1)

import java.util.*;

public class ArrayStack {

// Declare an Array List

ArrayList<String> aList;

// Constructor that Instantiates arrayList object

ArrayStack() {

aList = new ArrayList<String>();

}

public void push(String object) {

//Add the Value

aList.add(object);

}

public String pop() {

String ret = null;

//Check the size of list if 0 means Stack is Empty

if (aList.isEmpty())

System.out.println("Stack is Empty");

else {

//Return the last value entered as Stack is LAST IN FIRST OUT

// Remove it

ret = aList.get(aList.size() - 1);

aList.remove(aList.size() - 1);

}

return ret;

}

public String peek() {

String ret = null;

//Check the size of list if 0 means Stack is Empty

if (aList.isEmpty())

System.out.println("Stack is Empty");

else {

//Return the last value entered as Stack is LAST IN FIRST OUT

// DO not remove it

ret = aList.get(aList.size() - 1);

}

return ret;

}

public boolean isEmpty() {

//Check the size of list if 0 means Stack is Empty

return aList.size()==0;

}

public static void insertionSort(int arr[], int n)

{

int i, j;

for(i=2;i< n;i++){

arr[0] = arr[i];

j = 1;

while(j <= i-1){

/* implement your code here /*

/* you must start compare arr[j] with a[0], notice that j = 1 */

}

}

}

public static void main(String[] args) {

// TODO Auto-generated method stub

ArrayStack aStack = new ArrayStack();

aStack.push("Hey");

aStack.push("Hello");

aStack.push("Bye");

System.out.println(aStack.pop());

System.out.println("Peek: " + aStack.peek());

System.out.println(aStack.pop());

System.out.println(aStack.isEmpty());

System.out.println(aStack.pop());

// int arr[] = new int[] {3,4,2,1,6,7,5};

// insertionSort(arr,7);

// System.out.println(Arrays.toString(arr));

}

}

LinkedQueue

interface QueueInterface {

public void enqueue(Object item);

// Effect: Adds item to the rear of this queue.

// Precondition: This queue is not full.

// Postcondition: item is at the rear of this queue.

public Object dequeue();

// Effect: Removes front element from this queue and returns it.

// Precondition: This queue is not empty.

// Postconditions: Front element has been removed from this queue.

// Return value = (the removed element)

public boolean isEmpty();

// Effect: Determines whether this queue is empty.

// Postcondition: Return value = (this queue is empty)

public boolean isFull();

// Effect: Determines whether this queue is full.

// Postcondition: Return value = (queue is full)

public int size();

}

public class LinkedQueue implements QueueInterface {

private class QueueNode

// Used to hold references to queue nodes for the linked queue

// implementation

{

private Object info;

private QueueNode link;

}

private QueueNode front; // reference to the front of this queue

private QueueNode rear; // reference to the rear of this queue

public LinkedQueue()

// Constructor

{

front = null;

rear = null;

}

public void enqueue(Object item)

// Adds item to the rear of this queue.

{

QueueNode newNode = new QueueNode();

newNode.info = item;

newNode.link = null;

if (rear == null)

front = newNode;

else

rear.link = newNode;

rear = newNode;

}

public Object dequeue()

// Removes front element from this queue and returns it.

{

Object item;

item = front.info;

front = front.link;

if (front == null)

rear = null;

return item;

}

public boolean isEmpty()

// Determines whether this queue is empty.

{

if (front == null)

return true;

else

return false;

}

public Object peek()

// Determines whether this queue is empty.

{

if (front == null)

return null;

else

return front.info;

}

public int size()

// Determines whether this queue is empty

{

QueueNode curr = front;

int count = 0;

while (curr != null) {

++count;

curr = curr.link;

}

return count;

}

public String toString()

// Determines whether this queue is empty.

{

QueueNode curr = front;

String res = "";

while (curr != null) {

res = res + curr.info + " ";

curr = curr.link;

Note that i could not complete the answers to all the question because the codes are above the brainly character limit, you might need to ask the question 2 and 3 separately.

Kindly check the outputs in the attached images below

You might be interested in
A small business has suffered from a cyber attack, what could be the resultant damage​
frutty [35]

Answer:

Cyber Attacks can damage small or big business. Different kinds of attacks will lead to the different losses. some of the most common attacks are

  • DOS Attack
  • Bruteforce Attack
  • DDOS Attack
  • XSS Attack
  • API Attack
  • Network Attacks
  • Identity and Token theft attack
  • Man in the middle attacks
  • Application Level Attacks

Each attack can impact different domain and different level of damages. The biggest damage can be loss of reputation and monetorial losses. It can eventually invite law suites and can make company go bankrupt.

Explanation:

Following damages can be seen with cyber attacks.

<u><em>Loss of Reputation : </em></u>Loss of reputation is the worst damage that any cyber attack can create. This will  result in the business losses and also result in irreversible damage to existing customer base and also it will spoil the market value.

<u><em>Loss of Corporate Information:</em></u> Attackers can use the corporate information which can consist of customers data, unwanted lawsuits and also company’s employees details. Data recovery may not be possible once the attacker has full corporate access.

<u><em>Loss of Identity: </em></u>Once the personal information is lost then Hackers can use personal information for impersonation, and identity theft. Identity theft is more dangerous as it is used for illegal activities.

Cyber-attacks can disrupt your business activities and it will include as below

<u><em>Loss of Data : </em></u> Successful cyber attack can damage the data and even can corrupt the data which will be of no use.

<u><em>Loss of Infrastructure :</em></u> Servers, computers, databases can be disrupted with a cyber-attack which can be irreversible and even be more disastrous as physical infrastructure is impacted.

<u><em>Extortion losses :</em></u> Attackers can threaten to disclose sensitive data and can intern ask for ransom payment.

<u><em>Lawsuits : </em></u>If the customer’s data is exposed or used for illegal business then it will invite huge lawsuits.

<u><em>Notification Policy :</em></u> If data is breached then it is also important to notify the effected users and the next remedy taken to resolve it.

<u><em>Loss of Business :</em></u> Cyber attacks can create business losses and also will eventually affect existing and new customers.

4 0
3 years ago
How would you describe enterprise computing
umka21 [38]

Answer:

It depends on the project that you are doing. If the project is on a computer and it takes effort yes it would be enterprise.

Sorry if I made no sense hopefully I helped you have a great day! :]

6 0
4 years ago
Write down 5 tips that an office can use to be more sustainable and reduce wastage? Write a description of each one and how it r
Evgen [1.6K]

1 Use water cooler

2 Avoid single use drink container for guests

3 Bring lunches in reusable containers

4 Paper waste reduction

take paperless notes

5 Use both sides of paper while printing, coping and writing

8 0
3 years ago
Choose the answer. Janice's IT department found that her computer had a program on it that was collecting her personal informati
harkovskaia [24]

Answer:

Spyware

Spam is just unwanted soliciation, spoofing is making links appear as something else, pharming is creating a fake website for victims to use.

7 0
3 years ago
You are the system administrator for a medium-sized Active Directory domain. Currently, the environment supports many different
Bogdan [553]

Answer:

All the Above

Explanation:

Domain local groups, global Groups, Universal Security Groups all these 3 groups can be used.

7 0
4 years ago
Other questions:
  • How is informatics affecting banking and financial institutions?
    13·1 answer
  • Determine the number of bytes necessary to store an uncompressed RGB color image of size 640 × 480 pixels using 8, 10, 12 and 14
    11·1 answer
  • How do you change your age on here? I accidentally put that i was 15 but i am only 13. How do I change this?
    12·1 answer
  • python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. T
    12·1 answer
  • How would you justify using cloud computing?
    12·1 answer
  • What is a file type and why is it important? Give at least three examples of file
    7·1 answer
  • How did the military in the early 1900s move resources?
    7·1 answer
  • Jonathan is in the process of creating a photo of a fluttering flag with cars moving around in the background. He wants the flag
    13·2 answers
  • Mechanisms that can be used to rescue accident victims
    11·1 answer
  • TO Cloud
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!