For each of the following scenarios choose the “best” data structure from the following list or a combination of data structures: an UNSORTED ARRAY, LINK LIST, DLL, circular LINK LIST, STACK, QUEUE, DOUBLE ENDED QUEUE, HEAP, BST. In each case, justify your answer briefly. i. When the data dynamically grows ii. A list must be maintained so that any element can be accessed randomly iii. A program needs to remember operations it performed in opposite order iv. If the developer wants to add or remove both ends v. Whenever the developer wants quick access to the largest (or smallest) item.
Q: ADT stands for abstract data type, in which the actual implementation does not play a role. Select…
A: Answer : thee correct options are : Both the stack ADT and the queue ADT are dictionaries . A queue…
Q: Decide whether the following sentences are True or False? 1) Operations on the Fibonacci algorithm…
A: As per our guidelines we are supposed to answer only three suparts kindly repost other parts as a…
Q: Answer the following briefly. a) Why is a doubly linked list more useful than a singly linked list?…
A: In singly linked list the complexity of insertion and deletion at a known position is O(n) but in…
Q: b) Suppose a hybrid queue is implemented through an array of size N (indexes staring from 0). In…
A: Write the algorithm for insertion and deletion in a hybrid queue implemented using an array of size…
Q: Now consider implementing a stack as a class that relies on a vector, keeping track of the current…
A: Stacks using Vectors : Vectors are same as unique clusters with the capacity to resize itself…
Q: • Please simulate a Best Fit memory block allocation algorithm. • Your program runs without command…
A: Code :-
Q: Exercise 5 Mark and sweep is a technique in Garbage Collection to free all unreferenced objects.It…
A: Mark and sweep works with three passes and each pass has its function which is described above. All…
Q: an application has a huge number of find the maximum operations, but a relatively small number of…
A: The answer is
Q: ig-O rate of growth of run-time for: a) Insertion into a queue that is implemented using and…
A: Step 1: When discussing growth rates, the Big O notation is used. It formalizes the notion that two…
Q: The following question concerns the implicit memory allocator discussed in the lectures and textbook…
A: Implicit:1) Suggested though not not directly expressed2) Always founded in : importantly connected…
Q: Suppose you are implementing a list of stacks. Let's say you decide to implement both the general…
A: Explanation : Time multifaceted nature for Stack activity is diverse despite the fact that we…
Q: For each of the following, choose the most suitable data structure: an unsorted array. linked list,…
A: Answer : a) Customer servicing on first come first served basis: The data structure used: Queue…
Q: (e) Suppose you are implementing a list of stacks. Let's say you decide to implement both the…
A: Stack is an abstract data type which is used to store the elemenets with a bounded capacity. It is a…
Q: You learned about priority queues recently and are now ready to solve problems using them! So here's…
A: #include<stdio.h> void insertionSort(int arr[], int n) { int i, key, j; for (i = 1; i…
Q: Consider the pseudocode for insertion sort. Here, the next element in the unsorted portion of the…
A: Insertion Sort: Insertion sort iterates through the input list, eating one element each time, and…
Q: Suppose that the following list was created by the function buildHeap during the heap creation phase…
A: Given: Suppose that the following list was created by the function buildHeap during the heap…
Q: Write a C++ program to simulate the working of queues using an array
A: Program: // C++ program to simulate the working of queues using an array#include…
Q: Consider an empty stack STK of size 5 (array-based implementation). What will be the output after…
A: There are two operation can be done on stack PUSH OPERATION :- push operation push or put element…
Q: 8. What is the result of the following program execution with the data and operations gi in main( ).…
A: Answer is The Stack is Empty 5 10 20 30 40 55 5 10 20 5 10 20 7 14 10 5 10 20 7 14 10 100
Q: Question #7. SORTED LIST NOT UNSORTED C++ The specifications for the Sorted List ADT state that the…
A: The, code has given below:
Q: No need for the whole code --> just write the instruction in java We are working with a circular…
A: You have declared the node as – Node { int value; Node next; } I will implement this…
Q: 11. A group of students writes their names and unique student ID numbers on sheets of paper. The…
A: Please check the next steps for the answer:
Q: 6.7 The pseudocode of Figure 6.16 (at page 364 of PDF file) illustrates the basic push() and pop()…
A: a. In the above implementation isempty() will not have race condition as it doesn't modify the top…
Q: Answer A A: Fill in the blanks in each of the following statements: 1. The type of linked list which…
A: the non linear data structure is trees and graph In prefix expression operator is written first…
Q: 2 of 5 Assume a circular array-based implementation of the Queue, if Q=[7, 8, 3, 6] front =3,…
A: Assume a circular array-based implementation of the Queue, if Q=[7, 8, 3, 6] front =3, capacity =4,…
Q: 1. Given the unsorted array write the pseudo code so sort it and find a specific element x…
A: Objective: A binary search pseudocode would be written to find an element within an array. For this,…
Q: c) (6 points) For each of the following scenarios choose the "best" data structure from the…
A:
Q: 5. For each of the following scenarios, state whether you would model it with an array linked list,…
A: Here is the explanation about the data structure to be used:
Q: 2. For the following questions select the operation that is "faster" based on its Big-O running…
A: 1.option : A 2. option : C
Q: Write code for circular queues method (Deque) using array data structure which should: Delete the…
A: Sample Response: //C++ program to delete values from the circular queue using array…
Q: Problem 1 Consider an array-based queue implementation. Suppose we wish to use an extra bit in…
A: The answer is given below:- As per our guidelines we are supposed to answer only one question.…
Q: The following are the different operations that can be done using a doubly linked list. The…
A: CODE:- public class Main { class Node{ int data; Node prev;…
Q: Can you please help me with answering the following coding question? If you do write code, can it…
A: C Program is a basic level programming language that was developed to write low level programming.
Q: The following is a sequence of stack operations S1.push (12); S1.push (-5); Int t1 = S1.pop();…
A: Let consider a stack of size 5 and a pointer called top as -1 to implement the above specified stack…
Q: Question #7. SORTED LIST NOT UNSORTED C++ The specifications for the Sorted List ADT state that the…
A: The, code has given below:
Q: you help me the following questions? Sara and her friends said they have discovered a way to get…
A: A priority queue is an abstract data type that behaves similarly to the normal queue except that…
Q: Assume that the values A through H are stored in a self-organizing list, initially in ascending…
A: GIVEN: Assume that the values A through H are stored in a self-organizing list, initially in…
Q: 2 3 [[1,2, 3], [4, 5, 6] ] \4 5 Complete the Python function transpose () below that takes as input…
A: def transpose(M): # function to transpose a matrix T = [] #…
Q: ive the correct sequence to steps to the list be like below:
A: Option (B) is the CORRECT Option.
Q: During our conversation about Stacks, Queues. and Deques, we talked about the circular array…
A: We don't need circular implementation of stack:- Stack follows Last in First out(LIFO) or First in…
Q: Problem 1 (Linked List) Consider the following linked list: 1| 10 - 5 (a) Write down a program to…
A: without any loop create linked list #include <iostream> template<class T>class…
Q: The specifications for the Unsorted List ADT state that the item to be deleted is in the list.…
A: Leave the list to support random data access where size is the number of items that are in the list…
Q: Implementation Requirements Write a C program to (i) implement the following functions of a Queue…
A: Program approach: Include necessary header files. Initialize the queue ,front rear and size as…
Q: 1. Create a class to implement a queue using a circular array. a. The class should contain…
A: Step 1: Define class Queue with a pointer to integer array queue, size, front and rear. Step 2:…
Q: Problem 1: Consider an array-based queue implementation. Suppose we wish to use an extra bit in…
A: As per our guidelines we are supposed to answer only one question. Kindly repost other questions as…
Q: 5. State whether each of the following is true (T] or false (F]. 1) Storing information in a linked…
A: The answers for question 1-4 are mentioned in step 2. Please note question 5 is isn't complete and…
Q: 1. Give an example of the memory representation of a single linked list. 2. Linked lists…
A: Introduction 1. Give an example of the memory representation of a single linked list. 2. Linked…
Q: True or False Given a stack implemented as an array, and the following functions performed:…
A: Stack works on the principle LAST IN FIRST OUT. Top of the stack will always point to the last…
For each of the following scenarios choose the “best” data structure from the following list or a
combination of data structures: an UNSORTED ARRAY, LINK LIST, DLL, circular LINK
LIST, STACK, QUEUE, DOUBLE ENDED QUEUE, HEAP, BST. In each case, justify your
answer briefly.
i. When the data dynamically grows
ii. A list must be maintained so that any element can be accessed randomly
iii. A
iv. If the developer wants to add or remove both ends
v. Whenever the developer wants quick access to the largest (or smallest) item.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Assume that the values A through H are stored in a self-organizing list, initially in ascending order. Consider the three self-organizing list heuristics: count, move-to-front, and transpose. For count, assume that the record is moved ahead in the list passing over any other record that its count is now greater than. For each, show the resulting list and the total number of comparisons required resulting from the following series of accesses: D H H G H E G H G H E C E H G: For each of the three self-organizing list heuristics (count, move-to-front, and transpose), describe a series of record accesses for which it would require the greatest number of comparisons of the three.Assume that the values A through H are stored in a self-organizing list, initially in ascending order. Consider the three self-organizing list heuristics: count, move-to-front, and transpose. For count, assume that the record is moved ahead in the list passing over any other record that its count is now greater than. For each, show the resulting list and the total number of comparisons required resulting from the following series of accesses: D H H G H E G H G H E C E H GS and Q are integer stacks and priority queues, respectively. C mod 3 is the priority of an element C joining the priority queue Q. In other words, the elements' priority numbers are either 0 or 1 or 2. What is the output of the following code if A, B, and C are integer variables? However, the queue procedures have been modified to work on a priority queue. 1.A = 102.B = 113.C = A+B4.while (C < 110) do5. if (C mod 3) = 0 then PUSH (S,C)6. else ENQUEUE (Q,C)7. A = B8. B = C9. C = A + B10.end11.while not EMPTY_STACK (S) do12. POP (S,C)13. PRINT (C)14.end15.while not EMPTY_QUEUE (Q) do16. DEQUEUE (Q, C)17. PRINT (C)18.end
- (a) In implementing a Queue using an array, a problem might arise if the Queueis implemented in such a way that items in the Queue are inserted at thenext available location and removed from the next leading position, butsuch that, once deleted, the emptied space is unused. The problem thatarises is one where there is free space still in the array, but it is not usablebecause it is not at the end.Demonstrate this problem with a Queue that is stored in an array of size 5for the following instructions. Next, explain how you might resolve thisproblem.Queue q = new Queue(5); // assume the Queue constructor takes 5 asthe size of the arrayq.enqueue(3);q.enqueue(4);q.enqueue(1);q.dequeue( );q.dequeue( );q.enqueue(6);q.enqueue(5);q.dequeue( ); // at this point,// there are only 2 item2 in the queueq.enqueue(7); // this enqueue cannot occur, why??1. Here is how the built-in sum function can be combined with Python’s comprehension syntax to compute the sum of all numbers in an n x n data set, represented as a list of lists: sum(sum(subset) for subset in data) Group of answer choices True False 2. Which of the following statements are correct? Group of answer choices a) A stack is a collection of objects that are inserted and removed according to the Last-in First-out principle; whereas, queue is based on the First-in First-out principle. b) A queue would be a logical choice for a data structure for a Web server responding to requests. c) Unlike arrays, linked list elements are not stored at a contiguous location; the elements are linked using pointers.In C++, Implement a Priority Queue(PQ) using an UNSORTED LIST. Use an array size of 20 elements. Use a circular array: Next index after last index is 0. Add the new node to next available index in the array. When you add an element, add 1 to index (hit max index, go to index 0). Test if array in full before you add. When you remove an element, from the list, move the following elements to the left to fill in the blank, etc ( Like prior program done with LISTS ) Create a class called Node: Have a Name and Priority. Data set - 1 is the highest priority, 10 is lowest priority. Enqueue and dequeue in the following order. Function Name, Priority Enqueue Joe, 3 Enqueue Fred, 1 Enqueue Tuyet, 9 Enqueue Jose, 6 Dequeue Enqueue Jing, 2 Enqueue Xi, 5 Enqueue Moe, 3 Dequeue Enqueue Miko, 7 Enqueue Vlady, 8 Enqueue Frank, 9 Enqueue Anny, 3 Dequeue Enqueue Xi, 2 Enqueue Wali, 2 Enqueue Laschec, 6 Enqueue Xerrax, 8 Dequeue Dequeue Dequeue Dequeue Dequeue Dequeue Dequeue Dequeue Dequeue Dequeue…
- (2) Answer the following questions concerning lists, stacks, and queues: Please be thorough with explanation! (e) Suppose you are implementing a list of stacks. Let's say you decide to implement both the general list (the list of stacks) and each individual stack using a vector. Assume that there are currently N stacks in the list, and each stack has a maximum of K items, where N and K are both large. You are going to iterate through the general list and apply a single operation to each stack as you encounter it. Now answer the following four questions, using big-Theta: What is the average-case time complexity of pushing one additional item into each stack? What is the worst-case time complexity of pushing one additional item into each stack? What is the average-case time complexity of popping one item from each stack? What is the worst-case time complexity of popping one additional item from each stack? (For pops, if the stack is empty, you can assume that the pop itself is a…You are required to demonstrate the running time difference between a linked listand a binary search tree while searching the data. Read the following instructionsand then implement a C++ program that can address the above requirement.1- choose byself a .csv file containing the data named Dataset.csv The dataset file contains a record of 100000 sales records of astore. By using the text file reading method in C++, read the data of the file in alinked list and a binary search tree. (In a single program) After reading the data validate the data reading by implementing a print() method. Take a sales id as an input from the user and search that ID in the linked listand binary search tree. Display the running time difference of both data structures during the searchoperation.1) Allocating memory is faster with an implicit free list than with an explicit free list. True or False. 2) An allocator using the best fit algorithm may have external fragmentation, but will have no internal fragmentation. True or False
- 4) Given that a queue is being represented by the following circular representation in an array (front is currently 4 and back is currently 7): array component: 0 1 2 4 5 6 7 8 | | | | 37 | 41 | 12 | 34 | | a) Show what this representation would like after the following sequence of operations are performed: deq(q, i); deq(q, j); enq(q, 81); enq(q, 72); enq(q, 38); deq(q, k); (indicate the current position of front and back for each operation) b) What is an advantage of this implementation of a queue? c) What is a disadvantage of this implementation of a queue?Exercise 2 Given the following function to update a node in a standard linked list:public boolean update(Node head, int oldValue, int newValue){if (head == null)return false;while (head != null)if (head.data == oldValue){head.data = newValue;return true;}elsehead = head.next;return false;}There may be an error with the code. Answer the following:1) Design your own linked list of 4 nodes with different values2) If the code has an error, describe the issue and provide an example of calling theupdate function with values of your choice and show what the linked list looks likea. Also, show the code changes you would make to fix the error3) If the code does not have an error, provide an example of calling the update functionwith values of your choice and show what the linked list looks likeFor example, if your linked list was 1 -> 2 -> 3 -> 4, and you think there is an error withthis code, you could say something like “the problem with the code is xxx and after callingupdate(3, 5),…Consider the current elements and its indexes in the queue of size 15: {index[00]=102, index[01]=165, index[02]=115, index[03]=384, index[04]=248, index[05]=111}, draw a table (like shown below) the sequence of elements using the operations listed from number 1 to 26 using the queue approach (A) - in shifting the elements one position forward every time an element is deleted. The following are the description of other operations to be used that would result in a QUEUE that contains the elements. IsTopValue – returns the value at the TOP of the queue. IsRearValue – returns the value at the REAR of the queue. IsTopIndex – returns the index of the value at the TOP of the queue. IsRearIndex – returns the index of the value at the REAR of the queue. IsIndexOf – returns the index of the specific value. IsValueOf – returns the value of the specific index. Insert (Q, 12) Dequeue (Q) Dequeue (Q) Insert (Q, 65) Insert (Q, 100) Insert (Q, 43) Dequeue (Q) IsTopValue (Q) Insert (Q, 61) Dequeue…