Write pseudocodes for the procedure StackFull;
Update the Push procedure to consider the exceptional situation
where the stack is full;
Write pseudocodes for the procedures QueueFull and QueueEmpty; In
particular, how would
you revise the queue-full condition \head[Q]==tail[Q]+1", when
\head[Q]==1" thus you
need to wrap around the array index?
Update the Enqueue procedure to consider the exceptional situations
where the queue is full;
Update the Dequeue procedure to consider the exceptional situations
where the queue is empty;
Implement the pseudocodes in Java. That is,
{ Use an array S[1...n] and the attribute top[S] to implement a
Stack of n Elements,
where top[S]==0 means the stack is empty.
{ Use an array Q[1...(n+1)] and the attributes head[Q] and tail[Q],
for a Queue of
n Elements. Again, implementation of head[Q] and tail[Q] should
strictly follow the
pseudocodes.
{ Add to the Java Starter two Java classes ArrayStack.java
and
ArrayQueue.java. Speci cally, these two classes MUST implement
respectively the in-
terfaces Stack.java and Queue.java.
{ You should NOT make any change to the three les: Element.java,
Stack.java and
Queue.java.
public interface Stack {
public void push(Element e);
public Element pop();
public boolean stackEmpty();
public boolean stackFull();
public int getTopValue();
}
public interface Queue {
public void enQueue(Element e);
public Element deQueue();
public boolean queueEmpty();
public boolean queueFull();
public int getHeadValue();
public int getTailValue();
}
public class Element {
private int key;
private String info;
public Element(int key, String info) {
this.key=key;
this.info=info;
}
public int getKeyValue() {
return this.key;
}
public String getStringValue() {
return this.info;
}
}
In: Computer Science
In 1998, the governor of New York, George Pataki, formulated a $185 million plan to update old Amtrak trains. The purpose of such a project was to make the old trains faster than the more current Amtrak trains. Such a reconstruction would allow for a high-speed rail system between Albany and New York City. Unfortunately, Amtrak produced only one train, and though millions of dollars were poured into the company to fund the project, auditing showed that the company showed little spending on the trains. Problems stemmed in part from the lack of engineering expertise of the Steel Company that was picked to work on the trains. Also, the state's Department of Transportation (DOT) was not experienced in overseeing projects of this type, so little oversight was given to Amtrak. Furthermore, unforeseen problems arose such as air conditioning malfunctions and the removal of asbestos from train cabins. After the plan seemed as though it would never be successful and Amtrak was extremely low on money due to normal operations, the company tried to settle with the state to escape the project. However, the state filed a lawsuit against Amtrak. Amtrak's defense was that both parties made a unilateral mistake because neither party foresaw the problems or extra costs associated with the project that made it unrealistic. How do you think the court decided? [New York v. AMTRAK,2007 U.S. Dist. LEXIS 13045 (N.D.N.Y, Feb. 23, 2007).]
In: Accounting
22. When you attempt to update a Web page and data is received by your system, how can this be determined by an email the is received by a software such as Outlook? A. The system used the trailer of the packet with the number assignment. B. A combination of the IP address and the computer name is used. C. The service of DNS is used to apportion the correct information. D. Port numbers are used 23. Which of the following is not considered a factor that would cause delay on a VoIP system? A. How many routers are in the path B. The IP address of the destination system C. How efficient the codec is D. The very processing of the various packets traveling the line E. A level of potential congestion 24. You decide to make a phone call to one of your best friends who is currently traveling to Tokyo. You dial the phone but get a busy signal. After three attempts, your friend finally picks up the phone and she starts to recount all the exciting things she is experiencing, including the yummy foods she has been tasting during her trip. Which of the following are your using--for certain? A. SIP B. PBX C. SS7 D. H.323 25. Which of the following is considered a newer implementation in the VoIP environment? A. SIP B. TCP C. UDP D. H.323
In: Computer Science
Pleasant Beverages Ltd has the following audit problems:
• The company did not update the listing for the changes in shareholding of the company
• The director’s minutes were not prepared for the current year • No annual general meeting (AGM) was held last year
• There was no written consent from the directors to act
• The company did not even justify the reason for not keeping proper records and holding the AGM
Required : For this scenario discuss the audit issues to be considered and what impact these issue would this have on the audit opinion. You may also justify the answer using relevant legislation such as the Corporations Act and relevant auditing standards.
In: Accounting
In 1998, the governor of New York, George Pataki, formulated a $185 million plan to update old Amtrak trains. The purpose of such a project was to make the old trains faster than the more current Amtrak trains. Such a reconstruction would allow for a high speed rail system between Albany and New York City. Unfortunately, Amtrak produced only one train, and though millions of dollars poured into the company to fund the project, auditing showed that the company showed little spending on the trains. Problems stemmed in part from the lack of engineering expertise of the Steel company that was picked to work on the trains. Also, the state’s Department of Transportation was not experienced in over seeing projects of this type, so little oversight was given to Amtrak. Furthermore, unforeseen problems arose such as air condition malfunctions and the removal of asbestos from train cabins. After the plan seemed as though it would never be successful and Amtrak was extremely low on money due to normal operations, the company tried to settle with the state to escape the project. However, the state filed a lawsuit against Amtrak. Amtrak’s defense was that both parties made a unilateral mistake because neither party foresaw the problems or extra costs associated with the project that made it unrealistic. How do you think the court decided?
In: Operations Management
In: Computer Science
Update the following C code and write the function :
void sln_stutter(sln_list* li);
that modifies the list li so that it each element is duplicated. For example the list with elements [1,2,3] would after this function call become the list [1,1,2,2,3,3].
#include <stdlib.h>
#include <stdio.h>
struct sln_node {
struct sln_node* next;
int key;
};
struct sln_list {
struct sln_node* head;
};
typedef struct sln_node sln_node;
typedef struct sln_list sln_list;
static sln_node* freelist = NULL;
/* Internal bookkeeping functions for the free list of nodes. */
sln_node* sln_allocate_node() {
sln_node* n;
if(freelist == NULL) {
freelist = malloc(sizeof(sln_node));
freelist->next = NULL;
}
n = freelist;
freelist = n->next;
n->next = NULL;
return n;
}
void sln_release_node(sln_node* n) {
n->next = freelist;
freelist = n;
}
void sln_release_freelist() {
sln_node* n;
while(freelist != NULL) {
n = freelist;
freelist = freelist->next;
free(n);
}
}
/* Create a new singly-linked list. */
sln_list* sln_create() {
sln_list* list = malloc(sizeof(sln_list));
list->head = NULL;
return list;
}
/* Release the list and all its nodes. */
void sln_release(sln_list* list) {
sln_node* n = list->head;
sln_node* m;
while(n != NULL) {
m = n->next;
sln_release_node(n);
n = m;
}
free(list);
}
/* Insert a new element to the list. */
void sln_insert(sln_list* list, int key) {
sln_node* n = sln_allocate_node();
n->key = key;
n->next = list->head;
list->head = n;
}
/* Check if the list contains the given element. Returns 1 or 0. */
int sln_contains(sln_list* list, int key) {
sln_node* n = list->head;
while(n != NULL && n->key != key) {
n = n->next;
}
return (n == NULL)? 0: 1;
}
/* Remove the first occurrence of the given element from the list.
Returns 1 if an element was removed, 0 otherwise. */
int sln_remove(sln_list* list, int key) {
sln_node* n;
sln_node* m;
n = list->head;
if(n == NULL) { return 0; }
if(n->key == key) {
list->head = n->next;
sln_release_node(n);
return 1;
}
while(n->next != NULL && n->next->key != key) {
n = n->next;
}
if(n->next != NULL) {
m = n->next;
n->next = m->next;
sln_release_node(m);
return 1;
}
return 0;
}
In: Computer Science
Description: The goal of this assignment is to compare the empirical complexity of two sorting algorithms: a) Heap sort and b) Radix sort.
Instructions:
- Implement the above two sorting algorithms using Java or any other programming language.
- Repeatedly generate random input instances containing 10, 50, 100, 500, 1000, 5000, 10000, 15000, … 50 000. The generated numbers must be between 0 and 100.
- Execute both algorithms to sort the randomly generated arrays.
- Compare the running time of both algorithms and validate their theoretical complexity.
Comment your source code and upload it along with a Word document presenting your results. The report should contain plots illustrating the obtained results and facilitating the comparison of the time complexity of both algorithms.
Hints: The theoretical time complexity for a Heap sort algorithm is O (n log n) and O(d(n+b)) for the Radix sort. As above indicated, b is 10 and d is 3. Considering that configuration, the empirical time complexity of Radix sort should be better than the Heap sort.
Extra: Empirical Study of the impact of d
What if the randomly generated numbers become between 0 and 10 000000 instead of 0-100. Will the Radix algorithm continue to perform better than heap sort? If not, what is the value of d at which Heap sort becomes better than Radix sort. Vary d and re-plot the performance of both algorithms.
In: Computer Science
Until about the year 2000, managed care was viewed by many (mostly employers) as an effective means of controlling health care costs. Briefly address why there has been a backlash against HMOs since 2000.
In: Economics
Topic: Recent molecular biology advance in tumor diagnosis (write a review on it more than 2000 words) Please answer the question only if you can observe the minimum limit of 2000 words. Thank you
In: Biology