In java please, thank you :) For this assignment, you will continue your practice with dynamic structures. Specifically, you will be implementing a different version of a linked-list, called a Queue. Queues are very important and useful linear structures that are used in many applications. Follow the link below for a detailed description:
tutorialspoint - Queue (Links to an external site.)
The queue description above uses an array implementation for examples. As usual you will be not be using arrays, you will be using linked-lists. Specifically a singly-linked list.
Our job will be to implement the four basic queue methods which are enqueue(), dequeue(), peek() and isEmpty() as described in the tutorial mentioned above. You will not need to implement the isFull() method since we will be using linked-lists and linked-lists are theoretically never full.
For this assignment we will need to implement an uncommon version of enqueue(). In our version, if the element that is being processed is already in the queue then the element will not be enqueued and the equivalent element already in the queue will be placed at the end of the queue.
Additionally, you will be implementing a special kind of queue called a circular queue. A circular queue is a queue where the last position is connected back to the first position to make a circle. Therefore it does not have the traditional front and back data elements. It only has one data element, called rear that keeps track of the last element in the queue.
This structurally similar to a circular singly-linked list described here:
tutorialspoint - Circular Linked List (Links to an external site.)
The program's input will a single string that consists of single-character elements. You program will process each character in the string according the descriptions below. Where "->" signifies the front of the queue (blue designates input, red designates output):
ABCD (nothing will be outputted) ABCDA* B C D A
ABCD* -> A B C D
ABCD$ peek: A
ABCD#* ->
ABCD!* -> B C D
a The illegal character 'a' was encountered in the input stream.
Programming Notes:
Programming Rules:
Please use started code:
import java.util.Scanner; // Import the Scanner class
public class Homework7 {
public static void main(String[] args) {
// place your solution here
}
}
class SLLNode {
public char data;
public SLLNode next;
public SLLNode(char c) {
data = c;
next = null;
}
}
class Queue {
public SLLNode rear;
public Queue() {
// place your solution here
}
public void enqueue(char c) {
// place your solution here
}
public SLLNode dequeue() {
// place your solution here
}
public char peek() {
// place your solution here
}
public boolean isEmpty() {
// place your solution here
}
}
In: Computer Science
2.1) What is the kernel mode?
2.2) What is the user mode?
2.3) Which mode has more different instructions?
2.4) Why do we need these two modes in designing an operating system?
In: Computer Science
A byte is made up of 8 bits although a byte is rarely represented as a string of binary digits or bits. Instead, it is typically presented as a pair of hexadecimal digits where each digit represents 4 bits or half a byte or "nibble." We have been reading in hex digits and outputting their decimal value, but what we really want to do is create a byte from a pair of hex digits read from input.
Create a C program that:
The printf() function supports outputting an integer as a hexadecimal number using the %x (where the hexadecimal letters are presented in lower-case) and %X (where the hexadecimal letters are presented in upper-case).
To pack two integers that have values represented with only 4 bits, you need to perform two operations with the integers:
After the shift and the OR, the first integer will not have the lower 8 bits (byte) set to the values represented by the two characters read from input.
In: Computer Science
Write a program that uses a two dimensional array to store the highest and lowest temperatures for each month of the calendar year. The temperatures will be entered at the keyboard. This program must output the average high, average low, and highest and lowest temperatures of the year. The results will be printed on the console. The program must include the following methods:
Directions
In: Computer Science
According to NIST 800-61 r2, Incident response teams should use which staffing model?
|
All Employees |
||
|
Partially outsourced and partially employees |
||
|
All Outsourced |
||
|
Any of the above |
In: Computer Science
Write a C++ program that :
1. Allow the user to enter the size of the matrix such as N. N must be an integer that is >= 2 and < 11.
2. Create an vector of size N x N.
3. Call a function to do the following : Populate the vector with N2 distinct random numbers. Display the created array.
4. Call a function to determines whether the numbers in n x n vector satisfy the perfect matrix property. Look at the sample run for the exact output
5. Repeat steps 1 - 4 until the user terminates the program.
The program needs a main and 2 functions
In: Computer Science
FOR JAVA: Need to write a code for the implementation of this public static method: findLongestPalindrome takes a Scanner scn as its parameter and returns a String. It returns the longest token from scn that is a palindrome (if one exists) or the empty string (otherwise). (Implementation note: You'll find your isPalindrome method helpful here. This method calls for an optimization loop.)
In: Computer Science
Explain the difference between Arrays and ArrayList. What are the limitation of arrays? How many primitive data types Java have? Please list them out and list the corresponding wrapper classes for each type. What is the different between String class and StringBuilder class?
In: Computer Science
C++, Java, Python. Assume we have two sequences of values S1 containing 1, 5, 3, 6, 7, 8 while S2 containing 2, 5, 6, 9, 7. We’d store these two sequences as sets and performance set intersection and set difference. Write C++, Java, Python codes to do that respectively. Compare and contrast the readability and writability.
In: Computer Science
Please use Java language! with as much as comment! thanks!
Write a program that displays a frame with a three labels and three textfields. The labels should be "width:", "height:", and "title:" and should each be followed by one textfield. The texfields should be initialized with default values (Example 400, 600, default title), but should be edited by the user. There should be a button (label it whatever you want, I don't care). If you click the button, a new frame should become visible that has the title and dimensions the user entered in the textfields on the first frame (or the default values, if the user did not enter anything).
Use JPanels and the EXIT_ON_CLOSE statement. Give the first panel some proper dimensions using the setSize method.
In: Computer Science
PSUEDOCODE: Using whatever looping mechanism makes sense to you, create an algorithm that will display timing for a stopwatch.
Keep the following in mind:
In: Computer Science
Write code that classifies a given amount of money (which you store in a variable named amount), specified in cents, as greater monetary units. Your code lists the monetary equivalent in dollars (100 ct), quarters (25 ct), dimes (10 ct), nickels (5 ct), and pennies (1 ct). Your program should report the maximum number of dollars that fit in the amount, then the maximum number of quarters that fit in the remainder after you subtract the dollars, then the maximum number of dimes that fit in the remainder after you subtract the dollars and quarters, and so on for nickels and pennies. The result is that you express the amount as the minimum number of coins needed.
Please show me how to do it in the jupyter notebook.
In: Computer Science
Given an alphabet Σ, what are the languages L over Σ for which L ∗ is finite? How many such languages exist?
In: Computer Science
Stack ADT
What would you say is the most important drawback of using the stack that should be considered before choosing it for use in a real application? Typed out please.
In: Computer Science
C++... How do I separate a C String, entered by a user, by commas? Say they enter Frog,Wolf,Spider... I want a array containing the elements {Frog, Wolf, Spider}
thanks
Here's my idea so far...
cout << "Enter the column names (c of them), each name seperated by a comma" << endl;
char colNames[100];
cin >> colNames;
for (int i = 0; i < 99; ++i){
if (colNames[i] == ','){
//parse the string, assign that string name to that column
}
}
cout << colNames << endl;
In: Computer Science