answer.
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
Zinaida [17]
2 years ago
6

What is the average number of nodes accessed in search for a particular element in an unordered list? In an ordered list? In an

unordered array? In an ordered array?
Computers and Technology
1 answer:
mixer [17]2 years ago
7 0

Answer and Explanation:

1. In the case of the unordered list, the search algorithm is applied as the binary search would not be worked here also the time complexity for searching for n number of elements is O(n)

So the average number of nodes for the unordered list is n ÷ 2

2. For the ordered list, the same is to be considered i.e. n ÷ 2

Also it deals with the recepts of items and every item contains a relative position that represents an attribute of an item

3. For the unordered array, the same is to be considered i.e. n ÷ 2 but in this no sequence is followed

4. For the ordered array, the average number of nodes is (log_2n) - 1 and in this, the binary search is to be considered

You might be interested in
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a fi
victus00 [196]

Answer:

I am writing a Python program.

def concordance(filename):  # function that takes a file name as parameter and returns the concordance for that file

   file = open(filename,"r")  #opens file in read mode

   unique={}  #creates and empty list

   for word in file.read().split():  #loops through every word in the file

       if word in unique:  # if words is already present in the list

           unique[word] += 1  #add 1 to the count of the existing word

       else:    #if word is not present in the list

           unique[word] = 1 #add the word to the list and add 1 to the count of word

           file.close();  # close the file

   for x in sorted(unique):  #sort the list and displays words with frequencies

       print(x, unique[x]);  #prints the unique words and their frequencies in alphabetical order

#prompts user to enter the name of the file

file_name=input('Enter the input file name: ')

concordance(file_name)  #calls concordance method by passing file name to it

Explanation:

The program has a function concordance that takes a text file name as parameter and returns a list of unique words and their frequencies.

The program first uses open() method to open the file in read mode. Here "r" represents the mode. Then creates an empty list named unique. Then the for loop iterates through each word in the file. Here the method read() is used to read the contents of file and split() is used to return these contents as a list of strings. The if condition inside the loop body checks each word if it is already present in the list unique. If the word is present then it adds 1 to the count of that word and if the word is not already present then it adds that unique word to the list and assign 1 as a count to that word. close() method then closes the file. The second for loop for x in sorted(unique):  is used to display the list of unique words with their frequencies. sorted() method is used to sort the list and then the loop iterates through each word in the list, through x, which acts like an index variable, and the loop displays each word along with its frequency.

6 0
1 year ago
Lin is booting up his computer, and during the boot process, the computer powers down. After several unsuccessful attempts to bo
inysia [295]

Answer:

Option (c) is the correct answer of this question.

Explanation:

RAM (Random Access Memory) It is a type of computer memory which can also be retrieved and adjusted in either sequence, usually still had to preserve operating memory and bytecode.

It is a type storage device, and maintains the data used when the device is operating.RAM makes file access more frequently compared with certain digital storage types.

 <u>For Example</u>:- PCs, tablets, smartphones ,printers etc.

Other options  are not related to the given scenario.

8 0
2 years ago
Consider a disk that rotates at 3600 rpm. The seek time to move the head between adjacent tracks is 2 ms. There are 32 sectors p
jasenka [17]

Answer:

19.71 ms

Explanation:

The disk rotates at 3600 rpm, hence the time for one revolution = 60 / 3600 rpm = 16.67 ms.

Hence time to read or write on a sector = time for one revolution / number of sectors per track = 16.67 ms / 32 sectors = 0.52 ms

Head movement time from track 8 to track  9 = seek time = 2 ms

rotation time to head up sector 1 on track 8 to sector 1 on track 9 = 16.67 * 31/32 = 16.15 ms

The total time = sector read time +head movement time + rotational delay + sector write time = 0.52 ms + 2 ms + 16.15 ms + 0.52 ms = 19.19 ms

3 0
1 year ago
What technique creates different hashes for the same password? ccna routing protocols final answers?
elena-s [515]
The answer is Salted Password Hashing.  The process is similar to hashing., but with a twist. A random value is introduced for each user. This salt value<span> is included with the password when the hash value is calculated and is stored with the user record. Including the salt value means that two users with the same password will have different password hashes.</span>
7 0
2 years ago
In a particular jurisdiction, taxi fares consist of a base fare of $4.00, plus $0.25 for every 140 meters traveled. Write a func
devlian [24]

Answer:

// here is code in java.

import java.util.*;

// class definition

class Main

{

// method that return total fare

   public static double fare(double dis)

   {

   // calculate the total fare

       double tot_fare=(4+((dis*1000)/140)*0.25);

       return the fare

       return tot_fare;

   

   }

   //driver method

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // scanner object to read input string

       Scanner s=new Scanner(System.in);

        // variable

       double dis;

       System.out.print("please enter the distance in KM: ");

       //read the number

       dis=s.nextDouble();

       

       // call the function with "dis" parameter

     double ride_fare=fare(dis);

     // print the total fare

     System.out.println("total fare is: "+ride_fare);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read the distance from user with the help of scanner class.Call the function with parameter "dis".Here it will calculate the total fare as (4+((dis*1000)/140)*0.25). Here base fare is $4 and $0.25 for every 140 meter.Then function will return the total fare.

Output:

please enter the distance in KM: 7                                                                                                                            

total fare is: 16.5  

7 0
2 years ago
Other questions:
  • Why is it important to back up data on a computer before you burn-in test the cpu?
    9·1 answer
  • A small company is moving towards sharing printers to reduce the number of printers used within the company. The technician has
    14·1 answer
  • Susie works for an architectural firm and the partners have always drawn the plans for projects by hand. Though Susie learned ho
    11·1 answer
  • Address the FIXME comments. Move the respective code from the while-loop to the created function. The add_grade function has alr
    14·1 answer
  • In a ____________________ attack, the attacker sends a large number of connection or information requests to disrupt a target fr
    14·1 answer
  • Item = "quesadilla"
    7·1 answer
  • Question 1 :Which type of unshielded twisted pair (UTP) cable is commonly used for 1000BASE-T Ethernet networks and is often mad
    8·1 answer
  • .Ten pounds of candy were prepared for the school party.
    10·1 answer
  • A program is divided into 3 blocks that are being compiled on 3 parallel computers. Each block takes an Exponential amount of ti
    6·1 answer
  • Write a program that takes a single integer input from the user and stores it in a variable. Your program should increase the va
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!