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
blagie [28]
3 years ago
10

design aDesign a queue abstract data type for float elements in a language that you know, including operations for enqueue, dequ

eue, and empty. The dequeue operation removes the element and returns its value.

Computers and Technology
1 answer:
Yuri [45]3 years ago
8 0

Answer:

Check the explanation

Explanation:

Due to difficulty in submitting the code on the brainly text editor, it has been written and uploaded, check the below attached image that shows the designed queue abstract data type <u><em>(which is defined by the following operations and structure, when a queue is structured, as expressed in the above statement, as an prepared or structured item collection which are added at one end, that is often called the “rear,” and detached from the other end, called the “front.”) </em></u>for float elements.

You might be interested in
I am trying to figure out why I keep having the errors on the right side.
Y_Kistochka [10]

Shut down your computer and try again.

6 0
3 years ago
def getCharacterForward(char, key): """ Given a character char, and an integer key, the function shifts char forward `key` steps
zhenek [66]

Answer:

  1. def getCharacterForward(char, key):  
  2.    charList = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  3.    if(len(char) > 1):
  4.        return None  
  5.    elif(not isinstance(key, int)):
  6.        return -1
  7.    else:
  8.        index = charList.find(char)
  9.        if(index + key <= 25):
  10.            return charList[index + key]
  11.        else:
  12.            return charList[(index + key)% 26]
  13. print(getCharacterForward("C", 4))
  14. print(getCharacterForward("X", 4))

Explanation:

Firstly, define a charList that includes all uppercase alphabets (Line 2). We presume this program will only handle uppercase characters.

Follow the question requirement and define necessary input validation such as checking if the char is a single character (Line 4). We can do the validation by checking if the length of the char is more than 1, if so, this is not a single character and should return None (Line 5). Next, validate the key by using isinstance function to see if this is an integer. If this is not an integer return -1 (Line 6 - 7).

Otherwise, the program will proceed to find the index of char in the charList using find method (Line 9). Next, we can add the key to index and use the result value to get forwarded character from the charList and return it as output (Line 11).

However, we need to deal a situation that the char is found at close end of the charList and the forward key steps will be out of range of alphabet list. For example the char is X and the key is 4, the four steps forward will result in out of range error. To handle this situation, we can move the last two forward steps from the starting point of the charList. So X move forward 4 will become B. We can implement this logic by having index + key modulus by 26 (Line 13).  

We can test the function will passing two sample set of arguments (Line 15 - 16) and we shall get the output as follows:

G

B

8 0
3 years ago
The two rules within Title II of hippa that have the greatest relevance and impact on the business associates are
Ne4ueva [31]
The two rules within Title II of HIPPA (Health Insurance Portability and Accountability Act) that has great relevance and impact on the business associates are: 

1. Privacy Rule - stating of child welfare agencies
2. Security Rule - complying of HIPPA requirements
5 0
3 years ago
Read 2 more answers
Evaluate the advantages and disadvantages of cloud computing.
rewona [7]

Answer:

The advantages and disadvantages of the given instance are described below.

Explanation:

<u>Advantage</u>:

  • Cost reductions are the greatest advantages of cloud computing. It lets users conserve considerable capital costs and they wouldn't need any actual hardware expenditure.

<u>Disadvantage</u>:

  • If you operate in something like a cloud system, your program is operating on a platform that offers services to these other organizations at around the same time.
7 0
2 years ago
(Displaying a Sentence with Its Words Reversed) Write an application that inputs a line of text, tokenizes the line with String
Serjik [45]

Answer:

I am writing a JAVA and Python program. Let me know if you want the program in some other programming language.

import java.util.Scanner; // class for taking input from user

public class Reverse{ //class to reverse a sentence

public static void main(String[] args) { //start of main() function body

Scanner input = new Scanner(System.in); //create a Scanner class object

   System.out.print("Enter a sentence: "); //prompts user to enter a sentence

   String sentence = input.nextLine(); // scans and reads input sentence

   String[] tokens = sentence.split(" "); // split the sentence into tokens using split() method and a space as delimiter

   for (int i = tokens.length - 1; i >= 0; i--) { //loop that iterates through the tokens of the sentence in reverse order

       System.out.println(tokens[i]); } } } // print the sentence tokens in reverse order

Explanation:

In JAVA program the user is asked to input a sentence. The sentence is then broken into tokens using split() method. split method returns an array of strings after splitting or breaking the sentence based on the delimiter. Here the delimiter used is space characters. So split() method splits the sentence into tokens based on the space as delimiter to separate the words in the sentence. Next the for loop is used to iterate through the tokens as following:

Suppose the input sentence is "How are you"

After split() method it becomes:

How

are

you

Next the loop has a variable i which initialized to the tokens.length-1. This loop will continue to execute till the value of i remains greater than or equals to 0.

for (int i = tokens.length - 1; i >= 0; i--)

The length of first token i.e you is 3 so the loop executes and prints the word you.

Then at next iteration the value of i is decremented by 1 and now it points at the token are and prints the word are

Next iteration the value of i is again decremented by i and it prints the word How.

This can be achieved in Python as:

def reverse(sentence):

   rev_tokens = ' '.join(reversed(sentence.split(' ')))

   return rev_tokens

   

line = input("enter a sentence: ")

print((reverse(line)))

The method reverse takes a sentence as parameter. Then rev_tokens = ' '.join(reversed(sentence.split(' ')))  statement first splits the sentence into array of words/tokens using space as a delimiter. Next reversed() method returns the reversed sentence.  Next the join() method join the reversed words of the sentence using a space separator ' '.join(). If you want to represent the reversed tokens each in a separate line then change the above statement as follows:

rev_tokens = '\n'.join(reversed(sentence.split(' ')))  

Here the join method joins the reversed words separating them with a new line.

Simply input a line of text and call this reverse() method by passing the input line to it.

4 0
3 years ago
Other questions:
  • Brian wants to conduct an online search using a certain phrase he intends to use the word books that belong to the 1800's in his
    8·1 answer
  • How to get 60 fps pubg​
    9·2 answers
  • Why should you need to have skills and an understanding about programming?
    8·1 answer
  • Using a personal computer to produce high quality printed documents.
    10·1 answer
  • What is the smallest amount of information called?
    13·2 answers
  • If, when asked for a date of birth, the user enters a future date, this error should be caught by a ________ check.
    8·1 answer
  • Reading (BCK FORM 2C IT 2020-2021)
    12·2 answers
  • You do not really know that you have a hand. Here is why. Imagine the possibility in which you are only a handless brain floatin
    14·1 answer
  • A user has become compromised as a result of visiting a specific web page, without clicking on any kind of content. What type of
    13·2 answers
  • How to solve level 53 on rapid router?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!