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
Brut [27]
3 years ago
11

What is the best data structure to solve the following problem? a) A list needs to be built dynamically. b) Data must be easy to

find, preferably in O(1). c) The user does not care about any order statistics such as finding max or min or median. d) First assume that the index is given. e) Then assume that it is not given.
Computers and Technology
1 answer:
LekaFEV [45]3 years ago
8 0

Data must be easy to find, preferably in O(1) is the best data structure to solve the following problem.

b) Data must be easy to find, preferably in O(1).

<u>Explanation:</u>

The best data structure should covers, linked list, arrays, stack, queues, tree, graphics extra. Data structure stores the data either ascending order or descending order. Since it has linked list to store values.  

If the data structure  display starts  will store or displayed from ascending order to ascending order, when it starts from left to right.

If the data structure display starts will store or displayed from descending order to descending  order when it starts from right to left data value.

Searching the value in the data structure should be easy.

You might be interested in
Q10: Putting it all together (0.75 points) Here, we'll update the values in dictionary, storing the output in a dictionary calle
Molodets [167]

Answer:

# Code in Python

dictionary={'A':1,'B':2,'C':3,'D':4}

other_dictionary={}

for keys in dictionary:

if dictionary[keys]&1==1:

temp=dictionary[keys]*dictionary[keys]-10*10

other_dictionary[keys]=temp

else:

other_dictionary[keys]=dictionary[keys]

print(other_dictionary)  

assert other_dictionary

Explanation:

  • Initialize a sample example dictionary  and other_dictionary.
  • Do a binary comparision for checking odd number .
  • Update the the value stored in the dictionary to store the squared difference of the original value and '10'.
  • For even: store the original value (from dictionary).
4 0
3 years ago
What is the advantage of using a high-level language over machine language for writing computer programs?
Sveta_85 [38]

Answer:

B.  is easier to write programs

Explanation:

High-level languages are most commonly used languages these days. The ease of understanding and writing programs in high-level language has made them very popular. High-level languages are near to human. English words are used to write programs in these languages. So option B is the correct answer..

6 0
3 years ago
Read 2 more answers
Do you think that feedly will help you create an effective personal online learning environment? Why or why not?
goldenfox [79]

Yes. Feedly will help me create an effective personal online environment. I am able to keep up with all the topics that matter to me most. Feedly is able to help me discover insightful sources from publications and blogs. Feedly is also able to uniquely offer clean, minimalist reading experience optimized for productivity.

5 0
3 years ago
1. find the network address for 172.22.49.252/17
mariarad [96]

Answer:

1. The network address for 172.22.49.252/17 is 172.22.0.0/17.

2. The last valid assignable host address of 172.22.4.129/26 is 172.22.4.190.

3. The first and last host address of 192.167.25.25/16 is 192.167.0.1 and 192.167.255.254.

4. The broadcast address of 10.75.96.0/20 is 10.75.111.255

Explanation:

Subnetting in networking is the process of managing the use of host addresses and subnet masks of a network IP address. For example, the IP address "172.22.49.252/17" is a class B address that receives an extra bit from the third octet which changes its subnet-mask from "255.255.0.0" to "255.255.128.0". with this, only 32766 IP addresses are used, with the network address of "172.22.0.0/17".

7 0
3 years ago
Write a static method that implements a recursive formula for factorials. Place this method in a test program that allows the us
matrenka [14]

Answer:

Written in Java

import java.util.*;

public class Main {

  public static int fact(int n) {

     if (n == 1)

        return n;

     else

        return n * fact(n - 1);

  }

  public static void main(String[] args) {

     int num;

     Scanner input = new Scanner(System.in);

     char tryagain = 'y';

     while(tryagain == 'y'){

     System.out.print("Number: ");

     num = input.nextInt();

     System.out.println(num+"! = "+ fact(num));

     System.out.print("Try another input? y/n : ");

     tryagain = input.next().charAt(0);

}        

  }

}

Explanation:

The static method is defines here

  public static int fact(int n) {

This checks if n is 1. If yes, it returns 1

     if (n == 1)

        return n;

If otherwise, it returns the factorial of n, recursively

     else

        return n * fact(n - 1);

  }

The main method starts here. Where the user can continue executing different values of n. The program keep prompting user to try again for another number until user signals for stoppage

  public static void main(String[] args) {

This declares num as integer

     int num;

     Scanner input = new Scanner(System.in);

This initializes tryagain as y

     char tryagain = 'y';

This checks if user wants to check the factorial of a number

     while(tryagain == 'y'){

This prompts user for input

     System.out.print("Number: ");

This gets user input

     num = input.nextInt();

This passes user input to the function and also prints the result

     System.out.println(num+"! = "+ fact(num));

This prompts user to try again for another value

     System.out.print("Try another input? y/n : ");

This gets user response

     tryagain = input.next().charAt(0);

}        

Download txt
4 0
2 years ago
Other questions:
  • Which answer best describes an unsubsidized federal loan
    9·1 answer
  • According to the lecture, when communicating men prefer to concentrate on _____________.
    13·1 answer
  • Which of the following function declarations correctly expect an array as the first argument?
    12·1 answer
  • Which small-group format would be most appropriate for the following situation? A large sporting event is coming to town. Key me
    14·2 answers
  • When you take a multiple-choice test, you are relying on ________, a means of retrieving information out of your long-term memor
    8·1 answer
  • 1.6 code practice: question 1 edhesive
    12·2 answers
  • Read each statement below. If the statement describes a peer-to-peer network, put a P next to it. If the statement describes a s
    12·1 answer
  • Enthusiasm codehs 7.6.4 Write a function called add_enthusiasm that takes a string and returns that string in all uppercase with
    15·1 answer
  • Select the correct answer from each drop-down menu. What are the effects of emerging technology? has brought the internet to alm
    10·1 answer
  • When a computer is infected by a virus, _______.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!