homework

How do I extend infix and stack priorities to additional operators?

How would the infix and stack priorities be extended to include the operators <, >, <=, >=, ==, !=, !, &&, and ||? When parsing an infix expression, for example: P + (Q – F) / Y#, each symbol has a priority which is relevant to their order of operation. / and * have a higher priority than + and -. Here are the priorities I have/underst...

Homework: A Logic bug in my C# code, What Should I do ....?

Hi I'm Having a logical error Now I provided the following as input the Salary i input the salary 30000 the No. Child 9 so the so the net salary will be the family bonus + salary - tax (750) + (30000) - (3000) but my program count them as (1500) + (30000) + (6000) my program doubled ( accumulate ) the family...

Homework: Doing a binary search on some elements in Haskell

Hello, I'm trying to complete the last part of my Haskell homework and I'm stuck, my code so far: data Entry = Entry (String, String) class Lexico a where (<!), (=!), (>!) :: a -> a -> Bool instance Lexico Entry where Entry (a,_) <! Entry (b,_) = a < b Entry (a,_) =! Entry (b,_) = a == b Entry (a,_) >! Entry (b,_) = a...

Program to simulate vehicles at an intersection using queues

HI I got this coursework question to solve. This is the question: Design a program to simulate vehicles at an intersection. Assume that there is one lane going in each of four directions, with stoplights facing each direction. Vary the arrival time of vehicles randomly in each direction and set up a regular frequency of the light cha...

Inserting a node into a linked list in constant-time?

I'm working on an assignment that is telling me to assume that I have a singly linked list with a header and tail nodes. It wants me to insert an item y before position p. Can anybody please look over my code and tell me if I'm on the right track? If not, can you provide me with any tips or pointers (no pun intended)? tmp = new Nod...

Tournament graph question(s)

Is a tournament graph the same thing as a directed complete graph? And, do all vertices in a tournament graph have the same number of edges? ...

dominating set of a tournament graph

I am writing an algorithm to find the dominating set of a tournament graph. Is the minimum spanning tree of a directed graph equivalent to the dominating set of the graph? In other words, if I find the smallest MST for the tournament graph (by iterating through all of the vertices), can I then say this is equivalent to the dominating set...

Invalid Cast during Input

I'm doing a basic homework assignment which looks like this: While input <> -1 input = CDbl(InputBox("Enter numbers to add, enter -1 to stop")) values = values + input End While It works fine until I press 'cancel' on the input box. Then the string input is "", and I get the following error: System.InvalidCas...

How to use set! in Scheme functions?

How would you use set! in a simple procedure f such that evaluating (+ (f 0) (f 1)) will return 0 if the arguments to + are evaluated from left to right but will return 1 if the arguments are evaluated from right to left? ...

Scalability & Quality of Service of Web Servers

hello guys, I would like to know how can we improve the scalability and quality of services of current web servers? The solutions of it should not have been implemented in the current web servers. Any help regarding it will be appreciable. Thanks ...

How to make a method to return random string in the format A1A 1A1?

I need a method to return a random string in the format: Letter Number Letter Number Letter Number (C#) ...

Declarations, definitions, initializations in C, C++, C#, Java and Python

What do the terms mean in each of the above languages? Why do the languages differ (wherever they do, if at all they do) in this respect? ...

Explain why your MTU size has been set to this value?

I have an assignment that asked: Indicate what you think your MTU size is and why? My MTU size is 1024 because i can only send 996 and then adding the 28 bytes, i get 1024. I undersatnd that. But then they asked: Explain why your MTU size has been set to this value? I really don't have the answer. Can someone help me? ...

Minimize function in adjacent items of an array

I have an array (arr) of elements, and a function (f) that takes 2 elements and returns a number. I need a permutation of the array, such that f(arr[i], arr[i+1]) is as little as possible for each i in arr. (and it should loop, ie. it should also minimize f(arr[arr.length - 1], arr[0])) Also, f works sort of like a distance, so f(a,b) ...

Generating partitions in Java

I am given an integer (lets call it x) and I need to generate an array of arrays, where each subarray is a list of elements which are one of a given set of integers, and the sum of all of the elements of each subarray is x. The array of arrays needs to contain all possible distinct subarrays of this form. For example, if x is 3 and the ...

Returning a pointer from a class.

For my programming class I have to write a linked list class. One of the functions we have to include is next(). This function would return the memory address of the next element in the list. #include <iostream> using namespace std; class Set { private: int num; Set *nextval; bool empty; public: Set(); ...

What's a good way for figuring out all possible words of a given length.

I'm trying to create an algorithm in C# which produces the following output strings: AAAA AAAB AAAC ...and so on... ZZZX ZZZY ZZZZ What is the best way to accomplish this? public static IEnumerable<string> GetWords() { //Perform algorithm yield return word; } ...

Filling up a TreeView control

OK this is going to sound hilarious but still I have a class like so class TermNode { public string Name; public string Definition; public List<TermNode> Children } So this is a N-Ary non sorted in any way Tree. A node can have 0-N children OK so given this data structure how will you fill up a tree View with it Assume you ...

Object Oriented design for PHP application

For our school project, we are tasked to define a design document describing the architecture of a PHP application. We are free te decide what to include in the document. Our professor suggested, lots of (UML) diagrams. He also asked us to consider class diagrams, but with care, as PHP is not fully object oriented. My question: Is a...

euler cycles with biconnected components

if a graph has a Euler cycle do the biconnected components have Euler cycles as well? ...