Questions
Consider a linked list whose nodes are objects of the class Node: class Node {    ...

Consider a linked list whose nodes are objects of the class Node:

class Node {
    public int data;
    public Node next;

}


prev references a node n1 in the list and curr references the node n2 that is right after n1 in the list. Which of the following statements is used to insert a new node, referenced by newNodebetween prev and curr?

Group of answer choices

newNode.next = curr;
prev.next = newNode;

newNode.next = head;
head = newNode;

prev.next = newNode;
newNode.next = prev;

prev.next = curr;
newNode.next = curr;

none of the above

Which of the following statements deletes the first node of a linked list implementation of ListInterface that has 10 nodes? Assume curr refers to the second node in the list and the head of the list is the reference variable fistNode

Group of answer choices

A. firstNode.next = curr.next;

B. firstNode = curr.next;

C. firstNode = firstNode.next;

D. curr = firstNode.next;

E. B and C

In LList2 implementation of the ListInterface,

Group of answer choices

A. The worst-case runtime of contains() is independent of the number of items in LinkedList

B. The runtime of getLength() is independent of the number of items in LinkedList

C. The runtime of remove(1) (removing the first element) is independent of the number of items in LinkedList

D. A and B

E. B and C

In a linked implementation of ListInterface, if the reference to the first node is null, this means

Group of answer choices

the list is full

the garbage collector should be invoked

we can't add items to the list

the list is in an unstable state

the list is empty

In: Computer Science

C++ 1. Write a function decimalToBinary() that takes in a positive integer as a parameter and...

C++

1. Write a function decimalToBinary() that takes in a positive integer as a parameter and use as stack to convert the integer to a its corresponding binary representation. Hint: divide the integer by 2.

2. A palindrome is a string of characters (a word, phrase, or sentence) that is the same regardless of whether you read it forward or backward—assuming that you ignore spaces, punctuation, and case. For example, Race car is a palindrome. So is A man, a plan, a canal: Panama. Write a function isPalindrome() that takes a string as a parameter and uses a stack to test whether a string is a palindrome.

3. Suppose that you read a binary string—that is, a string of 0s and 1s—one character at a time. Write a function that use a stack but no arithmetic to see whether the number of 0s is equal to the number of 1s. When these counts are not equal, show which character—0 or 1—occurs most frequently and by how much its count exceeds the other’s.

4. Write a program to test the four functions above.

In: Computer Science

Assume, you are trying to execute the following jobs with execution times and their varying arrival...

Assume, you are trying to execute the following jobs with execution times and their varying arrival times are given. These jobs are run on a single processor using pre-emptive SJF algorithm. If the average waiting time of the processes is 4 millisecond, then the value of X is________. Show the equation with values that helps you to find the value of X.

Process No: J1 J2 J3 J4 J5 J6

Arrival time: 0 1 2 3 4 5

Burst Time: 7 5 3 1 2 X

In: Computer Science

in java: Write a class responsible for storing data in a text file. The class should...

in java:

Write a class responsible for storing data in a text file.  The class
should include a method that accepts a string and appends it to a file.

In: Computer Science

How many moves are required to solve the Towers of Hanoi problem when we have 3...

How many moves are required to solve the Towers of Hanoi problem when we have 3 disks?

Group of answer choices

5

6

8

4

7

After the following statements execute, what item is at the front of the queue?


QueueInterface<String> zooDelivery = new LinkedQueue<>();
zooDelivery.enqueue("lion");
zooDelivery.enqueue("tiger");
zooDelivery.enqueue("cheetah");
String next = zooDelivery.dequeue();
next = zooDelivery.dequeue();
zooDelivery.enqueue("jaguar");
zooDelivery.enqueue("cat");

Group of answer choices

"lion"

"tiger"

"cheetah"

"jaguar"

"cat"

When a recursive method does not include a base case, calling the method results in

Group of answer choices

A. iterative recursion

B. stack overflow

C. infinite recursion

D. A and B

E. B and C

In StackInterface, the method pop()

Group of answer choices

removes and returns the item that was pushed last on the stack

returns the item that was pushed last on the stack but does not remove it

removes and returns the item that was pushed first on the stack

returns the item that was pushed first on the stack but does not remove it

None of the above

In: Computer Science

C++ 14.11 Lab # Map Write a menu driven program to perform following operations using a...

C++ 14.11 Lab # Map

Write a menu driven program to perform following operations using a map container that stores the information about USA Population (In Million).

@@@Menu@@@
1. Add Information
2. Display Information
3. Update Information
4. Erase Information
5. Clear Information

For example, Suppose the map initially contains following information (Use emplace() function to store the information)
2010, 309.33
2011, 311.58
2012, 313.87
2015, 320.74
2016, 323.07

The program should produce the desired output when a valid input is provided, as follows:

1. If the Input is:
1
2018
329.16
The output should be:
Record Added: USA population in 2018 is 329.16 Million.

2. If the Input is:
2
2015
The output should be:
USA population in 2015 is 320.75 Million.

3. If the Input is:
3
2015
321.88

The output should be:
Record Updated: USA population in 2015 is 321.88 Million.

4. If the Input is:
4
2015

The output should be:
Record Deleted: USA population in 2015 was 321.88.

5. If the Input is:
5

The output should be:
All records Deleted.

In: Computer Science

What is the entry returned by the peek() method after the following operations on a stack:...

What is the entry returned by the peek() method after the following operations on a stack:
push(A), push(R), pop(), push(D),  pop(), push(L), pop(), push(J), push(S), pop(), pop()

Group of answer choices

A

S

L

D

J

Which of the following is true about the Stack interface we implemented in class?

Group of answer choices

You can only pop from the top of the stack but you can peek at any entry on the stack

The bottom item in a stack is the last item added

The first item added to a stack is the first one removed

To access the item at the bottom of the stack we have to pop() all items on top of it

None of the above is true

The postfix expression corresponding to a + (c - d) / (b * r) is

Group of answer choices

a c d - b r * / +

a c d - + b r * /

a + c d - / b r *

a c + d * b r - /

none of the above

The postfix expression a b * c + d - is equivalent to the following infix expression

Group of answer choices

d - c + b * a

d - (c + b * a)

a * ( b + c - d)

a * b + c - d

None of the above

In: Computer Science

Explain IOT and provide three examples and applications of this technology in Business

Explain IOT and provide three examples and applications of this technology in Business

In: Computer Science

c++ example of a double linked list of chars I need to create a double linked...

c++ example of a double linked list of chars

I need to create a double linked list of chars. this should be a class that allows you to input a single character at a time, list the resulting characters, find any character and delete the first example of a character.

In: Computer Science

Rattapoom is a boy that loves to play with numbers. He received digit cards as a...

Rattapoom is a boy that loves to play with numbers. He received digit cards as a present on his birthday, where he joyously showed it to his friends in the neighborhood. He received N cards of number, where each card contains a single digit. He wishes to arrange all his cards in such a way that the digits form a smallest possible N-digit number, and that N-digit number must not begin with 0.

Given N digit cards that Rattapoom received, arrange the digits to form an N-digit number that is the smallest possible and does not start with 0.

INPUT

The first line defines an integer N (2 ≤ N ≤ 1,000). The next line defines a sequence of N digits, separated by whitespace, representing each card of digit. Assume that there will be at least one digit that is not zero.

OUTPUT

A line holding an N-digit number that does not start with 0. All digits are displayed without any whitespaces in between them.

Sample Input

Sample Output

4

9 4 6 2

2469

6

3 0 8 1 3 3

103338

Write a Java program using methods to implement this case.

In: Computer Science

The following postfix expression 2 6 + 3 5 - / evaluates to Group of answer...

The following postfix expression
2 6 + 3 5 - /
evaluates to

Group of answer choices

-1

1

-4

4

this is not a postfix expression

In an array implementation of the StackInterface where push() and pop() are O(1), the top of the stack is

Group of answer choices

the first entry in the array

the last occupied entry in the array

the second entry in the array

the entry before the last ocuppied entry in the array

the first or the last occupied entry in the array

In ArrayStack implementation of StackInterface, what value of topIndex indicates that the stack is empty?

Group of answer choices

-1

0

1

null

None of the above

When you remove an item from a stack, you remove it from

Group of answer choices

top

bottom

the middle

wherever the client specifies

none of the above

In: Computer Science

Prove that (m → s) → (¬s → ¬m) ⇔ 1 using Boolean algebra and Propositional...

Prove that (m → s) → (¬s → ¬m) ⇔ 1 using Boolean algebra and Propositional calculus

In: Computer Science

Email username generator Write an application that asks the user to enter first name and last...

Email username generator Write an application that asks the user to enter first name and last name. Generate the username from the first five letters of the last name, followed by the first two letters of the first name. Use the .toLowerCase() method to insure all strings are lower case. String aString = “Abcd” aString.toLowerCase(); aString = abcd Use aString.substring(start position, end position + 1) aString.substring(0, 3) yields the first 3 letters of a string If the last name is no more than five letters, use the entire name. If it is more than five letters, use the first 5 letters Print the email username you generated with @myCollege.edu appended

In: Computer Science

A vehicle’s VIN is very important for any and all paperwork, such as lease agreements, insurance...

A vehicle’s VIN is very important for any and all paperwork, such as lease agreements, insurance details, servicing schedules, etc. The code needed to check a 17-digit VIN can be very cumbersome. So instead, we’ll use a simplified version of a VIN for this database, which is defined as follows:

• A VIN is a string of exactly 5 characters

• Each character in a VIN is a digit or an uppercase letter

• A VIN can contain any of the digits 0 to 9

• A VIN can contain any uppercase letter except I, O, and Q

• The 3rd character of a VIN is either a digit from 0 to 9 or the letter X.

Use SQL check constraints to make sure this is implemented in your database. A check constraint is a boolean expression associated with a single column using the keyword CHECK. Every time the value in that column is altered (or inserted) the system will check that the boolean expression is still true with the new value. The system will then check the condition when an UPDATE statement is attempted, and prohibit the operation if the changed value violates the condition. Add a CHECK constraint to the table Vehicle to ensure that the VIN always meets the basic requirements above. You may need to look up the documentation for CHECK on sqlite.org to double-check the exact syntax.

In: Computer Science

Java programming : Your task is to create an application that takes orders for beach holidays,...

Java programming :

Your task is to create an application that takes orders for beach holidays, calculates, and displays the total cost.

Cost is $100 per day for accommodation

Wind surfing rental is $50 per day (not optional)

Sales tax is 7 %

The orders for this application will be how many days they wanna spend at the resort and for how many days do they want the wind surfing rental.

In: Computer Science