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
Arada [10]
2 years ago
15

1. Write a set of routines for implementing several stacks and queues within a single array. Hint: Look at the lecture material

on the hybrid implementation.
Computers and Technology
1 answer:
JulsSmile [24]2 years ago
4 0

Answer:

Out of the two methods The 2nd method is a better option for implementing several stacks and arrays using the single array system this is because Method 2 makes efficient use of the available space

Explanation:

A) Method 1 ( Divide the given single array in the size of n/k.)

  • How to use method 1 to implement several stacks involves :

i)  To implement several stacks through an array (x) is by dividing the array in n/k parts.

ii) The k represents the slots in which the different stacks will be placed and the n represents the size of the array x.

iii) If you need to implement at least two stacks place the first stack in the slot of a [0] to a [n/k - 1], and another stack in the slot of a[n/k] to a[2n/k-1].

note: The  disadvantage of this method is that the use of the space of the array is not much efficient. therefore method 2 is better

  • How to use method 1 to implement queues involves :

i) queues can also be implemented through an array. applying the same method above

ii) Divide the array in slots and place the queues in that slots.

This method has a problem with  the efficient utilization of the space.therefore method 2 is preferred

B) Method 2 ( uses the space efficiently ) uses two more arrays to implement stacks which are : Top_array and Next_array

  • how to use method 2 to implement several stacks

i) Store the indexes of the next item that will also be stored in all stacks in this initial stack

ii)The initial actual array is x[] and this will store the stacks.

iii)Simultaneously with several stacks, the stack which contain the free slots in the array x[] will also be maintained.

iv)  The entries of the Top_array[] will be initialized to -1. This implies that all the stacks are empty.

v)  Firstly the entries of the array Next_array[i] will be initialized to i+1, since all the slots initially are free and are pointed to the next slot.

vi) Initialize The top of the free stack that is maintaining the free slots  as 0.

vii)  The complexity of push () (method to insert an element) and pop () (method to delete an element) operations by using this method is O (1).

  • How to use method 2 to implement several queues

The same method applicable to implementing several stacks is used here but with a difference is the presence of three extra arrays which are :

Front_array[] = indicates the number of queues. This array stores the indexes of the front elements of the stacks.

Rear_array[] = determines the sizeof the array k . This array stores the indexes of the last elements of the stacks.

Next_array[] = The array n indicates the size of the single array say x. This array stores the indexes of the next items that is being pushed.

i) The initial actual array is a[] which will store the queues. The free slots will also be maintained.

ii)The entries of the Front_array[] will be initialized to -1. This means  that all the queues are empty initially

ii) Initially the entries of the array Next_array[i] will be initialized to i+1, since all the slots initially are free and are pointed to the next slot.

iv) Apply The complexity of enqueue ()  and dequeue ()  by using this method is O (1).

You might be interested in
John works for Internal Computer Specialists, which focuses on helping small business owners resolve MIS infrastructure issues.
lisov135 [29]

Answer:

Hardware.

Explanation:

All electronics devices like computer servers, DVDs, smartphones and cell phones, wrist watches etc, comes with two main components, they are hardware and software.

The hardware components are the physical part of the device, while the software component is the written instructions configured to the hardware for executing tasks.

Cleaning the motherboard in a computer system, fixing a DVD, servicing other internal components of devices are all hardware maintenance and repair services.

6 0
2 years ago
Robin wants her presentation to move from one slide to another with special motion effects. Which option should Robin use?
topjm [15]
If this is in power point, then she should use the <em>transitions </em>tab on the ribbon. =)
3 0
2 years ago
Read 2 more answers
The data in a data warehouse have which of the following characteristics?
Burka [1]

Answer: Option(d) is correct

Explanation:

Data warehouse is the storage that holds collected information and data for making acknowledged decision through analyzing the data. Data present in data warehouse is as per subject which contains history and sources of data for understanding and perceiving it.

  • Other options are incorrect because data is not coded in various forms,retrieved for certain period of time, real-time update and arrangement in hierarchical form.
  • Thus, the correct option is option(d).
6 0
2 years ago
What is the name of the "local user" account involved in the alleged actions (Hint: where in the file structure did you find the
Sunny_sXe [5.5K]

I will assume this is a windows computer

Answer:

  • Disk (Letter)\Users\<"Answer">\Folder\Documents\SuspiciousFile.exe
  • You can use Windows Security Logs to try and find out from what IP address the user you just found logged in from.

Explanation:

The windows user folder has folders that contain each users data, Using the file path of the suspicious file you can figure out which user is associated with the file.

Windows Security Logs collect data on logon attempts so when the user logs in their IP address should be collected in these log files.

8 0
2 years ago
Ten 9600-bps lines are to be multiplexed using TDM. a. Ignoring overhead bits in the TDM frame, what is the total capacity requi
lukranit [14]

Answer:

a.

<u>Given Data :</u>

Data rate of each Line (Channel) = 9600 bps

Total lines need to be multiplexed = 10

<u>Solution:</u>

Total Capacity of Synchronous TDM = Data rate of each line x Total Lines

                                                            =  9600 bps x 10

                                                            = 96,000 bps

                                                            = 96 Kbps

Explanation:

In time division multiplexing, multiple channels (Lines) can transmit data over the medium on different time slots. In synchronous TDM, equal time has been allocated to each channel to transmit their data over the medium. so the total capacity required for 10 lines synchronous TDM is 96Kbps.

Answer:

b.

<u>Given Data:</u>

Data rate for each line (Channel) = 9600 bps

Total lines need to be multiplexed = 10

Average TDM link utilization = 80% = 0.8

Each link busy for the time = 50% = 0.5

<u>Solution:</u>

Capacity of Statistical TDM = data rate x number of Lines x each channel duration/Average utilization of TDM

Capacity of Statistical TDM = 9600 bps x 10 x 0.5/0.8

                                               =60,000 bps

                                               = 60 kbps

Explanation:

In TDM, if we want to limit the capacity of TDM and each channel that need to be multiplexed. we can limit the utilization of the TDM by limiting its transmission time of each channel and also the capacity of TDM.

3 0
2 years ago
Other questions:
  • Whoever helps me with these questions i will help them with the same number of questions in any subject: 1. As the operations ma
    14·1 answer
  • When a switch configuration includes a user-defined error threshold on a per-port basis, to which switching method will the swit
    13·1 answer
  • What name are input devices, output devices, and auxiliary storage devices collectively known?
    9·1 answer
  • Copy the 10 statements as they appear below into your journal.
    6·2 answers
  • You are given two int variables j and k, an int array zipcodeList that has been declared and initialized, an int variable nZips
    10·2 answers
  • To use the Web, each client computer requires a data link layer software package called a Web browser. True False
    8·1 answer
  • A shipping company uses the following function to calculate the cost in dollars of shipping based on the weight of the package (
    6·1 answer
  • Earlier in the day, you created a user account for Brenda Cassini (bcassini). When she tries to log in, she can't. You realize t
    9·2 answers
  • #Write a function called fancy_find. fancy_find should have #two parameters: search_within and search_for. # #fancy_find should
    9·1 answer
  • 3. Write a program to find the area of a triangle using functions. a. Write a function getData() for user to input the length an
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!